11

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.): Stream mapping bypassed with built in variables

Deorbit
  • 293
  • 2
  • 11
  • 1
    I don't have the answer for your question, but I can suggest a multi-platform alternative, ShaderMaker: http://cg.in.tu-clausthal.de/teaching/shader_maker/index.shtml – appas Jul 18 '11 at 20:54
  • Thank you for your suggestion. I haven't evaluated ShaderMaker, but it seems to be directed to the fixed pipeline. Apparently there is another project called Lumina which also might be an alternative. – Deorbit Jul 25 '11 at 23:01
  • Can Render Monkey support 3.30 shaders at all? I thought that it is for OpenGL 2.1 features only... – przemo_li Aug 12 '11 at 15:50
  • RM does not care about which shader version you use. I have given a workable approach in my text, but the question about whether or not the stream mapping is broken remain unanswered. – Deorbit Aug 15 '11 at 20:37
  • 1
    Can you post the actual shader, or upload the effect somewhere I can download it to take a look? I sometimes use RM, although it isn't supported any more (similar to other shader designer programs - they don't really fit the way things are done today in graphics pipelines with all the MRT and so on). – Robinson Sep 29 '11 at 14:12

2 Answers2

0

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...)

hl037_
  • 3,520
  • 1
  • 27
  • 58
-1
#version 330

layout(location = 0) in vec3 bla_bla_bla_Vertex;
layout(location = 2) in vec3 bla_bla_bla_Normal;
layout(location = 8) in vec3 bla_bla_bla_TexCoord0;

This is a working solution for RM 1.82