与GL_MAX_TEXTURE_SIZE混淆 [英] Confusion with GL_MAX_TEXTURE_SIZE

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

问题描述

我想知道是否GL_MAX_TEXTURE_SIZE变量返回一个坐标轴的纹理像素尺寸或两者相加(x,y)。

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

解决方案

OpenGL规范称它为最大1D / 2D纹理图像尺寸,所以它确实意味着 8192x8192 -image。那么,意思宽度和高度加起来就没有意义了,因为这并没有说明尺寸的大小,一个 8000x192 -texture的尺寸与<$的尺寸完全不同C $ C> 4096×4096 - 纹理。至少乘法会更合理,但在这种情况下, 8192 意味着〜90x90 -texture。



但是你应该用一点盐来取这些值。它们实际上只是实现(硬件/驱动程序)允许的上限,所以它不必与硬件的视频内存相匹配。在实践中,存储在视频内存中的东西要多得多,比如帧缓冲区,VBO等,所以给出一些保守的价值是相当合理的。同样,它也可能是你的驱动程序开发人员不太关注这个常量(它不是ATI,是吗?),只是返回一些默认值,并且实际上纹理实际上可能会更大。



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


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

解决方案

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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆