本文介绍了与 GL_MAX_TEXTURE_SIZE 混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 GL_MAX_TEXTURE_SIZE 变体是返回一个轴的纹理像素尺寸还是两者加起来(x,y).

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).

例如,在我的电脑上,结果是 8192.这是否意味着我可以加载 8192*8192*4(256mb) 或 4096*4096*4 (64mb) 的纹理?如果是这样,为什么当我的显卡有 1GB 显存时会发生这种情况??

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

推荐答案

OpenGL 规范称其为最大 1D/2D 纹理图像尺寸,因此它确实意味着 8192x8192-image.嗯,意思是宽度和高度相加是毫无意义的,因为这并没有说明大小,8000x192-texture 的大小与 4096x4096 完全不同-质地.至少乘法会更合理,但在这种情况下 8192 将意味着 ~90x90-texture.

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.

但是您应该对这些值持保留态度.它们实际上只是实现(硬件/驱动程序)允许的上限,因此它不必与您的硬件的视频内存相匹配.实际上,视频内存中存储的东西要多得多,例如帧缓冲区、VBO 等等,因此给出一些保守值是非常合理的.同样,也可能是您的驱动程序开发人员不太注意这个常量(它不是 ATI,是吗?),只是返回一些默认值,实际上您的纹理实际上可以更大.

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.

就像 Robinson 在他的评论中所说的那样,它也可能取决于原始内存之外的其他东西,因为纹理内存可能是视频内存中的某个特殊区域,提供一种特殊的 2D 寻址/缓存模式.

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.

这篇关于与 GL_MAX_TEXTURE_SIZE 混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 07:57