Reputation: 174
I have managed to get a transparent cube using
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
and in shader.frag:
gl_FragColor = vec4(texture2D(TextureMap_uniform, uv).xyz,0.5);
but now I would like the solid model I am moving around above the transparent cubes to be opaque (the transparency is applied to everything at the moment). Can anyone point me in the right direction?
Upvotes: 0
Views: 216
Reputation: 186
are you using the same shader ? if yes, then you will need to pass to your shader the information about opacity for each object. a way to do that simply is by using uniform variables.
check out those links :
https://www.khronos.org/opengl/wiki/Uniform_(GLSL) https://www.khronos.org/opengl/wiki/GLAPI/glUniform
Upvotes: 1