I'm trying to render a semi-transparent object inside of a skybox. However with my current implementation the textures are blended with the background color instead of the skybox (if there is no other object in the way).
Here are some milestones in my implementation I thought would be useful to share:
init:
[...]
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
[...]
render:
[...]
[render scene]
[...]
glUseProgram(program_skybox);
glDepthFunc(GL_LEQUAL);
glDepthMask(GL_FALSE);
[bind view & projection matrices]
[draw skybox]
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);
What should I change to make my skybox blend? I suppose the problem is with the depth buffer?