Skip to main content
gamedev.net
🔒 Locked

Rendering surfaces

Started by CAPE Mar 14, 2007 at 6:17 PM 0 replies 250+ views
Original Post
CAPE
CAPE
Hi all. I wonder why my surfaces aren't renderd. I'm following the book: "DirectX® 9 User Interfaces: Design and Implementation" and in the beginning i just peeked at the book for small solutions and idées, just so i could do it my own way. But I can't get my simple surfaces to render, even if I copied the darn book. I can't find the correct help either, so I ask aroud here. This seems that it should be under the thread Beginners, but I ask here anyway :P Well here's my code:

D3DXIMAGE_INFO info;
HRESULT result;

//get the width & height of bitmap file
result = D3DXGetImageInfoFromFile("Namnlöst.png",&info);
if (result != D3D_OK) return NULL;

//create surface
result = m_Device->CreateOffscreenPlainSurface(
	info.Width,		
	info.Height,	
	info.Format,
	D3DPOOL_DEFAULT,
	&g_Surface,			
	NULL);			

if (result != D3D_OK) return NULL;


result = D3DXLoadSurfaceFromFile(
	g_Surface,		
	NULL,		
	NULL,		
	"Namnlöst.png",	
	NULL,		
	D3DX_DEFAULT,	
	0xffffffff,	
	NULL);		


and the rendering:

m_Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0xff1144bb, 1.0f, 0);
m_Device->BeginScene();

m_Device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &g_BackBuffer);
m_Device->UpdateSurface(g_Surface, NULL, g_BackBuffer, NULL);

if (g_BackBuffer!= NULL)
{
	g_BackBuffer->Release();
}

m_Device->EndScene();
m_Device->Present(0,0,0,0);

Everyting goes through nicely, my image surface are filled correctly (atleast the is no error :D), no problem to get the backbuffer either. But my scene stays clean. So, please help me.
David Gustavsson
Developer on "Hello space"
IndieDB

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.