Hey guys
Im working on a water effect demo these days, and there is a problem that the fragment shader cant load the normal texture for the water surface ( the reflection texture works fine) .
Im sure that both the vertex shader and fragment shader are correct because they work fine in the ShaderMaker. So I guess the problem comes from my C++ codes, and here are the codes:
_waterShader->Use();
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
_ReflectionTex->Bind();
glUniform1i( glGetUniformLocation( _waterShader->GetHandler(),"reflectTex"),1);
glActiveTexture(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);
_WaterNorTex->Bind();
glUniform1i( glGetUniformLocation( _waterShader->GetHandler(),"bumpTex"),2);
// uniform values
...
// draw a plane
...
What's wrong with my codes?
sorry for my poor English
Thanks!
Problem of GLSL Multitexturing
There is nothing much to say. You have many API calls hidden behind Use() and Bind() and we don't have the shader at hands.
Why do you think the normal map is not loading ? Maybe your lighting calculation is wrong ?
How about some error checking ?
Does
[source lang="cpp"]glGetUniformLocation( _waterShader->GetHandler(),"bumpTex")[/source]
actually resolve to a valid value ?
Why do you think the normal map is not loading ? Maybe your lighting calculation is wrong ?
How about some error checking ?
Does
[source lang="cpp"]glGetUniformLocation( _waterShader->GetHandler(),"bumpTex")[/source]
actually resolve to a valid value ?
http://www.opengl.org/wiki/GLSL_:_common_mistakes#glGetUniformLocation
and
http://www.opengl.org/wiki/GLSL_:_common_mistakes#Enable_Or_Not_To_Enable
and
http://www.opengl.org/wiki/GLSL_:_common_mistakes#Enable_Or_Not_To_Enable
There is nothing much to say. You have many API calls hidden behind Use() and Bind() and we don't have the shader at hands.
Why do you think the normal map is not loading ? Maybe your lighting calculation is wrong ?
How about some error checking ?
Does
[source lang="cpp"]glGetUniformLocation( _waterShader->GetHandler(),"bumpTex")[/source]
actually resolve to a valid value ?
http://www.opengl.or...UniformLocation
and
http://www.opengl.or...r_Not_To_Enable
I found where the problem was...I used GL_RGBA instead of GL_RGB in glTexImage2D and everyting shew up..
Thank you
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement