@Override public void beginRendering() { renderer.begin3DRendering(); float cameraLocation = drawable.getCameraLocation()[2]; if (cachedCameraLocationZ != cameraLocation && model.sizeMode == sizeModes[0]) { //Force refresh if camera location changed in fixed mode nodeRefresh = true; edgeRefresh = true; } cachedCameraLocationZ = cameraLocation; }
@Override public void drawSimpleText(GL gl, GLU glu, Camera cam, String s, Coord3d position, Color color) { renderer.begin3DRendering(); renderer.draw3D(s, position.x, position.y, position.z, 0.01f); renderer.flush(); renderer.end3DRendering(); }
/** * Draw txt at (x,y,z), with the text centered in the x-direction, facing * along the +z axis. * * @param gl * @param txt * @param x * @param y * @param z */ private void drawAxisText(GL2 gl, String txt, float x, float y, float z) { Rectangle2D dim = this.axisLabelRenderer.getBounds(txt); float width = (float) dim.getWidth() * SCALE_FACTOR; this.axisLabelRenderer.begin3DRendering(); this.axisLabelRenderer.draw3D(txt, x - width / 2, y, z, SCALE_FACTOR); this.axisLabelRenderer.end3DRendering(); } }
/** * Draw txt at (x,y,z), with the text centered in the x-direction, facing * along the +z axis. * * @param gl * @param txt * @param x * @param y * @param z */ private void drawAxisText(GL2 gl, String txt, double x, double y, double z) { Rectangle2D dim = this.axisLabelRenderer.getBounds(txt); float width = (float) dim.getWidth() * SCALE_FACTOR; this.axisLabelRenderer.begin3DRendering(); this.axisLabelRenderer.draw3D(txt, (float) x - width / 2, (float) y, (float) z, SCALE_FACTOR); this.axisLabelRenderer.end3DRendering(); } }
/** * Draw text at (x,y,z), with the text centered in the x-direction, facing * along the +z axis. * * @param gl * gl2 * @param text * text to draw * @param x * coordinate x * @param y * coordinate y * @param z * coordinate z */ private void drawAxisText(GL2 gl, String text, float x, float y, float z) { Rectangle2D dim = this.axisLabelRenderer.getBounds(text); float width = (float) dim.getWidth() * SCALE_FACTOR; this.axisLabelRenderer.begin3DRendering(); this.axisLabelRenderer.draw3D(text, x - width / 2, y, z, SCALE_FACTOR); this.axisLabelRenderer.end3DRendering(); }
/** * Draw list of texts described by pText. Each text have (x,y,z), with the * text centered in the x-direction, facing along the +z axis. * * @param gl * gl2 * @param text * text to draw */ private void drawAxisText(GL2 gl, List<TextToRender> text) { this.axisLabelRenderer.begin3DRendering(); for (TextToRender textToRender : text) { Rectangle2D dim = this.axisLabelRenderer.getBounds(textToRender.getText()); float width = (float) dim.getWidth() * SCALE_FACTOR; this.axisLabelRenderer.draw3D(textToRender.getText(), textToRender.getX() - width / 2, textToRender.getY(), textToRender.getZ(), SCALE_FACTOR); } this.axisLabelRenderer.end3DRendering(); }
protected void begin(TextRenderer renderer) { setTextColorRespectComposite(renderer); GL2 gl = g2d.getGLContext().getGL().getGL2(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPushMatrix(); gl.glScalef(1, -1, 1); gl.glTranslatef(0, -g2d.getCanvasHeight(), 0); renderer.begin3DRendering(); }
protected void begin(TextRenderer renderer) { setTextColorRespectComposite(renderer); GL2 gl = g2d.getGLContext().getGL().getGL2(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPushMatrix(); gl.glScalef(1, -1, 1); gl.glTranslatef(0, -g2d.getCanvasHeight(), 0); renderer.begin3DRendering(); }
private void renderLabels(GL2 gl, IntIntPair[] edgesort) { shared.textrenderer.begin3DRendering();
@Override public BoundingBox3d drawText(GL gl, GLU glu, Camera cam, String s, Coord3d position, Halign halign, Valign valign, Color color, Coord2d screenOffset, Coord3d sceneOffset) { //gl.getGL2().glPushMatrix(); renderer.begin3DRendering(); if(LAYOUT){ // work in progress Rectangle2D d = style.getBounds(s, font, renderer.getFontRenderContext()); Coord3d left2d = cam.modelToScreen(gl, glu, position); Coord2d right2d = new Coord2d(left2d.x+(float)d.getWidth(), left2d.y+(float)d.getHeight()); Coord3d right3d = cam.screenToModel(gl, glu, new Coord3d(right2d,0)); Coord3d offset3d = right3d.sub(position).div(2);//.mul(0.1f); Coord3d real = position.add(sceneOffset).sub(offset3d); renderer.draw3D(s, real.x, real.y, real.z, 1);//0.005f); } else{ Coord3d real = position.add(sceneOffset); renderer.draw3D(s, real.x, real.y, real.z, 1);//0.005f); } renderer.flush(); renderer.end3DRendering(); //gl.getGL2().glPopMatrix(); return null; }
this.textRenderer.begin3DRendering();
void drawString(String text, int x, int y, java.awt.Color color, GL2 gl, com.jogamp.opengl.util.awt.TextRenderer tr) { //System.out.println("drawString "+ text + " x: "+x+" y: "+y); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); //System.out.println("glOrtho(0,"+ c.getWidth() + ","+c.getHeight()+",0,-1.0,1.0)"); gl.glOrtho(0,c.getWidth(),0,c.getHeight(),-1.0,1.0); tr.begin3DRendering(); tr.setColor(color); tr.draw3D(text, x, c.getHeight()-y, 0, 1); tr.end3DRendering(); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPopMatrix(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); }
textRenderer.begin3DRendering(); textRenderer.draw3D(activityEntry.name, 0f, 0f, 0f, 1f); textRenderer.begin3DRendering(); textRenderer.draw3D(activityEntry.name, 0f, 0f, 0f, 1f); textRenderer.end3DRendering();
gl.glLoadIdentity(); gl.glOrtho(0,RSurfWidth,RSurfHeight,0,-1.0,1.0); tr.begin3DRendering();
this.sc.disable(gl); this.textRenderer.begin3DRendering(); float c = 0.f; String text = "" + (int) fl[10];