public void render(GLOContext ctx) { GUIContext guictx = (GUIContext) ctx; GL gl = ctx.getGL(); ModelRenderer mrend = guictx.rendcache.getModelRenderer(xpointermodel, ModelRenderer.NO_NORMALS); gl.glPushMatrix(); // #1 gl.glPushAttrib(GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT); gl.glEnable(GL.GL_CULL_FACE); setShader("xpointer"); Point org = origin; float w2 = getWidth() * 0.5f; float h2 = getHeight() * 0.5f; float cenx = org.x + w2; float ceny = org.y + h2; gl.glTranslatef(cenx, ceny, 0); gl.glScalef(w2, h2, 1); // must convert right-hand to left-hand coords // draw the x value gl.glPushMatrix(); float xval = getXValue(); xval = Math.max(-maxrot, Math.min(maxrot, xval * maxrot)); gl.glRotatef(90, 0, 0, 1); gl.glRotatef(xval, -1, 0, 0); mrend.render(); gl.glPopMatrix(); // draw the y value float yval = getYValue(); yval = Math.max(-maxrot, Math.min(maxrot, yval * maxrot)); gl.glRotatef(yval, -1, 0, 0); mrend.render(); gl.glPopAttrib(); gl.glPopMatrix(); // #1 }