Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/src/net/sourceforge/bprocessor/gl/view
Modified Files:
AbstractView.java
Log Message:
Text Drawing
Index: AbstractView.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** AbstractView.java 14 Sep 2005 14:07:37 -0000 1.27
--- AbstractView.java 15 Sep 2005 11:11:47 -0000 1.28
***************
*** 29,32 ****
--- 29,33 ----
import net.java.games.jogl.GLUquadric;
import net.java.games.jogl.util.BufferUtils;
+ import net.java.games.jogl.util.GLUT;
import net.java.games.jogl.GLUtesselatorCallbackAdapter;
import net.java.games.jogl.GLUtesselatorCallback;
***************
*** 90,93 ****
--- 91,98 ----
protected GLU glu = null;
+ /** The GLUT */
+
+ protected GLUT glut = new GLUT();
+
/** The zoomFactor in the parent view */
protected double zoomFactor = 1.0;
***************
*** 252,256 ****
--- 257,272 ----
gl.glLineWidth(2.0f);
drawAll(gld);
+
+ //gl.glMatrixMode(GL.GL_PROJECTION);
+ //gl.glLoadIdentity();
+ //glu.gluOrtho2D(0, width, 0, height);
+ //gl.glMatrixMode(GL.GL_MODELVIEW);
+ //gl.glLoadIdentity();
+
+ //drawTextBox(200, 200, "Space 1");
+
+
gl.glGetIntegerv(GL.GL_RENDER_MODE, mode);
+
if (mode[0] == GL.GL_SELECT) {
gl.glFlush();
***************
*** 265,268 ****
--- 281,311 ----
/**
+ * Draw string at specified position
+ * @param x The x position
+ * @param y The y position
+ * @param string The string to draw
+ */
+ void drawString(double x, double y, String string) {
+ gl.glPushMatrix();
+ gl.glTranslated(x, y, 0.1);
+ gl.glRasterPos2i(0, 0);
+ glut.glutBitmapString(gl, GLUT.BITMAP_HELVETICA_18, string);
+ gl.glPopMatrix();
+ }
+
+ /**
+ * Draw a box with a string
+ * @param x The x position
+ * @param y The y position
+ * @param string The String
+ */
+ void drawTextBox(double x, double y, String string) {
+ int width = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_18, string);
+ gl.glColor3d(0.85, 0.85, 0.85);
+ gl.glRectd(x - 4, y - 8, x + width + 4, y + 18);
+ gl.glColor3d(0, 0, 0);
+ drawString(x, y, string);
+ }
+ /**
* Resets the working attributes of the view
*/
|