I’m using quads to display textures in glOrtho (for 2d). My problem is that I have a texture that is 64x64, and when I create a quad of size 64, the image is nearly double the size.
If I divide the quad by half, that is make it 32x32, the texture appears to be proper size.
This is somewhat confusing to me. The only thing I can think is that I’m specifying pixel sizes, but opengl doesn’t take quad sizes in pixel size? Is that true?
What other factors might be contributing to this, or, rather, what is the proper way to size a quad to the texture size? Later on in my program this could be very annoying, so I figure I should address it now.
One way to address this is to render overlays to a virtual canvas. That is, pick a convenient screen width and height, say 800x600, then scale the coordinates when you draw to fit the current window.
For example, if the current window size is 1024x768, then you would scale your x coords by 1024/800, your y coords by 768/600. In this way, images maintain their relative sizes in the screen. Your app will always render overlays to a virtual 800x600 screen, never needing to worry about the actual window dimensions.
maybe the clipping area is half the size of the viewport (window client area). eg, say your clipping area is set to (100,150) and your viewport is at (200,300). an image of 64 by 64 on the clipping area would make it 128 by 128 on the viewport, and 32 by 32 would equal 64 by 64.