OpenGL 几何着色器 Mac OS X
我正在尝试通过几何着色器进行简单传递以在 Mac OS X 10.6 下工作。代码编译和链接没有问题,但由于某种原因,没有几何图形被绘制到屏幕上。这是我的着色器代码:
#version 120
#extension GL_EXT_geometry_shader4: enable
void main()
{
gl_Position = gl_PositionIn[0];
EmitVertex();
EndPrimitive();
}
如果有人可以提供帮助,我将不胜感激。
I'm trying to get a simple pass through geometry shader to work under Mac OS X 10.6. The code compiles and links without problem, but for some reason no geometry is being drawn to the screen. Here's my shader code:
#version 120
#extension GL_EXT_geometry_shader4: enable
void main()
{
gl_Position = gl_PositionIn[0];
EmitVertex();
EndPrimitive();
}
If anybody could help I'd appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,问题根本不在着色器代码中。显然,在几何着色器中使用版本 120 时,您必须按如下方式设置输入和输出类型:
之后一切都很顺利。
So as it turns out, the problem wasn't in the shader code at all. Apparently, when using version 120 in a geometry shader, you have to set the input and output types as follows:
After that everything worked out perfectly.
几何着色器适用于整个图元。你的看起来只适合积分。如果您不传入点,则需要处理所有
gl_VerticesIn
(计数)个顶点。A geometry shader works on entire primitives. Yours looks like it would only be suitable for points. If you are not passing in points you need to process all
gl_VerticesIn
(count) vertices.