/** * Called back immediately after the OpenGL context is initialized. Can be used * to perform one-time initialization. Run only once. * GLEventListener method. */ @Override public void init(GLAutoDrawable drawable) { logger.log(Level.INFO, "Initializing OpenGL context."); generateObject(); this.fpsCounter = new FPSCounter(drawable, new Font("SansSerif", Font.BOLD, 12)); this.overlay = new Overlay(drawable, new Font("SansSerif", Font.BOLD, 12)); this.overlay.setColor(127, 127, 127, 100); this.overlay.setTextLocation(Overlay.LOWER_LEFT); // Parse random gcode file and generate something to draw. 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_DEPTH_TEST); // enables depth testing gl.glDepthFunc(GL_LEQUAL); // the type of depth test to do gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // best perspective correction gl.glShadeModel(GL_SMOOTH); // blends colors nicely, and smoothes out lighting }
@Override public void glClearColor(float red, float green, float blue, float alpha) { gl.glClearColor(red, green, blue, alpha); }
public static void glClearColor( float red, float green, float blue, float alpha) { gl().glClearColor( red, green, blue, alpha); }
public void init(GLAutoDrawable drawable) { System.out.println(what+": init"); GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0.0f,0.0f,0.0f,0.0f); } public void reshape(
@Override public void initConfig(GL2 gl) { super.initConfig(gl); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); float[] backgroundColor = vizController.getVizModel().getBackgroundColorComponents(); gl.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], transparentBackground ? 0f : 1f); }
gl2.glClearColor(fogcol[0], fogcol[1], fogcol[2], fogcol[3]);
@Override public void init(GLAutoDrawable drawable) { // Use debug pipeline // drawable.setGL(new DebugGL(drawable.getGL())); GL2 gl = drawable.getGL().getGL2(); System.err.println("INIT GL IS: " + gl.getClass().getName()); // Enable VSync gl.setSwapInterval(1); // Setup the drawing area and shading mode gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0); gl.glClearColor(0.17f, 0.65f, 0.92f, 0.0f); // sky blue color gl.glEnable(GL.GL_DEPTH_TEST); int[] depth_bits = new int[1]; gl.glGetIntegerv(GL.GL_DEPTH_BITS, depth_bits, 0); gl.glShadeModel(GLLightingFunc.GL_SMOOTH); // try setting this to // GL_FLAT and see what // happens. addLight(gl); axisLabels.init(); float[] grayCol = { 0.8f, 0.8f, 0.8f, 1.0f }; gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, grayCol, 0); }
@Override public void init(GLAutoDrawable drawable) { // Use debug pipeline // drawable.setGL(new DebugGL(drawable.getGL())); GL2 gl = drawable.getGL().getGL2(); System.err.println("INIT GL IS: " + gl.getClass().getName()); // Enable VSync gl.setSwapInterval(1); // Setup the drawing area and shading mode gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0); gl.glClearColor(0.17f, 0.65f, 0.92f, 0.0f); // sky blue color gl.glEnable(GL.GL_DEPTH_TEST); int[] depth_bits = new int[1]; gl.glGetIntegerv(GL.GL_DEPTH_BITS, depth_bits, 0); gl.glShadeModel(GLLightingFunc.GL_SMOOTH); // try setting this to // GL_FLAT and see what // happens. addLight(gl); float[] grayCol = { 0.8f, 0.8f, 0.8f, 1.0f }; // float[] blueCol = {0.0f, 0.0f, 0.8f, 1.0f}; gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, grayCol, 0); axisLabels.init(); }
public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glDisable(GL.GL_CULL_FACE); gl.glShadeModel(GL2.GL_SMOOTH); gl.glClearColor(COLOR_BACKGROUND.getRed() / 255.0f, COLOR_BACKGROUND.getGreen() / 255.0f, COLOR_BACKGROUND.getBlue() / 255.0f, 1); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); gl.setSwapInterval(1); gl.glDisable(GL2.GL_CULL_FACE); delaunayTriangulator = new DelaunayTriangulator(pointSet); }
@Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); float[] backgroundColor = vizController.getVizModel().getBackgroundColorComponents(); gl.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], transparentBackground ? 0f : 1f); engine.display(gl, GLU); }
/** * clear the panel * * @param gl2 */ private void paintBackground(GL2 gl2) { // Clear The Screen And The Depth Buffer gl2.glClearColor(212.0f / 255.0f, 233.0f / 255.0f, 255.0f / 255.0f, 0.0f); // Special handling for the case where the GLJPanel is translucent // and wants to be composited with other Java 2D content if (GLProfile.isAWTAvailable() && (this instanceof com.jogamp.opengl.awt.GLJPanel) && !((com.jogamp.opengl.awt.GLJPanel) this).isOpaque() && ((com.jogamp.opengl.awt.GLJPanel) this).shouldPreserveColorBufferIfTranslucent()) { gl2.glClear(GL2.GL_DEPTH_BUFFER_BIT); } else { gl2.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); } }
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl; System.out.println("reshape "+x+","+y+" "+width+","+height); gl = drawable.getGL().getGL2(); newosdwidth=width; newosdheight=height; gl.glViewport(0, 0, newosdwidth, newosdheight); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0,newosdwidth,newosdheight,0,-1.0,1.0); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f); gl.glClear( gl.GL_COLOR_BUFFER_BIT); synchronized(newpbufferlock) { newpbuffer=true; } myConn.postResizeEvent(new java.awt.Dimension(c.getWidth(), c.getHeight())); }
/** * Called back immediately after the OpenGL context is initialized. Can be * used to perform one-time initialization. Run only once. * * @param drawable */ @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_DEPTH_TEST); // enables depth testing gl.glDepthFunc(GL_LEQUAL); // the type of depth test to do gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // best perspective correction gl.glShadeModel(GL_SMOOTH); // blends colors nicely, and smoothes out lighting }
gl.glClearColor(0.17f, 0.65f, 0.92f, 0.0f);
@Override public void display(GLAutoDrawable glAutoDrawable) { GL2 gl = (GL2) glAutoDrawable.getGL(); OTFClientControl.getInstance().getMainOTFDrawer().setFrustrum(gl); float[] backgroundColor = OTFClientControl.getInstance().getOTFVisConfig().getBackgroundColor().getColorComponents(new float[4]); gl.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); float[] networkColor = OTFClientControl.getInstance().getOTFVisConfig().getNetworkColor().getColorComponents(new float[4]); gl.glColor4d(networkColor[0], networkColor[1], networkColor[2], networkColor[3]); checkNetList(glAutoDrawable); gl.glCallList(netDisplList); }
@Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); this.textRenderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 32), true, false); gl.setSwapInterval(0); float[] components = otfVisConfig.getBackgroundColor().getColorComponents(new float[4]); gl.glClearColor(components[0], components[1], components[2], components[3]); gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); if (!glInited) { // This method can (and will) be called several times. // (Gl contexts can change without notice.) float minEasting = (float)clientQ.getMinEasting(); float minNorthing = (float)clientQ.getMinNorthing(); float maxNorthing = (float)clientQ.getMaxNorthing(); double aspectRatio = (double) drawable.getSurfaceWidth() / (double) drawable.getSurfaceHeight(); double pixelRatio = (double) drawable.getSurfaceHeight() / (double) (maxNorthing-minNorthing); this.scale = 1.0f / (float) pixelRatio; this.viewBounds = new QuadTree.Rect(minEasting, minNorthing, minEasting + (maxNorthing - minNorthing) * aspectRatio, maxNorthing); if (otfVisConfig.isMapOverlayMode()) { setScale(nearestPowerOfTwo(this.scale)); } int time = this.hostControlBar.getSimTime(); QuadTree.Rect rect = new QuadTree.Rect((float)clientQ.getMinEasting(), (float)clientQ.getMinNorthing(), (float)clientQ.getMaxEasting(), (float)clientQ.getMaxNorthing()); this.currentSceneGraph = this.clientQ.getSceneGraph(time, rect); } marker = GLUtils.createTexture(gl, MatsimResource.getAsInputStream("otfvis/marker.png")); currentSceneGraph.glInit(); glInited = true; }
@Override public void beforeDisplay(GL2 gl, GLU glu) { //Lighten delta if (lightenAnimationDelta != 0) { float factor = vizConfig.getLightenNonSelectedFactor(); factor += lightenAnimationDelta; if (factor >= 0.5f && factor <= 0.98f) { vizConfig.setLightenNonSelectedFactor(factor); } else { lightenAnimationDelta = 0; vizConfig.setLightenNonSelected(anySelected); } } if (backgroundChanged) { float[] backgroundColor = vizController.getVizModel().getBackgroundColorComponents(); gl.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1f); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); backgroundChanged = false; } if (reinit) { VizController.getInstance().refreshWorkspace(); dataBridge.reset(); graphDrawable.initConfig(gl); graphDrawable.setCameraLocation(vizController.getVizModel().getCameraPosition()); graphDrawable.setCameraTarget(vizController.getVizModel().getCameraTarget()); vizConfig.setCustomSelection(false); reinit = false; } }
gl.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1f);
gl.glDrawBuffers(2, g_drawBuffers, 0); gl.glClearColor(0, 0, 0, 0); gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
gl.glViewport(0, 0, maskCL[pyramidLevel].width, maskCL[pyramidLevel].height); gl.glClearColor(0, 0, 0, 0); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glColor4f(1, 1, 1, 1);