sky box

Started by
6 comments, last by supagu 20 years, 2 months ago
im wanting to render a sky box, currently i disable depth buffering, and make it so it always passes glDisable(GL_DEPTH_TEST); glDepthFunc(GL_ALWAYS); but if i draw something outside of the sky box it gets cropped, so this isnt the right effect im after. I want the sky box to be rendered, but pushed right back to max depth of the depth buffer. how is this done?
Advertisement
disable writing to the depth buffer when rendering the skybox with "glDepthMask(GL_FALSE);" (be sure to turn it back on afterwards). then everything else will appear in front of the skybox, no matter how far away.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Or disable depth testing altogether (glDisable(GL_DEPTH_TEST)), render the box, and re-enable it to draw your stuffs. I''m not sure if it''d be slower or faster than krez''s method, though. Probably doesn''t really matter.

-~-The Cow of Darkness-~-
glDepthMask(GL_FALSE);
results in a white screen o.0

and my current method uses:
glDisable(GL_DEPTH_TEST);
glDepthFunc(GL_ALWAYS);

but this doesnt go all the way back to the end of the depth buffer.
glDepthMask(GL_FALSE);
DrawSkyBox();
glDepthMask(GL_TRUE);
DrawEverythingElse();

Have you tried doing it this way?
ah yes it works great

[edited by - supagu on February 20, 2004 6:12:27 AM]
that''s what i said
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
yeah i know ;p
when i tried it the first time and ran it i got a white screen and thought "this doesnt work" but the second time i relised i was building in release mode, and when it ran, there were no textures to load

This topic is closed to new replies.

Advertisement