@Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); // get the OpenGL graphics context glu = new GLU(); // get GL Utilities gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color gl.glClearDepth(1.0f); // set clear depth value to farthest gl.glEnable(GL.GL_DEPTH_TEST); // enables depth testing gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // best // perspective // correction gl.glShadeModel(GLLightingFunc.GL_SMOOTH); // blends colors nicely, and // smoothes out // lighting time = System.currentTimeMillis(); }
@Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); if(DEBUG) { gl = new DebugGL2(gl); drawable.setGL(gl); } // As we aren't really rendering models, but just drawing, // We do not need to set up a lot. gl.glClearColor(1f, 1f, 1f, 1f); gl.glDisable(GL.GL_DEPTH_TEST); gl.glDisable(GL.GL_CULL_FACE); glu = new GLU(); shared.camera = new Simple1DOFCamera(glu); shared.camera.addCameraListener(new CameraListener() { @Override public void cameraChanged() { canvas.display(); } }); // Setup arcball: arcball = new Arcball1DOFAdapter(shared.camera); shared.textrenderer = new TextRenderer(new Font(Font.SANS_SERIF, Font.BOLD, 36)); // Ensure listeners. switchState(state); }
@SuppressWarnings("static-access") protected void initialize(GL2 gl2) { if (initialized_context_ == gl2) return; initialized_context_ = gl2; if (!gl2.getContext().isHardwareRasterizer()) { // Workaround for Windows Remote Desktop which requires pot textures. System.out.println("opengl rendering may be slow as hardware rendering isn't available"); use_draw_pixels_ = true; return; } gl2.glHint(gl2.GL_POLYGON_SMOOTH_HINT, gl2.GL_NICEST); gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Necessary for non-power-of-2 textures to render correctly. gl2.glPixelStorei(gl2.GL_UNPACK_ALIGNMENT, 1); // Create the texture. gl2.glGenTextures(1, texture_id_, 0); assert(texture_id_[0] != 0); gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]); gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MIN_FILTER, gl2.GL_NEAREST); gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MAG_FILTER, gl2.GL_NEAREST); gl2.glTexEnvf(gl2.GL_TEXTURE_ENV, gl2.GL_TEXTURE_ENV_MODE, gl2.GL_MODULATE); }
try { GL2 gl = (GL2)glad.getGL(); gl.glClearColor(0, 0, 0, 1); gl.glClear(GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity(); gl.glClearColor(1f, 1f, 1f, .0f); gl.glClear(GL2.GL_COLOR_BUFFER_BIT);