Original Post
Yeah its me again, i''ve encountered another problem
, I''ve set up a vertex quad and tried to load a texture on to it. But when I call the render function it doesn''t display itself!!!
Where the vertices get initialised
Rendering objects
The CPanel Render function
bool CHardball::InitGame()
{
//Setup panels for 2D
m_pBackground = new CPanel(pD3D->getD3DDevice(),800,600,pWindow->getWidth(),pWindow->getHeight());
m_pBackground->setTexture("Bckg.bmp", D3DCOLOR_XRGB(0, 0, 0)); //Load the texture and set the key colour
return true;
} void CHardball::Render()
{
pD3D->Clear(D3DCOLOR_XRGB(0, 0, 0));
pD3D->BeginScene();
//Setup the camera ready for 2D elements
Setup2DCamera();
//Now that the 2D camera is setup, render the 2D objects
Render2D();
pD3D->EndScene();
pD3D->Present();
//Count Frames
m_dwFrames++;
}
void CHardball::Render2D()
{
m_pBackground->moveTo(0,0);
m_dwTotalPolygons += m_pBackground->Render();
}
DWORD CPanel::Render()
{
m_pD3DDevice->SetStreamSource(0, m_pVertexBuffer, sizeof(PANEL_CUSTOMVERTEX));
m_pD3DDevice->SetVertexShader(PANEL_D3DFVF_CUSTOMVERTEX);
if(m_pTexture != NULL)
{
m_pD3DDevice->SetTexture(0, m_pTexture);
m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
}
else
{
m_pD3DDevice->SetTexture(0, NULL);
}
m_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
return 2; //Return the number of polygons rendered
}