gl.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY ); gl.glBindBufferARB( GL.GL_ARRAY_BUFFER_ARB, glVCB ); gl.glTexCoordPointer( 2, GL.GL_FLOAT, 0, 0 ); gl.glBindTexture( GL.GL_TEXTURE_2D, tId ); gl.glTexParameteri( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE ); gl.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY ); gl.glBindBufferARB( GL.GL_ARRAY_BUFFER_ARB, glVCB ); gl.glTexCoordPointer( 2, GL.GL_FLOAT, 0, 0 );
@Override protected void enableArrays( RenderContext glRenderContext, DirectGeometryBuffer geomBuffer ) { super.enableArrays( glRenderContext, geomBuffer ); if ( texturePosition >= 0 && textureBuffer == null && geomBuffer != null ) { textureBuffer = geomBuffer.getTextureCoordinates( texturePosition, textureOrdinatesCount ); if ( textureBuffer == null ) { texturePosition = -1; } } if ( textureBuffer != null ) { glRenderContext.getContext().glEnable( GL.GL_TEXTURE_2D ); TexturePool.loadTexture( glRenderContext, texture ); glRenderContext.getContext().glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY ); glRenderContext.getContext().glTexCoordPointer( 2, GL.GL_FLOAT, 0, textureBuffer ); } }
context.glTexCoordPointer( 2, GL.GL_FLOAT, 0, 0 );
@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(); }