@Override public void glClear(int mask) { gl.glClear(mask); }
@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); }
/** * 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 static void glClear( int mask) { gl().glClear( mask); }
@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); }
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl2.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl2.glLoadIdentity(); gl2.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
/** * Called back by the animator to perform per-frame rendering. */ @Override public void display(GLAutoDrawable glAutoDrawable) { GL2 gl = glAutoDrawable.getGL().getGL2(); // get the OpenGL 2 graphics context gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // clear background gl.glLoadIdentity(); // reset the model-view matrix // Rendering code /* There you can fill the whole window with a color, or draw something more beautiful... */ gl.glFlush(); /* Here goes testing cycle from mouseClicked(); and it works! */ }
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())); }
protected static void render( GL2 gl2, int width, int height ) { gl2.glClear( GL.GL_COLOR_BUFFER_BIT );
@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 display(GLAutoDrawable drawable) { //FPS if (startTime == 0) { startTime = System.currentTimeMillis() - 1; } long endTime = System.currentTimeMillis(); long delta = endTime - startTime; startTime = endTime; fps = 1000.0f / delta; if (fps < 100) { fpsAvg = (fpsAvg * fpsCount + fps) / ++fpsCount; } GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); render3DScene(gl, GLU); scheduler.display(gl, GLU); // renderTestCube(gl); }
@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; } }
gl2.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl2.glLoadIdentity(); gl2.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
@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; }
public void display(GLAutoDrawable drawable) { System.out.println(what+": display"); GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glColor3f(1.0f,1.0f,0.0f); gl.glBegin(GL2.GL_POLYGON); gl.glVertex3f(0.25f,0.25f,0.00f); gl.glVertex3f(0.75f,0.25f,0.00f); gl.glVertex3f(0.75f,0.75f,0.00f); gl.glVertex3f(0.25f,0.75f,0.00f); gl.glEnd(); gl.glFlush(); } public void dispose(GLAutoDrawable drawable) {
@Override public void display(GLAutoDrawable drawable) { // TODO Auto-generated method stub GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); // call your draw code here gl.glTranslatef(0, 0, xLoc); gl.glRotatef(rotateX, 1, 0, 0); gl.glRotatef(rotateY, 0, 1, 0); gl.glRotatef(rotateZ, 0, 0, 1); square.draw(gl); // end calls for drawing }
private void drawActiveWindow(GLAutoDrawable drawable) { //Pre Drawing resetGraphics(drawable); preDisplay(graphic); //Display 3D reshape(drawable, canvas.getX(), canvas.getY(), canvas.getWidth(), canvas.getHeight()); activeWindowGL.getApplication3D().display(graphic); //Post Drawing //Avoid 2D drawings being mixed with 3D Environment graphic.getGL2().glClear(GL.GL_DEPTH_BUFFER_BIT); resetGraphics(drawable); draw(graphic); }
@Override public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); // System.err.println("INIT GL IS: " + gl.getClass().getName()); GLU glu = new GLU(); // _direction_ gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, this.lightPos, 0); // clear color and depth buffers gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); setCamera(glu); gl.glEnable(GL.GL_MULTISAMPLE); // String versionStr = gl.glGetString( GL2.GL_VERSION ); // log.info( "GL version:"+versionStr ); floor.draw(gl); axisLabels.draw(gl); // drawTextInfo(gl, this.simpleMoveAnimator.info()); // Flush all drawing operations to the graphics card gl.glFlush(); }
@Override public void display(GLAutoDrawable drawable) { this.simpleMoveAnimator.updateState(); GL2 gl = drawable.getGL().getGL2(); // System.err.println("INIT GL IS: " + gl.getClass().getName()); GLU glu = new GLU(); // _direction_ gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, this.lightPos, 0); // clear color and depth buffers gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); setCamera(glu); gl.glEnable(GL.GL_MULTISAMPLE); // String versionStr = gl.glGetString( GL2.GL_VERSION ); // log.info( "GL version:"+versionStr ); floor.draw(gl); axisLabels.draw(gl); // drawTextInfo(gl, this.simpleMoveAnimator.info()); // Flush all drawing operations to the graphics card gl.glFlush(); }