开发者

OpenGL vers >=2.0 requires texture dimensions to be multiples of 4 pixels?

I'm working on a Mac application using OpenGL te开发者_StackOverflow社区xtures that I load from image files on disk using glTexImage2D.

According to the docs, for OpenGL versions >= 2.0, textures can be any arbitrary size. (for versions <2.0, the x and y dimensions both have to be a power of 2.)

However, I am getting bad textures if my image dimensions are not an even multiple of 4. I've searched and searched, but can't find any documentation on this requirement. In fact, the "red book" explicitly states that the texture dimensions can be any value for version >= 2.0.

What am I missing?

And, is there a performance benefit to converting a texture to the next largest power-of-two dimension? My app will require Mac OS 10.6.6 or later, which should run on any Intel Mac. Some of the early Intel macs had very "humble" graphics hardware.

Any help would be greatly appreciated.


The constraint on ordinary textures having dimensions being powers of 2 remains in OpenGL versions >= 2. However there is a new texture target supported, GL_TEXTURE_RECTANGLE, which supports arbitrary dimensions, but won't do mipmaping.

There's no constraint on dimensions being multiples of 4, however I suspect you might have glPixelStore(GL_UNPACK...) parameters set, maybe set by other parts of the program, that cause this behaviour.


What format are your textures? S3TC compressed texture formats operate on 4x4 tiles, so may not work or may have visual artifacts if the dimensions are not multiples of 4.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜