Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

SoulBuster

OpenGL OpenGL texture coodinates are more accurate then DirectX's?

This topic is 5478 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''m currently working with palettted textures for a 2D game engine. I wanted to add support for both DirectX and OpenGL. In order to render different sized sprites, I place them sequencially into 512x512 textures and save top-left and right-bottom texture coordinates. Bu this way I manage to simulate directx7 surfaces'' blt method (that srcRect dstRect thing...) In OpenGL when I rendered a 69x118 (for instance) sized sprite on the screen I get the exact pixels from the texture rect...So it''s a perfect blt! But in DirectX8 when I used the same texture coordinates with the same untransformed vertices, the image I rendered seem a bit stretched and distored! This gives me the feeling of the texture coordinate accuracy between Dx8 and OpenGL are not same? Am I right? or I''m forgetting some Renderstates to be turn off-on or there are somethings to do with the texturestages??? Thanks to your help

Share this post


Link to post
Share on other sites
Advertisement
The coordinates for DirectX and OpenGL are different. They both are in the range of (0...1) but they''re setup different.

DirectX:


(0, 0) (1, 0)
----------
| |
| |
| |
| |
----------
(0, 1) (1, 1)



OpenGL:


(0, 1) (1, 1)
----------
| |
| |
| |
| |
----------
(0, 0) (1, 0)



I have no clue why your textures would look streched though?

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"

Share this post


Link to post
Share on other sites
Check out the tutorial about DX8 sprites in the A & R section. It may be relevant.

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Share this post


Link to post
Share on other sites

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