Hi there,
I am writing a game that needs the skybox. I am fresh to JOGL, so I hope someone can help me with this problem.
I create a 400200 square as the floor and want to add a skybox to cover it. I put the draw_skybox method in the initRender() method, but I cannot see the result. When I use 2020 square as the floor, I can see the skybox.
My code structure is below.
//=========================================================================================
import …
class game implements Runnable
{
Texture skybox;
public void run()
{
initRender();
renderLoop();
// discard the rendering context and exit
context.destroy();
System.exit(0);
} // end of run()
private void initRender()
{
makeContentCurrent();
gl = context.getGL();
glu = new GLU();
glut = new GLUT();
gl.glClearColor(0.17f, 0.65f, 0.92f, 1.0f); // sky blue
gl.glClearDepth(1.0f);
gl.glEnable(GL.GL_DEPTH_TEST); // z- (depth) selectBuffer initialization for hidden surface removal
gl.glShadeModel(GL.GL_SMOOTH); // use smooth shading
gl.glDepthFunc(GL.GL_LEQUAL);
gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
addLight();
loadTextures();
drawSkyBox();
}