GLubyte vs GLshort的指数 [英] GLubyte vs GLshort for Indices

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

问题描述

在OpenGL中查看顶点数组的文档时,我发现用于索引的两种最常见的内存类型是GLubyte(GL_UNSIGNED_BYTE)和GLshort(GL_SHORT). 我想知道使用两者作为索引之间是否有任何实际差异

Looking through documentation for vertex arrays in OpenGL, two of the most common memory types used for indices I found were GLubyte (GL_UNSIGNED_BYTE) and GLshort (GL_SHORT). I was wondering if there was any actual difference between using the two for indices

谢谢, 龙龙

推荐答案

GL_UNSIGNED_BYTE是可以的-确实不多.

GL_UNSIGNED_BYTE is OK for models which have at most 256 vertices - that's really not many.

GL_UNSIGNED_SHORT占用2个字节,会将您限制为65536个顶点-仍然很少.

GL_UNSIGNED_SHORT, taking 2 bytes, would limit you to 65536 vertices - still that's kind of few.

我想说的是最常见的变体是GL_UNSIGNED_INT,因为对于中多边形和高多边形模型而言,即使2个字节也可能不够.

I'd say the most common variant is GL_UNSIGNED_INT, as even 2 bytes may not be enough for mid-poly and high-poly models.

这篇关于GLubyte vs GLshort的指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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