Is there a way to render 2D-graphics and 2d-perspective with OpenGL? I want to do it that way because then the graphics are hardware accelerated and I could take advance of alpha blending, realtime scaling and so on…
Besides that I should have the possibility to load free-sized textures without using the power of 2, but I think this depends on the hardware…
However I have some other questions related to this topic:
To draw images, I wanted to use a textured Quad for most possible speed, however how can I scale the Quad that it exactly fits to the image size? I dont want the image stretched on the quad like it would be blured. oO
And is it possible to manipulate textures after loading? For example I want to implement color keying without using blending or something. It would be nice if I could just run through the image and set a special masking color to an 0-alpha value, to cut it out.
Thank you in advance…
Sorry for some mistakes in my grammar, english isn’t my native language
One nice solution for scaling your quads could be to set glOrtho so that vertex coordinates are the same as actual pixel coordinates on your window, say like glOrtho( 0.0,800.0,600.0,0.0,1.0,200.0); for a 800x600 resolution. Then you can just build your quads so that they are exactly the size of the image they have to display and set you texture coordinates as you like. This worked fine and doesn’t have big performance issues as far as i know.
Tinkering around texture coordinates can be useful also if you need non-power-of-two things. You can use a big power of two image and pick different non-power parts with texture coordinates.
About masking, i know redbooks speaks about some masking functions, but they can slow you down A LOT. Probably some kind of additive blending would work much better, i never tired anyway!