/** * @param context * @param eye */ public void renderPrepared( GL context, float[] eye ) { // the translation context.glTranslatef( location[0], location[1], location[2] ); // the rotation calculateAndSetRotation( context, eye ); context.glScalef( width, 1, height ); context.glDrawArrays( GL.GL_QUADS, 0, 4 ); }
@Override public void render( RenderContext glRenderContext ) { Point3d eye = glRenderContext.getViewParams().getViewFrustum().getEyePos(); GL context = glRenderContext.getContext(); context.glPushMatrix(); context.glDepthMask( false ); context.glEnable( GL.GL_TEXTURE_2D ); context.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY ); // the translation context.glTranslatef( location[0], location[1], location[2] ); // the rotation calculateAndSetRotation( context, new float[] { (float) eye.x, (float) eye.y, (float) eye.z } ); context.glScalef( width, 1, height ); TexturePool.loadTexture( glRenderContext, textureID ); // context.glMaterialfv( GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] { 1, 1, 1, .1f }, 0 ); context.glVertexPointer( 3, GL.GL_FLOAT, 0, coordBuffer ); context.glTexCoordPointer( 2, GL.GL_FLOAT, 0, textureBuffer ); // context.glDisableClientState( GL.GL_NORMAL_ARRAY ); context.glDrawArrays( GL.GL_QUADS, 0, 4 ); context.glDisableClientState( GL.GL_TEXTURE_COORD_ARRAY ); context.glDisable( GL.GL_TEXTURE_2D ); context.glDepthMask( true ); context.glMatrixMode( GL.GL_MODELVIEW ); context.glPopMatrix(); }