2D images
hey all, i want to include the ability to draw 2D images onto the screen in the small graphics lib i'm currently writing. However, (and no this is not about the view matrix, done that) i would like to be able to draw images whose sizes are not square numbers. What is the best way to do this, i was thinking initially about just rounding the size up to the next square number and then pasting the image onto a new one that size before texturing the quad, but i would like to know what you guys think is the best way and any tips you may have on how to impliment this
Well the way you mentioned is one way, however the POT restriction is currently being relaxed, so with openGL 2.0 and/or the latest NVIDIA drivers(don't know about ATI and other vendors) any resolution up to the maximum resolution is ok.
Test, you might be suprised.
Test, you might be suprised.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
I tried it but the image appeared white?? (Gforce 4)... Do you have any means to figure out the next, bigger square size... If you did i'd really appreciate it, thanks
It probobly only works on fx+ cards and the latest nvidia drivers(61.77), it works on my gf6800 and the quadro500 card(based on the fx 5600).
I normaly only use if statements sort of like this
if npotsize > 128 potsize=256
if npotsize > 256 potsize=512
if npotsize > 512 potsize=1024
shure you could so something sleaker that can do any number of POT sizes, but generaly it's just overkill.
I normaly only use if statements sort of like this
if npotsize > 128 potsize=256
if npotsize > 256 potsize=512
if npotsize > 512 potsize=1024
shure you could so something sleaker that can do any number of POT sizes, but generaly it's just overkill.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
What you're looking for is the GL_ARB_texture_rectangle extension. Quite some older cards support it too (although ATI cards use GL_EXT_texture_rectangle as extension string). What it does is add a new texture target, GL_TEXTURE_RECTANGLE_ARB, which you can use instead of GL_TEXTURE_2D. You can then use textures with any dimensions. Note though, that your texture coordinates are unnormalized for NPOT textures, i.e., if you want to enter the bottom right of the texture, you'll have to specify texture coordinates (w,h) instead of (1,1).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement