简体   繁体   English

OpenGL是否等效于GL_POINT_SIZE_ARRAY_OES?

[英]OpenGL equivalent to GL_POINT_SIZE_ARRAY_OES?

I'm trying to draw point sprites in a small Mac app. 我正在尝试在一个小型Mac应用程序中绘制点精灵。 I want each sprite to have its own size, and I know that OpenGL ES has the client state "GL_POINT_SIZE_ARRAY_OES". 我希望每个精灵都有自己的大小,并且我知道OpenGL ES的客户端状态为“ GL_POINT_SIZE_ARRAY_OES”。

I did some googling and discovered that there is a similar value "GL_POINT_SIZE_ARRAY_APPLE" which (you'd think) should do the same thing. 我进行了一些谷歌搜索,发现有一个类似的值“ GL_POINT_SIZE_ARRAY_APPLE”(您会认为)应该执行相同的操作。 For some reason, though, it doesn't seem to. 但是由于某种原因,它似乎没有。 Here's my drawing code: 这是我的绘图代码:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_POINT_SIZE_ARRAY_APPLE);

glVertexPointer(2, GL_FLOAT, sizeof(SpriteData), spriteVertices);
glPointSizePointerAPPLE(GL_FLOAT, sizeof(SpriteData), spriteVertices + sizeof(LocationF));

glDrawArrays(GL_POINTS, 0, spriteCount);

glDisableClientState(GL_POINT_SIZE_ARRAY_APPLE);
glDisableClientState(GL_VERTEX_ARRAY);

SpriteData is a struct containing the vertex/size data of each sprite. SpriteData是包含每个Sprite的顶点/大小数据的结构。 spriteVertices is just an interleaved array of that struct. spriteVertices只是该结构的交错数组。

The vertex pointer is working fine; 顶点指针工作正常; it's drawing the sprites, but seems to be ignoring their size values. 它正在绘制精灵,但似乎忽略了它们的大小值。 It instead defaults to the value set by glPointSize(). 而是默认使用glPointSize()设置的值。

Despite the fact that this code compiles with no warnings, it seems very suspicious to me that googling "GL_POINT_SIZE_ARRAY_APPLE" brings up almost no results. 尽管该代码编译时没有任何警告,但对我来说,谷歌搜索“ GL_POINT_SIZE_ARRAY_APPLE”似乎几乎没有任何结果,这让我非常怀疑。 Is this a useless parameter? 这是没用的参数吗? If so, how else can I achieve what I want? 如果是这样,我还能如何实现我想要的?

There is no official OpenGL extension which exposes a GL_POINT_SIZE_ARRAY_APPLE extension. 没有公开的GL_POINT_SIZE_ARRAY_APPLE扩展的官方OpenGL扩展。 This may be some detritus in Apple's headers, but you shouldn't use it. 这可能是Apple标题中的一些不利因素,但您不应该使用它。 Just use a generic vertex array and use the value you pass as a point size. 只需使用通用顶点数组,然后将传递的值用作点大小即可。

If you want cross-platform code, you should avoid system-dependent headers. 如果需要跨平台代码,则应避免使用与系统相关的标头。 Instead, use a proper OpenGL loader , which comes with cross-platform headers that won't have system-dependent, non-standard detritus in them. 相反,请使用适当的OpenGL加载程序 ,该加载程序随附跨平台标头,其中不会包含与系统相关的非标准碎屑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM