How Do I Show A PNG? May 04, 2012 12:27PM | Registered: 12 years ago Posts: 110 |
Re: How Do I Show A PNG? June 06, 2012 02:56PM | Registered: 13 years ago Posts: 58 |
// create a texture from a png (width and height have to be a power of two) Texture2D* pTex = WIRE_NEW Texture2D(Importer::LoadPNG("pic.png", false)); // create a renderable object (a quad) and attach the texture Geometry* pGeo = StandardMesh::CreateQuad(0 /* vertex colors */, 1 /* uvs */); pGeo->SetMaterial(WIRE_NEW Material); pGeo->GetMaterial()->AddTexture(pTex, Material::BM_REPLACE); // scale the quad to the size of the png pGeo->World.SetScale(Vector3F(pTex->GetImage()->GetBound(0), pTex->GetImage()->GetBound(1), 0)); // create a camera with orthogonal projection Camera* pCamera = WIRE_NEW Camera(/* isPerspective */ false);
GetRenderer()->ClearBuffers(); GetRenderer()->PreDraw(pCamera); GetRenderer()->Draw(pGeo); GetRenderer()->PostDraw(); GetRenderer()->DisplayBackBuffer();
Re: How Do I Show A PNG? June 11, 2012 09:12AM | Registered: 12 years ago Posts: 110 |