Jump to content
  • Advertisement
Sign in to follow this  
Giawa

OpenGL GLSL Invalid Enumerant Error [Fixed]

This topic is 3839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I've been searching for a few hours for a solution to this problem. I was hoping someone might be able to help me out. I've just recently added shaders to my game and I've been learning the basics of GLSL. Everything has been going smoothly until I tried to use a uniform variable and edit it from the Draw() function. I am trying to change the v.z value of my vertices in the shader based on a time variable and a sin function. Here is the vertex shader code
varying vec2 texture_coordinate;
uniform float time;

void main(void)
{
	// Transforming The Vertex
	vec4 v = vec4(gl_Vertex);
	v.z = sin(time*5.0)*10.0;
	gl_Position = gl_ModelViewProjectionMatrix * v;
	//gl_Position = ftransform();

	// Passing The Texture Coordinate Of Texture Unit 0 To The Fragment Shader
	texture_coordinate = vec2(gl_MultiTexCoord0);
}
I'm getting the address to this uniform variable using:
GLint loc;
loc = glGetUniformLocation(ProgramObject, name);
loc is getting the correct address, so there is (as far as I can tell) no problems up until now. I have error checking to see if the uniform variable does not exist, but that code is not being called. So, up until now I assume everything is fine. I then try and set the uniform variable using
glUniform1fARB(loc, tTime);
tTime is of type float, and is being updated every time a call is made to DrawGLScene (every 1/60th of a second). The errors are generated when I use the shader.
glUseProgram(ProgramObject);
CHECK_GL_ERROR();
glUseProgram(0);
CHECK_GL_ERROR();
My scene is still drawing, but the model I am rendering is completely flat. My error logger returns this in my debug.txt file. GLSL: OpenGL Vendor: NVIDIA Corporation GLSL: OpenGL Renderer: GeForce 8600 GT/PCI/SSE2 GLSL: OpenGL Version: 2.1.2 GLSL: OpenGL 2.0 (or higher) is available! GLSL: [OK] OpenGL Shading Language is available! GLSL: Compiler Log (Vertex Shader) [e06] Compiler log is not available! GLSL: Compiler Log (Fragment Shader) [e06] Compiler log is not available! GLSL: Linker Error Log [e05] Linker log is not available! ContentManager: MyFirstShader shader loaded properly. GLSL: GL Error #1280 (invalid enumerant) in File source files\glsl.cpp at line: 400 GLSL: GL Error #1280 (invalid enumerant) in File source files\glsl.cpp at line: 411 These lines (400 and 411) are called at my two glUseProgram() calls. This only happens when I am using a uniform variable and trying to edit it. My first experiments with shaders (doing stuff like texturing) were all fine. Can anyone help me out? Giawa [Edited by - Giawa on February 17, 2008 12:00:40 AM]

Share this post


Link to post
Share on other sites
Advertisement
Update:

I can now update my uniform float time; variable. I am, however, still getting the invalid enumerant error. It must be in the shader code...


varying vec2 texture_coordinate;
uniform float time;

void main(void)
{
// Transforming The Vertex
vec4 v = vec4(gl_Vertex);
v.z = sin(time*5.0)*10.0;
gl_Position = gl_ModelViewProjectionMatrix * v;

// Passing The Texture Coordinate Of Texture Unit 0 To The Fragment Shader
texture_coordinate = vec2(gl_MultiTexCoord0);
}

Share this post


Link to post
Share on other sites
Fixed - Was a silly mistake that I made in the draw code of the objects. I was passing the wrong type of data in as normals at each vertex. It just looked like the errors were being generated by the shader because the shader is the only place where errors are checked at the moment (since I thought the rest of my code worked).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!