Below are extracted code snippets that captures the essence of how I use it. Basically, I make the coordinate corresponds to screen and then load the texture and render the polygons (need not be rectangle). These code snippets still works if I use OGLES1.
As I had also made changes to OGLES2 to enable skeleton animation, going back to OGLES1 is not an option for me.
Hence, will appreciate some pointers on how to achieve the equivalent effect, e.g. should I use setMaterial() + drawPrimitiveList(), or some other ways.
Thanks!
Code: Select all
// update matrices so that coordinate corresponds to screen
irr::core::matrix4 mat1;
irr::core::matrix4 mat2 = mat1.buildNDCToDCMatrix(driver.getViewPort(), 1.0f);
mat2.getInverse(mat1);
driver.setTransform(irr::video::ETS_PROJECTION, irr::core::matrix4());
driver.setTransform(irr::video::ETS_VIEW, irr::core::matrix4());
driver.setTransform(irr::video::ETS_WORLD, mat1);
Code: Select all
// set texture
driver->disableTextures(1);
if (! driver->setActiveTexture(0, texture)) {
LogI("driver->setActiveTexture(0, texture) failed\n");
return;
}
Code: Select all
// after setting texture, only call the following if it is OGLES2 (not called for OGLES1)
driver->setRenderStates2DMode(true, true, true);
Code: Select all
// finally, draw vertices
glDisable(GL_CULL_FACE);
driver->drawVertexPrimitiveList2d3d(
&polygon->Vertices[0],
polygon->NumVertex,
&polygon->Indices[0],
polygon->NumIndex / 3,
irr::video::EVT_STANDARD,
irr::scene::EPT_TRIANGLES);