Jump to content
  • Advertisement
Sign in to follow this  
e5431

DX10: CDXUTSDKMesh::Render bug???

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

Hello.

Tried to render a mesh using its default method. It works fine until you add text rendering using CDXUTTextHelper...At first I thought that I did something wrong, I took Tutorial 10 and changed it a bit. Well, the problem persists.

I left the following rendering calls in OnD3D10FrameRender():

//the mesh class also had a render method that allows rendering the mesh with the most common options g_Mesh.Render( pd3dDevice, g_pTechnique, g_ptxDiffuseVariable ); g_HUD.OnRender( fElapsedTime ); g_SampleUI.OnRender( fElapsedTime ); RenderText();

So, it resulted in the following picture:

we can see that it is dark and the mesh looks corrupted and no texture mapping is performed... Close-up of the head:

Well, lets comment out RenderText() function:

//the mesh class also had a render method that allows rendering the mesh with the most common options g_Mesh.Render( pd3dDevice, g_pTechnique, g_ptxDiffuseVariable ); // Render the UI g_HUD.OnRender( fElapsedTime ); g_SampleUI.OnRender( fElapsedTime ); //RenderText();

And the result is the following image:

Isn't the difference obvious? The same frame, different look! :)

I wanted to ask: is there any way to fix it?

Share this post


Link to post
Share on other sites
Advertisement
I would guess that your render state or texture stage setup for rendering Tiny is just using defaults, but the text render changes a state. You may just need to define the render states specifically before rendering Tiny.

Share this post


Link to post
Share on other sites
Thanks for replies to everyone !

colinolivant: it's the same as in the Tutorial, nothing special or exotic, IMHO:
//-------------------------------------------------------------------------
// Render the help and statistics text
//-------------------------------------------------------------------------
void RenderText()
{
g_pTxtHelper->Begin();
g_pTxtHelper->SetInsertionPos( 2, 0 );
g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) );
g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() );
g_pTxtHelper->End();
}

51mon:
Yes, of course vertex layout is set, it is a tutorial code. ;) I've just changed mesh rendering part.

Supernat02:
Thanks. I will give it a try..

Share this post


Link to post
Share on other sites
You should check using PIX - use D3DPERF_SetMarker() and do a single-frame capture. Compare the pipeline state before/after and you should be able to determine if a state is leaking.

I forget the details, but there were some changes to ID3DXFont that buggered stuff up recently - to the extent that you needed to put a DepthStencilState object directly into FX files as the DXUT framework disabled depth buffering ([oh]).

hth
Jack

Share this post


Link to post
Share on other sites
51mon:

You were right. :)
I accidetly commented out the line where vertex layout was set.
So, the bug was in my braunware :) Feeling so stupid now...
Thank you very much.

Share this post


Link to post
Share on other sites
Another stupid question on the same topic:
why do we have to set vertex layout every frame?

Share this post


Link to post
Share on other sites
Quote:
Original post by e5431
why do we have to set vertex layout every frame?
You don't. All you need to do is ensure that the pipeline is configured correctly when a Draw() call is issued. Removing redundant state changes is a simple and common optimization - if you can guarantee the vertex layout never changes then yes, you can skip re-setting it.

hth
Jack

Share this post


Link to post
Share on other sites
Well how to ensure correct pipeline configuration when working with DXUT?
DXUT samples call
pd3dDevice->IASetInputLayout( g_pVertexLayout );
every frame..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!