Jump to content
  • Advertisement


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


Texture mapping probs under D3D

This topic is 6781 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

Ok this isn''t funny now... im trying to texture map a single polygon (square - rendered as a 4 vertex trianglestrip) under D3D7. All my code works fine if I just want a shaded polygon, i see my lovely coloured square on the screen. I know my bitmap loading stuff works, because i can do a DirectDraw Blt() from the texture surface to the back buffer and see it no problem, its just that when I call SetTexture(0,tex) and then render the primitive, the screen is just black (no it aint a black texture), and the DrawPrimitive() call returns an unknown HRESULT (im checking them all and it aint returning any of em). This is driving me MADDDDDDDDDDDD! heres a code snippet: (debug stuff stripped out) lpD3DDevice7->BeginScene(); lpD3DDevice7->SetTexture(0,tex); lpD3DDevice7->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX,&tl,4,D3DDP_WAIT); lpD3DDevice7->EndScene(); Flip(); Any ideas gang? a tube of smarties to anyone who solves it... http://www.positech.co.uk

Share this post

Link to post
Share on other sites
Try using D3DXGetErrorString(HRESULT hr, DWORD length, LPSTR string) to get what error it is.

Have you specified that the surfaces is a texture when you created it? If you don''t you can still blit from it, but you cannot use it in DrawPrimitive().

ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;

Share this post

Link to post
Share on other sites
that D3DX gives me this:
which i dont see anywhere as a return type. I didnt know you could do that,cheers! however i still have my problem...I am including the texture flag. here is the full code:

ZeroMemory( &ddsd, sizeof(DDSURFACEDESC2) );
ddsd.dwSize = sizeof(DDSURFACEDESC2);
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
ddsd.dwWidth = 32;
ddsd.dwHeight = 32;
ddsd.dwTextureStage = 0;
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;

// Create the primary surface.

the CreateSurface() call works fine, ive experimented by adding the pixel format and texturestage stuff, im not sure if i need them, but either way it dosent work. I can blit fine from this surface, what could be wrong? Any help HUGELY appreciated.


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!