[GLGraphics] GLSLshader + GLModel
in
Contributed Library Questions
•
1 year ago
I took the Textured Sphere example as a starting point and applied these displacement GLSL shaders to them using the GLSLshader class. The Sampler2D input for the vertex shader is a displacementMap and the input for the fragment shader is a colorMap. It runs without errors, it correctly displaces the vertices and it shows the texture (see the above image). But my question is with regard to which texture is used.
I noticed that the input textures you supply via the shader have no effect.
- shader.start();
- shader.setTexUniform("colorMap", tex2); // is not used, delete this and the endresult is unchanged
- shader.setTexUniform("displacementMap", tex2); // idem
- renderer.model(earth);
- shader.stop();
- earth.initTextures(1);
- earth.setTexture(0, tex); // used for both the colorMap and the displacementMap?
- earth.updateTexCoords(0, texCoords);
The downside of this is that the colorMap and the displacementMap are the same. However I want these to be different, so I need a way to set both manually. Currently it seems the GLModel is somehow automagically sending the texture to the shaders.
How can I set the input textures for the shaders correctly?
How can I set the input textures for the shaders correctly?
1