Sign in to follow this  
AquaMacker

DX10... 3dMax Drawing..ZBuffer?

Recommended Posts

AquaMacker    255

[attachment=13364:?? ??.png]

 

Hi...

Please look PIC...

 

I use 3dMax, maxscript and DX10.

 

I guess Zbuffer problem...

 

But zbuffer setting value is default value( == ON ).

 

pDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP );

cullmode = d3d10_cull_front;

 

Indexing is fullvertexmodel... like this...

 

for ( int i = 0; i < nFaceNum; i++ )
{    
   pstIndices[i].A = j++;
   pstIndices[i].B = j++;
   pstIndices[i].C = j++;
}
 

 

Is related to cullmode, zbuffer or Indexing method ? 

 

I have no idea. Really... @.@

 

How to solve the problem ?

 

 

 

Please understanding my bad english...

Edited by AquaMacker

Share this post


Link to post
Share on other sites
AquaMacker    255

I found this problem...

 

I insert code pFont->DrawText()... -> This is PROBLEM !!!

 

 

Clear~~~~

ObjectDraw() -> Cull_Front
pFont-DrawText()

Present( 0, 0 );
 

 

Object draw with Cull_Front ... ONLY !!!

 

but font->draw() after object seems like to draw Cull_BACK !

 

I guess DrawText() function is Only Cull_BACK Draw...

 

Is DrawText() function Bug ?

Edited by AquaMacker

Share this post


Link to post
Share on other sites
Nik02    4348

DrawText sets some device state in order to do its job, and it's not resetting the state for you. You should explicitly set all the states upon drawing your objects.

Share this post


Link to post
Share on other sites
Nik02    4348
Just before you draw your objects (at each frame), set all the states that affect the rendering of said objects. These include input assembler settings, rasterizer state, blend state, output merger state, shaders, views, textures, samplers, buffers, input layout (and some others). Rendering text usually sets some of these states, and in your case the font object isn't apparently resetting some of the states after drawing; this is why you need to do it.

For a small list of objects this may seem like overkill, but if you have many similar objects you can sort their rendering by the states they use (commonly known as "batching"). This potentially saves a lot of user->kernel transitions (driver calls) - those can eat your cpu cycles fast.

---

Note that if you use ID3DX10Font (this is not apparent in your code), you can use a sprite object that you previously allocated in order to store the font's render states. The sprite object uses a Begin/End pair; the Begin method lets you specify that upon calling End the device state is restored to pre-Begin state. So if you surround the font drawing with the Begin/End of its sprite, you can control whether or not it resets the state for you.

All that said, you can potentially save performance if you still do the state sets manually only when you actually do need to set them. You see, resetting takes the same time or more as setting. Edited by Nik02

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this