Re: How to change the color of the cylinder when double clicked it
Posted by elect on Mar 18, 2016; 8:48am
URL: https://forum.jogamp.org/How-to-change-the-color-of-the-cylinder-when-double-clicked-it-tp4036489p4036514.html
In the hello-triangle.frag there is no gl_Position, if you meant hello-triangle.vert are you sure you didn't modify it? Because it looks fine, there was an error with the glsl '#version', it was 400, I fixed it and changed it to 330. But it shouldn't have had nothing to do with your problem.
/*
* Vertex shader.
*/
#version 330
// Incoming vertex position, Model Space.
in vec2 position;
// Incoming vertex color.
in vec3 color;
// Uniform matrix from Model Space to Clip Space.
uniform mat4 modelToClipMatrix;
// Outgoing color.
out vec3 interpolatedColor;
void main() {
// Normally gl_Position is in Clip Space and we calculate it by multiplying
// it with the modelToClipMatrix.
gl_Position = modelToClipMatrix * vec4(position, 0, 1);
// We assign the color to the outgoing variable.
interpolatedColor = color;
}
On line 21, we take position, which is a vec2, set to a vec4 by padding it with 0, 1 and the multiply the mat4 modelToClipMatrix with it. A mat4 * vec4 multiplication returns a vec4.
Can you paste me here your shader?