Login  Register

Re: My Application crashed

Posted by robbiezl on Jul 03, 2012; 3:25am
URL: https://forum.jogamp.org/My-Application-crashed-tp4025350p4025386.html

I have seen the lock code,but i still do not know how to use it ,i am a newer to opengle

I just draw TextRender use the code below,then cause the cash,how should I sync this code?

public void displayFlatLegendText(GLAutoDrawable drawable) {
                if(flatLegendTextDisplayFlag){
                        GL2 gl2 = drawable.getGL().getGL2();
                        gl2.glPushMatrix();
                        float x=0;
                        float y=this.layoutTransVec.y()-2*halfLength;
                        float z=this.layoutTransVec.z();

                        // Render the text
                        textRenderer.begin3DRendering();
                        textRenderer.setColor(255, 255, 255, 255);
                        Rectangle2D r2d=textRenderer.getBounds(flatLegendPicInforText);
                        float scaleFactor=0.0015f;
                        float textWidth3D=(float) (r2d.getWidth()*scaleFactor);
                        textRenderer.draw3D(flatLegendPicInforText, x-textWidth3D/2, y,z,scaleFactor);
                        textRenderer.flush();
                        textRenderer.end3DRendering();
                       
                        gl2.glPopMatrix();
                }
        }