From 880653d31a8f1ff8384fdbc75b84934bceecfdb8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 18 Nov 2000 06:43:49 +0000 Subject: Initial revision --- demos/MiscDemos/glutFontBitmapTest2Applet.java | 319 +++++++++++++++++++++++++ 1 file changed, 319 insertions(+) create mode 100644 demos/MiscDemos/glutFontBitmapTest2Applet.java (limited to 'demos/MiscDemos/glutFontBitmapTest2Applet.java') diff --git a/demos/MiscDemos/glutFontBitmapTest2Applet.java b/demos/MiscDemos/glutFontBitmapTest2Applet.java new file mode 100644 index 0000000..0985385 --- /dev/null +++ b/demos/MiscDemos/glutFontBitmapTest2Applet.java @@ -0,0 +1,319 @@ + +import gl4java.*; +import gl4java.awt.*; +import gl4java.utils.textures.*; +import gl4java.utils.glut.*; +import gl4java.utils.glut.fonts.*; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; +import java.net.*; + +public class glutFontBitmapTest2Applet extends Applet +{ + glutFontBitmapTest2 canvas = null; + + public void init() + { + Dimension d = getSize(); + setLayout(new BorderLayout()); + canvas = new glutFontBitmapTest2 (d.width, d.height); + add("Center", canvas); + } + + public void start() + { + } + + + public void stop() + { + } + + public static void main( String args[] ) + { + Frame mainFrame = new Frame("font test 2"); + + glutFontBitmapTest2Applet applet = + new glutFontBitmapTest2Applet(); + + applet.setSize(400, 400); + applet.init(); + applet.start(); + + mainFrame.add(applet); + + mainFrame.pack(); + mainFrame.setVisible(true); + } + + class glutFontBitmapTest2 extends GLCanvas + implements MouseListener,MouseMotionListener + { + float []mPosObjTrans; + float []mPosObjRot; + + Point mousePoint; + Point oldMousePoint; + boolean mouseMoveFlag; + + protected GLUTFunc glut = null; + + int texName[] = {0}; + + public glutFontBitmapTest2 (int w, int h) + { + super(w, h); + } + + public void init() + { + glut = new GLUTFuncLightImplWithFonts(gl, glu); + + // cameraMatrix init + mPosObjTrans=new float[16]; + for(int i=0;i<16;i++) + mPosObjTrans[i]=0f; + mPosObjTrans[0]=mPosObjTrans[5]=mPosObjTrans[10]=mPosObjTrans[15]=1f; + + mPosObjRot=new float[16]; + for(int i=0;i<16;i++) + mPosObjRot[i]=0f; + mPosObjRot[0]=mPosObjRot[5]=mPosObjRot[10]=mPosObjRot[15]=1f; + + TranlateObj(0f,0f,-10f); + + gl.glShadeModel (GL_SMOOTH); + gl.glEnable(GL_DEPTH_TEST); + + gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f); + gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glj.gljCheckGL(); + + canvas.addMouseListener(this); + canvas.addMouseMotionListener(this); + mouseMoveFlag=false; + + reshape(getSize().width, getSize().height); + } + + public void display() + { + int i; + + /* Standard GL4Java Init */ + if( glj.gljMakeCurrent() == false ) + { + System.out.println("problem in use() method"); + return; + } + + // just render it + gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + SetCamera(); + + DrawScene(); + + /* For your animation dutys ;-) */ + glj.gljSwap(); + glj.gljCheckGL(); + glj.gljFree(); + } + + public void reshape(int w, int h) + { + gl.glMatrixMode (GL_MODELVIEW); + gl.glViewport (0, 0, w, h); + gl.glLoadIdentity(); + SetCamera(); + } + + + public void drawGrid(float x0, float y0, + float width, float height, float step) + { + float i,j; + + /* draw grid */ + gl.glBegin(GL_LINES); + for(i=x0;i