Jump to content
  • Advertisement
Sign in to follow this  
Toastmastern

DX11 Render terrain with Tessellation when my 2D text disappears

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

Hi GameDev.net,

 

As I did explain in an earlier thread I am using Rastertek's tutorials to learn DirectX while at the same time training my C++ skills and today I ran into what I think is a weird issue.

 

I have my framework setup as the first tutorial on how to render a terrain(

 

everything is working so far. But today I tried to implement Tessellation together with it by following (http://www.rastertek.com/dx11tut38.html)

 

Pretty straight forward and the tessellation part works as intended but I render the terrain with Tessellation the text disappears. The game loop is running and it is processing input and everything. It's just that my 2D text seems to have disappeared. 

 

It's confusing to me since I believe they are using totaly different buffers and shaders, they are rendered separately. I've only looked over the issue for 1 hour and going to continue tomorrow but thought I would throw a question out here before going to bed if someone has been following these tutorials and had a similiar problem or if someone is more knowledgable then me and know what I should direct my search tomorrow.

 

Best Regards

Toastmastern

Share this post


Link to post
Share on other sites
Advertisement

Are you setting the hull and domain shader back to NULL after you're done using tessellation?

Share this post


Link to post
Share on other sites

Are you setting the hull and domain shader back to NULL after you're done using tessellation?

 

That was exactly the case, the both had the same DeviceContext(of course ^^)  and while the VertexShader and the PixelShader got overwritten in the FontShaderClass the HullShader and the Domain Shader did not. Solved it by putting them to NULL in the FontShaderClass:

 

 

void FontShaderClass::RenderShader(ID3D11DeviceContext *deviceContext, int indexCount)

{
deviceContext->IASetInputLayout(mLayout);
 
deviceContext->VSSetShader(mVertexShader, NULL, 0);
deviceContext->HSSetShader(NULL, NULL, 0);
deviceContext->DSSetShader(NULL, NULL, 0);
deviceContext->PSSetShader(mPixelShader, NULL, 0);
 
deviceContext->PSSetSamplers(0, 1, &mSampleState);
 
deviceContext->DrawIndexed(indexCount, 0, 0);
 
return;
}

 

 

Thanks again MJP!

 

//Toastmastern

Share this post


Link to post
Share on other sites

By the way, if you're not doing it already you should create your device with the D3D11_CREATE_DEVICE_DEBUG flag for your debug builds. If you do this, you'll get warnings and errors in the debugger output window that will tell you about issues like this. You can also tell the debug layer to break into the debugger as soon as the error happens, which lets you pinpoint the line of code that caused the error:

ID3D11InfoQueue* infoQueue = nullptr;
device->QueryInterface(__uuidof(ID3D11InfoQueue), reinterpret_cast<void**>(&infoQueue));
if(infoQueue)
{
    infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, TRUE);
    infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, TRUE);
}

Also, for posting source code here you can use the "code" BBCode tag to get nice formatting instead of using the quote feature.

Edited by MJP

Share this post


Link to post
Share on other sites

By the way, if you're not doing it already you should create your device with the D3D11_CREATE_DEVICE_DEBUG flag for your debug builds. If you do this, you'll get warnings and errors in the debugger output window that will tell you about issues like this. You can also tell the debug layer to break into the debugger as soon as the error happens, which lets you pinpoint the line of code that caused the error:

ID3D11InfoQueue* infoQueue = nullptr;
device->QueryInterface(__uuidof(ID3D11InfoQueue), reinterpret_cast<void**>(&infoQueue));
if(infoQueue)
{
    infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, TRUE);
    infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, TRUE);
}

Also, for posting source code here you can use the tag to get nice formatting instead of using the quote feature.

 

Thanks for the tip! I would look into that right away :)

 

//Toastmastern

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!