/** * Call-back handler for window re-size event. Also called when the drawable is * first set to visible. * GLEventListener method. */ @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { logger.log(Level.INFO, "Reshaping OpenGL context."); if (!isDrawable) return; this.xSize = width; this.ySize = height; GL2 gl = drawable.getGL().getGL2(); // get the OpenGL 2 graphics context if (height == 0){ height = 1; } // prevent divide by zero this.aspectRatio = (float)width / height; this.scaleFactorBase = VisualizerUtils.findScaleFactor(this.xSize, this.ySize, this.objectMin, this.objectMax, 0.9); this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier; this.panMultiplierX = VisualizerUtils.getRelativeMovementMultiplier(this.objectMin.x, this.objectMax.x, this.xSize); this.panMultiplierY = VisualizerUtils.getRelativeMovementMultiplier(this.objectMin.y, this.objectMax.y, this.ySize); // Set the view port (display area) to cover the entire window gl.glViewport(0, 0, width, height); }
protected static void setup( GL2 gl2, int width, int height ) { gl2.glMatrixMode( GL2.GL_PROJECTION ); gl2.glLoadIdentity(); // coordinate system origin at lower left with width and height same as the window GLU glu = new GLU(); glu.gluOrtho2D( 0.0f, width, 0.0f, height ); gl2.glMatrixMode( GL2.GL_MODELVIEW ); gl2.glLoadIdentity(); gl2.glViewport( 0, 0, width, height ); }
gl2.glLoadIdentity(); gl2.glViewport(0, 0, width, height);
@Override public void glViewport(int x, int y, int width, int height) { gl.glViewport(x, y, width, height); }
gl2.glViewport(0, 0, width, height);
public static void glViewport( int x, int y, int width, int height) { gl().glViewport( x, y, width, height); }
public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height) { System.out.println(what+": reshape"); GL2 gl = drawable.getGL().getGL2(); gl.glViewport(0,0,width,height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0); } public void display(GLAutoDrawable drawable) {
@Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl = drawable.getGL().getGL2(); GLU glu = new GLU(); if (height <= 0) { // avoid a divide by zero error! height = 1; } gl.glViewport(0, 0, width, height); // size of drawing area gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0, (float) width / (float) height, 1.0, 1500.0); // 5 }
@Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl = drawable.getGL().getGL2(); GLU glu = new GLU(); if (height <= 0) { // avoid a divide by zero error! height = 1; } gl.glViewport(0, 0, width, height); // size of drawing area gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0, (float) width / (float) height, 1.0, 1500.0); // 5 }
gl.glViewport(viewportX, viewportY, viewportW, viewportH);
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())); }
/** * Call-back handler for window re-size event. Also called when the drawable * is first set to visible. */ @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL2 gl = drawable.getGL().getGL2(); // get the OpenGL 2 graphics context if (height == 0) { height = 1; // prevent divide by zero } float aspect = (float) width / height; // Set the view port (display area) to cover the entire window gl.glViewport(0, 0, width, height); // Setup perspective projection, with aspect ratio matches viewport gl.glMatrixMode(GL_PROJECTION); // choose projection matrix gl.glLoadIdentity(); // reset projection matrix glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar // Enable the model-view transform gl.glMatrixMode(GL_MODELVIEW); gl.glLoadIdentity(); // reset }
/** * Setup openGl view perspective. * * @param viewport * viewport with perspective configuration * @param gl * gl */ public static void reshapePerspective(Viewport viewport, GL2 gl) { // size of drawing area gl.glViewport(0, 0, viewport.getWidth(), viewport.getHeight()); // activate projection matrix gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); // load identity as projection gl.glLoadIdentity(); // setup projection perspective new GLU().gluPerspective(viewport.getFovy(), viewport.viewportAspectRatio(), viewport.getZNear(), viewport.getZFar()); } }
gl.glViewport(0, 0, osdwidth, osdheight); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity();
gl.glViewport(0, 0, osdwidth, osdheight); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glViewport(0, 0, fbttexturet[2], fbttexturet[3]); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity();
gl.glViewport(0, 0, maskCL[pyramidLevel].width, maskCL[pyramidLevel].height);
int screenYoffset = 0; gl.getGL2().glViewport(screenXoffset, screenYoffset, screenWidth, screenHeight);