Jump to content
  • Advertisement


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


Rendering incorrectly

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

I just started learning how to do meshes, and I finally have a class that loads an x file, but when it renders, its kind of transparent. I say kind of, because the colors are the, but (the model is a duck (looks like a rubber duck)) if you look at it from behind, you can see the beak through the back of the head. Does anybody know why this is happening. I know I''m supposed to post my code, but its 9 different files and 1077 lines long. If anybody has "The Zen of Direct3D Game Programming", my code is alot like it. The beginning is too close to the end...

Share this post

Link to post
Share on other sites
Here's my device creation code:
m_pDirect3D = Direct3DCreate8(D3D_SDK_VERSION);


PresentParams.BackBufferFormat = Format;
PresentParams.BackBufferWidth = Size.m_iWidth;
PresentParams.BackBufferHeight = Size.m_iHeight;
PresentParams.hDeviceWindow = hWnd;
PresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;

PresentParams.EnableAutoDepthStencil = TRUE;
PresentParams.AutoDepthStencilFormat = D3DFMT_D16;

PresentParams.MultiSampleType = D3DMULTISAMPLE_NONE;

PresentParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;

PresentParams.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;



Right after that I have these:

g_Direct3D.GetDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
g_Direct3D.GetDevice()->SetRenderState(D3DRS_LIGHTING, FALSE);

I can post more code, but I don't know what to post.

Also, I'm not using any SetTextureStageState calls, might that fix it. (I didn't think so, because it did the same thing with a plain triangle (multicolored))

[edited by - Programmer16 on December 16, 2003 3:30:25 AM]

Share this post

Link to post
Share on other sites
Normals define which direction the triangle is pointing. I''m pretty sure that x files always use normals, or at least mine did without my defining it. I don''t know, it just sounds to me like you have flipped normals, or the triangles are defined the wrong direction such that the default normals are the wrong way. You just might want to play around with it - may be the problem, might not be.

Share this post

Link to post
Share on other sites
I''m guessing its still the zbuffer that isn''t working. Make sure when you set your perspective matrix (D3DXMatrixPerspectiveFOVLH, or whatever) that the zbuffer values are good. More specifically, make sure the nearz value in that function is not 0, or near to zero. Try nearz 1, farz 30000.

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!