:::: www.foddex.net ::::
      Home      |      Blog      Tutorials      Reviews      |      Resume      Portfolio      |      Photos      Stuff      |      Unreal      Flame      |      Links
Foddex' head
Contact me

Stuff
NL Weather
NL Precipitation
Temperature
xkcd
ICHC
Slashdot
Kitten
wliia
TBBT - Zoom Zoom!!

BLOG: OpenGL fun with modern and older hardware

posted Thu 05-06-2008 12:53:53, in the c++ (c++) category

You gotta love open standards, and different implementations thereof. I recently stumbled across exactly such a problem in OpenGL.

It's been a normal requirement since very long that textures in OpenGL have to be of a size which is a power of 2. For example, a size of 256x128 (resp. 2^8 and 2^7) are fine, but a size of 640x480 isn't. When you try to generate a texture using glTexImage2D with these sizes, you get a GL_INVALID_VALUE error.

However, my 3D project I'm working on accidentally contained a texture of size 800x600 (which is not a power of 2), and my development hardware kinda responded differently to it than all other test hardware I ran it on.

I develop on a PC with a NVIDIA 8800 GTX Ultra 768Mb, and for some reason it accepted the texture with the non-standard size just fine (which is also the reason I never knew about the issue ;) .) Running the application on older NVIDIA hardware (a mobile FX5200) yielded the error described above and resulted in a white texture being displayed.

Running it on ATI hardware though would result in extreme behaviour: loading it with glTexImage2D would yield no error, but rendering a single quad with a call to glDrawArrays using only one texture - the wrongly sized one - would result in a call taking . . . . . 8 seconds!!!

That was kinda out of the ordinary, and at first I had no clue the white texture and the slow renders were related. Luckily due to some extensive error checking logs I found out about the erroneous glTexImage2D call, and things kind of solved automatically from there.

Goes to show that error checking - especially during development - is vital, as is testing on multiple hardware - both on very old and very new. Leaves me to say that I hope Google picks up on this blog entry and maybe this info might help some other coder ;)


-- Foddex

[ Back to blog listing ]

0 comment(s)

Leave a comment

Name (required)
URL
Copy this code2-035-028-148

Pressure building on my soul
I ask God to take control
Guide me through this fucked up world

-

I know someday you'll have a beautiful life, I know you'll be a star
In somebody else's sky, but why, why, why
Can't it be, can't it be mine