Jump to content
  • Advertisement
Sign in to follow this  

DX11 [DX11] Full Screen Quad

This topic is 2945 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 am trying to render full screen quad.

I precompute coordinates

viewProj = ortho matrix for viewport

float startX = -viewport->Width * 0.5f;
float startY = -viewport->Height * 0.5f;
float endX = viewport->Width * 0.5f;
float endY = viewport->Height * 0.5f;

MyMath::Vector3 vecA = MyMath::Vector3(startX, startY, 1);
MyMath::Vector3 vecB = MyMath::Vector3(startX, endY , 1);
MyMath::Vector3 vecC = MyMath::Vector3(endX , startY, 1);
MyMath::Vector3 vecD = MyMath::Vector3(endX , endY , 1);

vecA = MyMath::Vector3::TransformCoordinate(vecA, viewProj);
vecB = MyMath::Vector3::TransformCoordinate(vecB, viewProj);
vecC = MyMath::Vector3::TransformCoordinate(vecC, viewProj);
vecD = MyMath::Vector3::TransformCoordinate(vecD, viewProj);

For every position, i set corners UV (0,0) , (1,1), (0, 1) or (1, 0) - that is correct

Ok.. so far, everything is OK (quad is correctly rendered)

Into that quad, I render 32x32 texture, taht should be filled in PS. Now my problem is, that if i debug pixel, i got incorrect UV coordinates. Eg... coordinates seems to be clipped from fullQuad (viewport.Width x viewport.Height).. so my 32x32 texture occupied only part of whole "quad", so tex coordinates are wrong.
If I use same princip in DX9, everything work just fine.

How can I fill texture, that is smaller tah viewport ? On next image... X = 31, Y = 31... UV are correct.. but if I debug that pixel [31,31] i got incorrect UV values (image 2)



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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!