Hi Guys,
Is there an equivalent for glHint(GL_PERSPECTIVE_CORRECTION_HINT , GL_NICEST) in DirectX 9c?
Thanks in advance
Hi Guys,
Is there an equivalent for glHint(GL_PERSPECTIVE_CORRECTION_HINT , GL_NICEST) in DirectX 9c?
Thanks in advance
But, DirectX doesn't do this by default with or without shaders. Hence the texture issue I have.
DirectX and GL will both perform perspective correction by default.
GL_PERSPECTIVE_CORRECTION_HINT in GL is a very weak request (not a demand) to the driver, where you can tell it that you'd like it to perform perspective correction at a lower-quality in exchange for better performance, if possible... It's not a very useful feature.
Hence the texture issue I have
What texture issue?
For DirectX 3 and 5 perspective-correct texturing was disabled by default; I don't have SDKs currently available and so can't tell you the API used.
With DirectX 6 and 7 it was enabled by default and the API used to control it was SetRenderState with D3DRENDERSTATE_TEXTUREPERSPECTIVE (which had a value of 4 and used TRUE or FALSE to enable or disable).
From DirectX 8 onwards this render state was removed and an entry with a value of 4 is no longer present in the D3DRENDERSTATETYPE enum. Perspective-correct texturing is always on.
Now, you might be able to call SetRenderState (4, TRUE) or SetRenderState (4, FALSE) and actually have your driver respect it (I suspect that an old Intel 965 I once had trouble with did), but that would mean that you're relying on your driver doing undocumented and unsupported behaviour, which is never a good idea.
As Hodgman said and I agree, it sounds like you've got a totallly different problem here and it would help a lot if you actually told us what that problem was rather than telling us what you think the solution might be.
The problem is this;
I am getting what is happening in the second image, where I want the third.
I am getting this with DirectX 9c and DirectX 11.
This is happening on two different systems one with a Radeon HD5570 and the other with a Geforce GTX 750. So, both graphics cards a reasonably recent.
If that shape is actually a square, but it's being viewed in a 3D environment at an angle, such that the top two verts are further away, the D3D/GL will give you the image on the right.
If the shape is 2D, and you've manually moved the top two verts closer together, you'll get the image in the middle. D3D/GL cannot magically fix this for you.
[edit] For others: here's a link to the original thread http://www.gamedev.net/topic/656573-texturing-issue/#entry5153177
If the shape is 2D, and you've manually moved the top two verts closer together, you'll get the image in the middle. D3D/GL cannot magically fix this for you.
You've use the hint in GL to fix your problem?If the shape is 2D, and you've manually moved the top two verts closer together, you'll get the image in the middle. D3D/GL cannot magically fix this for you.
Exactly, this is the purpose for the original question. It seems that this GL Hint does 'magically' fix it.
If the shape is 2D, and you've manually moved the top two verts closer together, you'll get the image in the middle. D3D/GL cannot magically fix this for you.
Exactly, this is the purpose for the original question. It seems that this GL Hint does 'magically' fix it.
I highly doubt OpenGL can fix this also.
The hint is called "PERSPECTIVE". Which means it doesn't work for 2D. It needs the z (depth) value to calculate this correctly. In 2D no such things. The GPU can not know the context of that triangle in a 2d environement. And doesn't understand it is a quad at low level.
If all 4 points have the same z value in your 2D render (let say, 0), and GL gives you the right picture, then the driver or opengl is wrong. What about I want to skew a rectangle on the side?