Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

pdstatha

Not displaying

This topic is 5903 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
  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;
}  
Rendering objects
  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();
}
  
The CPanel Render function
  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

}  

Share this post


Link to post
Share on other sites
Advertisement
Well, you did not include the code on loading the texture.
And we will hardly find any errors when you just post your calls to your engine functions.

Im Anfang war die Tat...
Faust

Share this post


Link to post
Share on other sites

  bool CPanel::setTexture(const char *szTextureFilePath, DWORD dwKeyColour)
{

if(FAILED(D3DXCreateTextureFromFileEx(m_pD3DDevice, szTextureFilePath, 0, 0, 0, 0,
D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT,
D3DX_DEFAULT, dwKeyColour, NULL, NULL, &m_pTexture)))
{
return false;
}

return true;
}

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!