Confusion with GL_MAX_TEXTURE_SIZE

2020-02-06 06:38发布

I would like to know if GL_MAX_TEXTURE_SIZE variant returns the texture pixel dimensions for one axis or both added up(x,y).

For example , on my pc i get 8192 as result. Does this mean that i can load a texture of 8192*8192*4(256mb) or 4096*4096*4 (64mb) ? If so why this happens when my graphics card has 1gb of video memory ??

1条回答
欢心
2楼-- · 2020-02-06 06:50

The OpenGL specification calls it the maximum 1D/2D texture image dimension, so it indeed means a 8192x8192-image. Well, meaning width and height added up would be quite senseless, as this doesn't say anything about the size, a 8000x192-texture has quite a different size than a 4096x4096-texture. At least multiplication would be more reasonable, but in this case 8192 would mean a ~90x90-texture.

But you should take those values with a grain of salt. They are really just an upper limit to what the implementation (hardware/driver) allows, so it doesn't have to match your hardware's video memory. In practice there are much more things stored in video memory, like framebuffers, VBOs, whatever, so it is quite reasonable to give some conservative value. Likewise, it can also be your driver developers don't pay much attention to this constant (it's not an ATI, is it?) and just return some default value and your texture can in practice actually be larger.

And like Robinson says in his comment, it may also depend on other things than raw memory, as the texture memory may be some special region in video memory, offering a special kind of 2D addressing/caching mode.

查看更多
登录 后发表回答