/* * Initialize z-buffer, projection matrix, light source, and lighting model. * Do not specify a material property here. */ public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); glut = new GLUT(); // float position[] = {0.0f, 3.0f, 3.0f, 0.0f}; float local_view[] = {0.0f}; gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LESS); gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, position, 0); gl.glLightModelfv(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, local_view, 0); gl.glFrontFace(GL.GL_CW); gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0); gl.glEnable(GL2.GL_AUTO_NORMAL); gl.glEnable(GL2.GL_NORMALIZE); gl.glEnable(GL2.GL_FOG); { float fogColor[] = {0.5f, 0.5f, 0.5f, 1.0f}; fogMode = GL2.GL_EXP; gl.glFogi(GL2.GL_FOG_MODE, fogMode); gl.glFogfv(GL2.GL_FOG_COLOR, fogColor, 0); gl.glFogf(GL2.GL_FOG_DENSITY, 0.35f); gl.glHint(GL2.GL_FOG_HINT, GL.GL_DONT_CARE); gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f); } }
@Override public void init(GLAutoDrawable drawable) { final GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0f, 0f, 0f, 0f); gl.glClearDepth(1.0f); gl.glShadeModel(GL2.GL_SMOOTH); gl.glEnable(GL2.GL_DEPTH_TEST); // gl.glEnable(GL2.GL_CULL_FACE); // don't render face backside of triangles // gl.glCullFace(GL2.GL_BACK); // backside gl.glDepthFunc(GL2.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST); loadTextures(); loadModels(); setQuadParams(); addTestListData(); PassiveObjectMovement.getInstance().startThread(s); }