@Override public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) { LOG.trace( "reshape( GLAutoDrawable, " + x + ", " + y + ", " + width + ", " + height + " ) called" ); GL gl = drawable.getGL(); gl.glViewport( x, y, width, height ); gl.glMatrixMode( GL.GL_PROJECTION ); gl.glLoadIdentity(); glu.gluOrtho2D( 0, width, 0, height ); gl.glMatrixMode( GL.GL_MODELVIEW ); gl.glLoadIdentity(); gl.glScalef( width, height, 1 ); }
@Override public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) { LOG.trace( "reshape( GLAutoDrawable, " + x + ", " + y + ", " + width + ", " + height + " ) called" ); GL gl = drawable.getGL(); gl.glViewport( x, y, width, height ); gl.glMatrixMode( GL.GL_PROJECTION ); gl.glLoadIdentity(); glu.gluOrtho2D( 0, width, 0, height ); gl.glMatrixMode( GL.GL_MODELVIEW ); gl.glLoadIdentity(); int posX = 0; int posY = 0; gl.glViewport( posX, posY, width, height ); gl.glScaled( width, height, 1 ); }
@Override public void reshape( GLAutoDrawable d, int x, int y, int width, int height ) { this.width = width; this.height = height; GL gl = d.getGL(); gl.glMatrixMode( GL.GL_PROJECTION ); gl.glLoadIdentity(); glu.gluPerspective( fov, (float) width / height, nearClippingPlane, farClippingPlane ); gl.glMatrixMode( GL.GL_MODELVIEW ); }
gl.glLoadIdentity(); init( gl ); reshape( gl );
GL gl = theDrawable.getGL(); gl.glClear( GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT ); gl.glLoadIdentity(); glu.gluLookAt( eye[0], eye[1], eye[2], lookAt[0], lookAt[1], lookAt[2], 0, 1, 0 ); trackBall.multModelMatrix( gl, centroid );
/** * @param gl */ private void reshape( GL gl ) { float aspect = (float) width / (float) height; LOG.trace( "reshape( GLAutoDrawable, " + 0 + ", " + 0 + ", " + width + ", " + height + " ) called, aspect: " + aspect ); gl.glMatrixMode( GL.GL_PROJECTION ); gl.glLoadIdentity(); gl.glViewport( 0, 0, width, height ); glu.gluPerspective( viewParams.getViewFrustum().getFOVY(), aspect, viewParams.getViewFrustum().getZNear(), viewParams.getViewFrustum().getZFar() ); gl.glMatrixMode( GL.GL_MODELVIEW ); }
@Override public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) { float aspect = (float) width / (float) height; LOG.info( "reshape( GLAutoDrawable, " + x + ", " + y + ", " + width + ", " + height + " ) called, aspect: " + aspect ); params.setProjectionPlaneDimensions( width, height ); GL gl = drawable.getGL(); gl.glViewport( x, y, width, height ); gl.glMatrixMode( GL.GL_PROJECTION ); gl.glLoadIdentity(); glu.gluPerspective( params.getViewFrustum().getFOVY(), aspect, params.getViewFrustum().getZNear(), params.getViewFrustum().getZFar() ); // glu.gluPerspective( params.getViewFrustum().getFOVY(), aspect, 0.01, 1000 ); gl.glMatrixMode( GL.GL_MODELVIEW ); }
gl.glLoadIdentity(); double limits[] = computeFrustumLimits(dc); dc.getGLU().gluPerspective(dc.getView().getFieldOfView().degrees,
@Override public void init( GLAutoDrawable d ) { d.setGL( new DebugGL( d.getGL() ) ); GL gl = d.getGL(); gl.glClearColor( 0.7f, 0.7f, 1f, 0 ); float[] lightAmbient = { 0.4f, 0.4f, 0.4f, 1.0f }; float[] lightDiffuse = { 0.8f, 0.8f, 0.8f, 1.0f }; float[] lightSpecular = { 1.0f, 1.0f, 1.0f, 1.0f }; float[] lightPosition = { 0.0f, 0.0f, 10.0f, 1.0f }; gl.glLightfv( GL.GL_LIGHT0, GL.GL_AMBIENT, lightAmbient, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_DIFFUSE, lightDiffuse, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_SPECULAR, lightSpecular, 0 ); gl.glLightfv( GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0 ); gl.glEnable( GL.GL_DEPTH_TEST ); gl.glEnable( GL.GL_LIGHT0 ); gl.glEnable( GL.GL_LIGHTING ); gl.glEnable( GL.GL_BLEND ); // enable color and texture blending gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ); gl.glMatrixMode( GL.GL_MODELVIEW ); gl.glLoadIdentity(); gl.glEnableClientState( GL.GL_NORMAL_ARRAY ); gl.glEnableClientState( GL.GL_VERTEX_ARRAY ); }
gl.glLoadIdentity(); glu.gluOrtho2D( 0, width, 0, height ); gl.glLoadIdentity();
gl.glLoadIdentity(); glu.gluOrtho2D( 0, params.getScreenPixelsX(), 0, params.getScreenPixelsY() ); gl.glLoadIdentity();