Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
845 views
in Technique[技术] by (71.8m points)

opengl - Confusion with GL_MAX_TEXTURE_SIZE

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 ??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...