From 61e26dc00715de679fd6f546bf104c15ee48261a Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Tue, 16 Feb 2021 18:04:55 +0100 Subject: [PATCH] add xyz axes --- src/lsystem/Main.java | 2 ++ src/lsystem/screen/JoglEventListener.java | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lsystem/Main.java b/src/lsystem/Main.java index 91084d2..b0b56d1 100644 --- a/src/lsystem/Main.java +++ b/src/lsystem/Main.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Scanner; import lsystem.screen.MainFrame; +import lsystem.screen.SwingGLCanvas; public class Main { @@ -16,6 +17,7 @@ public class Main { frame.pack(); frame.setVisible(true); + SwingGLCanvas canvas = new SwingGLCanvas(); final Scanner scanner = new Scanner(System.in); String axiom = null; diff --git a/src/lsystem/screen/JoglEventListener.java b/src/lsystem/screen/JoglEventListener.java index 53ca84d..2e342ef 100644 --- a/src/lsystem/screen/JoglEventListener.java +++ b/src/lsystem/screen/JoglEventListener.java @@ -66,11 +66,21 @@ public class JoglEventListener implements GLEventListener { 0.0f, 1.0f, 0.0f ); - gl.glRotatef(angle, 0f, 1f, 0f); + /* gl.glRotatef(angle, 0f, 1f, 0f); gl.glColor3f(1.0f, 0.0f, 0.0f); - glut.glutSolidSphere(1.0f, 20, 20); - + glut.glutSolidSphere(1.0f, 20, 20); */ + gl.glColor3f(1f, 1f, 1f); + gl.glBegin(GL2.GL_LINES); + gl.glVertex3f(0f, 0f, 0f); + gl.glVertex3f(1f, 0f, 0f); + gl.glVertex3f(0f, 0f, 0f); + gl.glVertex3f(0f, 1f, 0f); + gl.glVertex3f(0f, 0f, 0f); + gl.glVertex3f(0f, 0f, 1f); + gl.glEnd(); + gl.glRasterPos3f(1.1f, 0.0f, 0.0f); + glut.glutBitmapCharacter(GLUT.BITMAP_HELVETICA_18, 'X'); angle += 0.1f; angle %= 360f; }