Hello, im trying to create an normalmapped object with normalmapping, by using GLSL.
What I want is to have one ColorMap that is just a normal 2d texture mapped on the object, and over this, I want to blend a CubeMap that uses the normals from a normal map to get the desired pixel from the normal map.
I have created a CubeMap with FBO, and this works ok. But how do I pass in other textures to the shader so I can combine this? I have done this with normal 2d textures before, but not with a cubemap combined.
glUseProgramObjectARB(glContext);
glUniform1iARB(glslTextureCube, 0);
glUniform3fARB(glslEye, view.GetCamPos().m_X, view.GetCamPos().m_Y, view.GetCamPos().m_Z);
glEnable(GL_TEXTURE_CUBE_MAP);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemap);
// render object
I was thinking that it should be ok to create a new texture:
glUniform1iARB(glslTextureColor, 1);
and write the code as this:
glUniform1iARB(glslTextureCube, 0);
glUniform1iARB(glslTextureColor, 1);
// cubemap
glEnable(GL_TEXTURE_CUBE_MAP);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemap);
// colormap
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, colormap);
// render object
Then in the shader I just add colormap*0.5 + cubemap*0.5 as the output color.
But this just gives me some very ugly artifacts. Anyone know how I can get my shadersetup to work correctly?
The question is basically: How can I pass a cubemap texture and a 2d texture to a GLSL shader?
Thank you for reading my post, if you need any clarifications, please ask and I will explain it better or give more code.