Skip to main content
GameDev.net gamedev.net
🔒 Locked

npot textures

Started by O-san Dec 4, 2008 at 1:45 PM 4 replies 1.6k views
Original Post
O-san
O-san
How do OpenGL deal with textures which are in npot-format when the graphic card lacks support for it? Does the texture become all corrupt or does it rely on some sort of mip-maps instead?
Yann L
Yann L
OpenGL will raise an error, and texturing will be disabled on the affected unit (all accesses to it will result in a white colour).
Richy2k
Richy2k
NPoT - Sin.

Yes, some hardware supports it, but I spend a lot of my week at work whipping artists for putting silly sized textures into game. I hate them with a passion, that is NPoT textures, not the artists [smile].

In a previous game (hobbyist one) I worked on we had a few NPoT textures as I just chose to not care out of ease, and on cards that didn't support it (partially due to poor error handling), they were just all white and didn't show correctly. Not to say this is the default behaviour of all cards, probably more to my renderer's pipeline than anything else.
Fen
Fen
consider using texture rectangles "GL_ARB_texture_rectangle" it was intruduced earlier than NPOT textures, so older hardware may have support for that kind of extension.
Se my programming blog: Code and Graphics
Vortez
Vortez
Okay, here's what i've found yesterday, using:

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

...u can load textures of any size, if you're OpenGL support it.
No more crash! No code change...
ndhb
ndhb
Hmm, I guess the default value for UNPACK_ALIGNMENT of 4 has caused a lot of grief over the years...

Does anyone know if the word alignment actually provides better performance in practice with modern hardware or is just historical/theoretical? I once tried a few quick benchmarks but could never show that aligning data to word boundaries was faster.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.