Problem with shader
Originally Posted By: lucaseverini
Original Date: April 21, 2014 at 11:06 PM
Hi everyone,
I have a problem trying to use the shader example app, FragmentApp.
I'm working on MacOS 10.8.5. Homework 1 ran fine on it so I don't think is something related to the guest OS. Hopefully…
I have this vertex shader:
// Vertex Shader
// This version GLSLanguage-v2 compliant program is used when g_Gl2Compatible is true
uniform mat4 uProjMatrix;
uniform mat4 uModelViewMatrix;
attribute vec3 aPosition;
varying vec3 vPosition;
void main()
{
vec4 tPosition = uModelViewMatrix * vec4(aPosition, 1.0);
vPosition = vec3(tPosition);
gl_Position = uProjMatrix * tPosition;
}
And this fragment shader:
// Fragment Shader
// This version GLSLanguage-v2 compliant program is used when g_Gl2Compatible is true
varying vec3 vPosition;
void main()
{
if(vPosition.y OK
const GLuint h = program; // short hand
h_uProjMatrix = safe_glGetUniformLocation(h, "uProjMatrix"); --> OK
cout THIS RETURNS 10
checkGlErrors(); - --> ERROR AND EXCEPTION INSIDE HERE
…
Any help is very welcome…
Thank you!
Luca
'''Originally Posted By: lucaseverini'''
'''Original Date: April 21, 2014 at 11:06 PM'''
Hi everyone,<br><br>I have a problem trying to use the shader example app, FragmentApp.<br>I'm working on MacOS 10.8.5. Homework 1 ran fine on it so I don't think is something related to the guest OS. Hopefully…<br>I have this vertex shader:<br><br>// Vertex Shader<br>// This version GLSLanguage-v2 compliant program is used when g_Gl2Compatible is true<br><br>uniform mat4 uProjMatrix;<br>uniform mat4 uModelViewMatrix;<br><br>attribute vec3 aPosition;<br><br>varying vec3 vPosition;<br><br>void main() <br>{<br> vec4 tPosition = uModelViewMatrix * vec4(aPosition, 1.0);<br> vPosition = vec3(tPosition);<br> gl_Position = uProjMatrix * tPosition;<br>}<br><br><br>And this fragment shader:<br><br>// Fragment Shader<br>// This version GLSLanguage-v2 compliant program is used when g_Gl2Compatible is true<br><br>varying vec3 vPosition;<br><br>void main() <br>{<br> if(vPosition.y OK<br><br> const GLuint h = program; // short hand<br><br> h_uProjMatrix = safe_glGetUniformLocation(h, "uProjMatrix"); --> OK<br>cout THIS RETURNS 10<br>checkGlErrors(); - --> ERROR AND EXCEPTION INSIDE HERE<br>…<br> <br><br>Any help is very welcome… <br>Thank you!<br><br>Luca