Author: paperwing
Date: 2012-02-28 07:45:51 -0800 (Tue, 28 Feb 2012)
New Revision: 28382
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
Log:
Switched back to using the older com.jogamp.opengl.util.awt.TextRenderer; now
reuses TextRenderer instance during runtime.
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
2012-02-28 01:09:46 UTC (rev 28381)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
2012-02-28 15:45:51 UTC (rev 28382)
@@ -14,18 +14,16 @@
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
-// import com.jogamp.opengl.util.awt.TextRenderer;
+import com.jogamp.opengl.util.awt.TextRenderer;
// Below will be used for JOGL 2.0-b45-20111219
-
+/*
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.curve.opengl.TextRenderer;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.font.FontFactory;
-import com.jogamp.graph.geom.opengl.SVertex;
-import com.jogamp.opengl.util.glsl.ShaderState;
+*/
-
public class RenderNodeLabelsProcedure implements ReadOnlyGraphicsProcedure {
private static final int TEXT_FONT_SIZE = 9;
@@ -37,6 +35,8 @@
private TextRenderer textRenderer;
public RenderNodeLabelsProcedure() {
+
+ textRenderer = new TextRenderer(TEXT_DEFAULT_FONT);
}
@Override
@@ -47,16 +47,15 @@
// textRenderer.setSmoothing(false);
// Temporarily removed -- pausing JOGL update to
2.0-b45-20111219
- RenderState renderState = RenderState.createRenderState(new
ShaderState(), SVertex.factory());
- textRenderer =
TextRenderer.create(RenderState.getRenderState(gl), 0);
+// textRenderer =
TextRenderer.create(RenderState.getRenderState(gl),
GLRegion.TWO_PASS_DEFAULT_TEXTURE_UNIT);
}
@Override
public void execute(GraphicsData graphicsData) {
GL2 gl = graphicsData.getGlContext();
- // textRenderer = new TextRenderer(TEXT_DEFAULT_FONT);
+
CyNetworkView networkView = graphicsData.getNetworkView();
float distanceScale = graphicsData.getDistanceScale();
float x, y, z;
@@ -74,7 +73,7 @@
Color textColor;
gl.glPushMatrix();
- // textRenderer.beginRendering(graphicsData.getScreenWidth(),
graphicsData.getScreenHeight(), true);
+ textRenderer.beginRendering(graphicsData.getScreenWidth(),
graphicsData.getScreenHeight(), true);
// textRenderer.drawString3D(arg0, arg1, arg2, arg3, arg4, arg5)
// textRenderer.beginRendering(graphicsData.getScreenWidth(),
graphicsData.getScreenHeight(), true);
@@ -112,25 +111,24 @@
}
// Below to be used for JOGL
2.0-b45-20111219's new TextRenderer
- gl.glColor3f((float)
textColor.getRed() / 255,
- (float)
textColor.getGreen() / 255,
- (float)
textColor.getBlue() / 255);
+// gl.glColor3f((float)
textColor.getRed() / 255,
+// (float)
textColor.getGreen() / 255,
+// (float)
textColor.getBlue() / 255);
- textRenderer.drawString3D(gl,
FontFactory.get(FontFactory.JAVA).getDefault(),
- text, new
float[]{1.0f, 1.0f, 2.0f}, TEXT_FONT_SIZE, 128);
+// textRenderer.drawString3D(gl,
FontFactory.getDefault().getDefault(),
+// text, new
float[]{1.0f, 1.0f, 2.0f}, TEXT_FONT_SIZE, 1024);
-//
textRenderer.setColor(textColor);
-// textRenderer.draw(text, (int)
screenCoordinates.x() - findTextScreenWidth(text) / 2, (int)
screenCoordinates.y());
-// textRenderer.flush();
+
textRenderer.setColor(textColor);
+ textRenderer.draw(text, (int)
screenCoordinates.x() - findTextScreenWidth(text) / 2, (int)
screenCoordinates.y());
+ textRenderer.flush();
}
}
}
}
+ textRenderer.endRendering();
-// textRenderer.endRendering();
-
gl.glPopMatrix();
}
@@ -139,7 +137,7 @@
int width = 0;
for (int i = 0; i < text.length(); i++) {
-// width += textRenderer.getCharWidth(text.charAt(i));
+ width += textRenderer.getCharWidth(text.charAt(i));
}
return width;
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.