Sign in to follow this  

OpenGL Shaders works but... didn't works

Recommended Posts

I created simple game to learn how to use shaders. I used Phong shaders - works ok (but it don't need texture) - so I know it's loaded and compiled correctly. I found simple shaders for water with uniform variables:
uniform sampler2D colorMap;
uniform sampler2D noiseMap;
uniform float timer;

In the game I see only texture of water - but no effects of using noisemap.
glColor4f( 1.0f, 1.0f, 1.0f, 0.7f ); //transparent

glUseProgramObjectARB(ShaderProgram2); //shader for water
int location1b;

GLint location2 = glGetUniformLocationARB(ShaderProgram2,"timer");
float cposl = czas; //time (moving texture?)
glUniform1fARB(location2,cposl); /
glBindTexture(GL_TEXTURE_2D, _texture[2]);
location1b = glGetUniformLocationARB(ShaderProgram2, "colorMap" ); //watertexture
glUniform1iARB(location1b, 0);

glBindTexture(GL_TEXTURE_2D, _texture[3]);	
location1b = glGetUniformLocationARB(ShaderProgram2, "noiseMap" ); //noisemap
glUniform1iARB(location1b, 1);


Checked on Mobility Radeon X700 and GF 8800 (no difference).
glGetObjectParameterivARB(ShaderProgram2, GL_OBJECT_LINK_STATUS_ARB, &result);
printf("Shader 2 result: %i\n",result);

Result = 1 I used also Result - "Link successful. There are no attached shader objects."

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this