Jump to content
  • Advertisement
Sign in to follow this  
_OskaR

OpenGL Shaders works but... didn't works

This topic is 3557 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

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.
glEnable(GL_TEXTURE_2D);
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); /
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, _texture[2]);
location1b = glGetUniformLocationARB(ShaderProgram2, "colorMap" ); //watertexture
glUniform1iARB(location1b, 0);

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

glBegin(GL_QUADS); 
...


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 http://www.lighthouse3d.com/opengl/glsl/index.php?oglinfo Result - "Link successful. There are no attached shader objects."

Share this post


Link to post
Share on other sites
Advertisement
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!