Re: JOGL - GLSL Bump Mapping (Please Help!)
Posted by leolol on Oct 31, 2011; 1:31pm
URL: https://forum.jogamp.org/JOGL-GLSL-Bump-Mapping-Please-Help-tp3467550p3467813.html
Hi There,
Thanks for replying,
Well initially the textures weren't rendering properly (I could get the bumpmap with no texture (that blue screenshot) or the regular texture without bumpmap but not both) I have since found that this was a problem with setting the textures to the right numbers, which brings me to my current problem:
gl.glActiveTexture(GL2.GL_TEXTURE1);
texture.enable(gl);
texture.bind(gl);
setUniform1i(gl,shaderID,"colorMap",texture.getTextureObject(gl));
texture.disable(gl);
gl.glActiveTexture(GL2.GL_TEXTURE2);
normalMap.enable(gl);
normalMap.bind(gl);
setUniform1i(gl,shaderID,"normalMap",normalMap.getTextureObject(gl));
normalMap.disable(gl);
This works great, and I now get a bump-mapped colour textured model. However the new problem arises when I try to draw numerous objects, as they all override GL_TEXTURE1 and GL_TEXTURE2.
EDIT: For example, the skybox I am rendering now renders the same texture as the spaceship, when obviously I want it to render its own texture.
How would I go about making this implementation work for multiple objects? Something to do with GenTextures perhaps?
Sorry if I sound vague, my brain is somewhat confused at this point.
Leo