@Override public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) { GL2 gl2 = arg0.getGL().getGL2(); 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, getWidth(), 0.0f, getHeight()); gl2.glMatrixMode(GL2.GL_MODELVIEW); gl2.glLoadIdentity(); gl2.glViewport(0, 0, getWidth(), getHeight()); controller.updateExtents(arg3 / 2, arg4 / 2); } }
public static void testGlError(GL4 gl) { if (gl != null) { int error = gl.glGetError(); if (error != 0) { RuntimeException e = new RuntimeException( "OpenGL Error " + error + ": " + (new GLU()).gluErrorString(error)); e.printStackTrace(); System.exit(-1); } } }
/** * Instantiates a GLU implementation object in respect to the given GL profile * of this thread current GL. */ public static final GLU createGLU() throws GLException { return createGLU(getCurrentGL()); }
/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code> */ public final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) { validateGLUquadricImpl(); ((GLUquadricImpl) quad).drawDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops); }
/** * Create a tesselator which triangulates all {@link SimpleAccessGeometry} of a {@link GeometryQualityModel}. * * @param useDirectBuffers * to use direct buffers instead of heap buffers. */ public Tesselator( boolean useDirectBuffers ) { glu = new GLU(); this.useDirectBuffers = useDirectBuffers; }
@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 ); }
@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 ); }
/** * Apply the camera to a GL context. * * @param gl GL context. */ public void apply(GL2 gl) { // 3D projection gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); // Perspective. glu.gluPerspective(35, ratio, 1, 1000); glu.gluLookAt(distance * sinZ, distance * -cosZ, height, // pos 0, 0, .5, // center 0, 0, 1 // up ); // Change back to model view matrix. gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); // Store the matrixes for reference. gl.glGetIntegerv(GL.GL_VIEWPORT, viewp, 0); gl.glGetDoublev(GLMatrixFunc.GL_MODELVIEW_MATRIX, modelview, 0); gl.glGetDoublev(GLMatrixFunc.GL_PROJECTION_MATRIX, projection, 0); }
final GLU glu = GLU.createGLU(gl); final int error = glu.gluScaleImage(pixFormat, actualWidth, actualHeight, pixDataType, image.getData(0), w, h, pixDataType, scaledImage); if (error != 0) { final int errorCode = gl.glGetError(); if (errorCode != GL.GL_NO_ERROR) { throw new GLException(glu.gluErrorString(errorCode)); } else { glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getHeight(), glu.gluBuild2DMipmaps(getGLCubeMapFace(face), JoglTextureUtil.getGLInternalFormat(texture.getTextureStoreFormat()), image.getWidth(), image.getWidth(),
private static void enableWrite(final boolean enable, final ZBufferStateRecord record) { final GL gl = GLU.getCurrentGL(); if (enable != record.writable || !record.isValid()) { gl.glDepthMask(enable); record.writable = enable; } } }
Point3d lookingAt = viewParams.getViewFrustum().getLookingAt(); Vector3d viewerUp = viewParams.getViewFrustum().getUp(); glu.gluLookAt( eyePos.x, eyePos.y, eyePos.z, lookingAt.x, lookingAt.y, lookingAt.z, viewerUp.x, viewerUp.y, viewerUp.z );
@Override public void errorData( int arg0, Object originalVertex ) { super.errorData( arg0, originalVertex ); throw new IllegalArgumentException( "Error while tesselating: " + originalVertex + " cause: " + glu.gluErrorString( arg0 ) ); // LOG.error( ); }
final GLU glu = GLU.createGLU(gl); glu.gluBuild2DMipmaps(texTarget, data.getInternalFormat(), data.getWidth(), data.getHeight(), data.getPixelFormat(), data.getPixelType(), data.getBuffer());
DebugListener(final GL gl, final Frame frame) { this.glu = GLU.createGLU(gl); this.frame = frame; }
GeometryCallBack( SimpleAccessGeometry geom ) { this.geom = geom; glu = new GLU(); tesselatedVertices = new LinkedList<Vertex>(); }
/** * @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 ) { 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 ); }
private static void applyFunction(final int depthFunc, final ZBufferStateRecord record) { final GL gl = GLU.getCurrentGL(); if (depthFunc != record.depthFunc || !record.isValid()) { gl.glDepthFunc(depthFunc); record.depthFunc = depthFunc; } }
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 ); float[] newEye = JOGLUtils.getEyeFromModelView( gl );
/** Option (throws GLException if not available in profile). <br> Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric * quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code> */ public final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) { validateGLUquadricImpl(); ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep); }