RenderMonkey 在 GLSL 的 TEXCOORD 流映射中是否存在错误?
为了清楚起见,我从我的问题开始:
是否可以(在着色器代码中)使用我在(OpenGL)中为TEXCOORD用法设置的自定义属性名称 RenderMonkey 1.82 中的流映射还是必须使用 gl_MultiTexCoord0? (该问题对于NORMAL 用法也可能有效,即自定义名称或gl_Normal)
背景:
使用RenderMonkey 版本1.82。 我已经成功地使用流映射来映射一般顶点属性“位置”(也许是“正常”),但纹理坐标似乎没有正确转发。 对于着色器代码,我使用 #version 330 和 GLSL 中的“in”限定符,这应该没问题,因为 RM 本身不编译着色器(OpenGL 驱动程序编译)。
我尝试过 .obj 和 .3ds 文件(从搅拌机导出),并且在检查波前 .obj 文件时,所有纹理坐标信息都在那里,以及顶点位置和法线。
如果不可能,流映射就会被破坏,并且在流映射编辑器中命名变量是没有意义的(除了顶点位置流,它可以工作),因为无论如何都必须使用内置变量。
更新: 如果使用已弃用的内置变量,则必须在着色器中使用兼容模式,例如
#version 330 compatibility
out vec2 vTexCoord;
在主函数中:(
vTexCoord = vec2(gl_MultiTexCoord0);
现在我也不确定法线的流映射。一旦我让纹理坐标工作,我遇到了正常问题,不得不恢复到 gl_Normal。)
这是一个工作解决方案的图片,但带有内置变量(是的,图片中注释的 texcoord 变量与流映射中的名称不同)对话框,但是当我尝试使用它时它具有相同的名称,所以没关系。):
For clarity, I start with my question:
Is it possible to use (in the shader code) the custom attribute name which I set for the TEXCOORD usage in the (OpenGL) stream mapping in RenderMonkey 1.82 or do I have to use gl_MultiTexCoord0?
(The question might be valid for the NORMAL usage too, i.e custom name or gl_Normal)
Background:
Using RenderMonkey version 1.82.
I have successfully used the stream mapping to map the general vertex attribute "position" (and maybe "normal"), but the texture coordinates does not seem to be forwarded correctly.
For the shader code, I use #version 330 and the "in" qualifier in GLSL, which should be OK since RM does not compile the shaders itself (the OpenGL driver do).
I have tried both .obj and .3ds files (exported from blender), and when checking the wavefront .obj-file, all texture coordinate information is there, as well as the vertex positions and normals.
If it is not possible, the stream mapping is broken and there is no point in naming the variables in the stream mapping editor (besides for the vertex position stream, which works), since one has to use the built-in variables anyway.
Update:
If using the deprecated built-in variables, one has to use compatibility mode in the shader e.g
#version 330 compatibility
out vec2 vTexCoord;
and, in the main function:
vTexCoord = vec2(gl_MultiTexCoord0);
(Now I'm not sure about the stream mapping of normals either. As soon as I got the texture coordinates working, I had normal problems and had to revert to gl_Normal.)
Here is a picture of a working solution, but with built-in variables (and yes, the commented texcoord variable in the picture does not have the same name as in the stream mapping dialog, but it had the same name when I tried to use it, so it's OK.):
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用通用顶点的属性,请参阅http://open.gl,这是一个很棒的教程;)
(但我认为这意味着您必须重写代码才能手动处理转换......)
You could try to use the generic vertices's attributes, see http://open.gl, it's a great tutorial ;)
(but I think it imply you'd have to rewrite the code to manual handle the transformations...)
这是 RM 1.82 的有效解决方案
This is a working solution for RM 1.82