Package jgl.wt.awt

Class GLUT

  • All Implemented Interfaces:
    Runnable

    public class GLUT
    extends Object
    implements Runnable
    GLUT is the glut class of jGL 2.4.
    Version:
    0.3, 10 May 2003
    Author:
    Robin Bing-Yu Chen
    • Constructor Detail

      • GLUT

        public GLUT​(GL myGL)
    • Method Detail

      • glutSetListener

        public void glutSetListener​(GLUTListener listener)
        Sets listener for scene rendering pipeline.
        Parameters:
        listener - Listener that receives callbacks on GL events.
      • glutBitmapString

        public void glutBitmapString​(Font font,
                                     String string,
                                     float x,
                                     float y)
        Print string at the specified 2d position. This method is not following exactly the GLUT interface. Printing text in OpenGL usually requires such code :
         
         gl.glColor3f(r, g, b);
         gl.glRasterPos3f(x, y, z);
         glut.glutBitmapString(font, string);
         
         
        In our case, one need to first perform model-to-screen projection to get x,y coordinates, and then call glutBitmapString.
      • glutBitmapString

        public void glutBitmapString​(Font font,
                                     String string,
                                     float x,
                                     float y,
                                     float z,
                                     float r,
                                     float g,
                                     float b,
                                     float rotate)
        Print string at the specified 3d position. This method is not following exactly the GLUT interface. Printing text in OpenGL usually requires such code :
         
         gl.glColor3f(r, g, b);
         gl.glRasterPos3f(x, y, z);
         glut.glutBitmapString(int font, string);
         
         
        Here we provide a convenient function that does all in one pass
         
         glut.glutBitmapString(java.awt.Font, java.lang.String, x, y, z, r, g, b);
         
         
        Behind the scene it makes the model-to-screen conversion and then provide all data to GL#appendTextToDraw(Font, String, int, int, float, float, float) that will handle the text rendering in GL.glFlush()
      • modelToScreen

        protected double[] modelToScreen​(float x,
                                         float y,
                                         float z)
      • getViewPortAsInt

        protected int[] getViewPortAsInt()
      • getModelViewAsDouble

        protected double[] getModelViewAsDouble()
      • getProjectionAsDouble

        protected double[] getProjectionAsDouble()
      • auxGetGL

        public GL auxGetGL()
      • auxGetGLU

        public GLU auxGetGLU()
      • glutInitWindowPosition

        public void glutInitWindowPosition​(int x,
                                           int y)
        void glutInitWindowPosition (int x, int y)
      • glutInitWindowSize

        public void glutInitWindowSize​(int width,
                                       int height)
        void glutInitWindowSize (int width, int height)
      • glutMainLoop

        public void glutMainLoop()
        void glutMainLoop ()
      • glutCreateWindow

        public void glutCreateWindow​(Component o)
        int glutCreateWindow (const char *title)
      • glutCreateWindow

        public void glutCreateWindow​(Applet o)
      • glutPostRedisplay

        public void glutPostRedisplay()
        void glutPostRedisplay ()
      • glutSwapBuffers

        public void glutSwapBuffers​(Graphics g,
                                    ImageObserver o)
        void glutSwapBuffers ()
      • glutSwapBuffers

        public void glutSwapBuffers​(Graphics g,
                                    Applet o)
      • glutWireSphere

        public void glutWireSphere​(double radius,
                                   int slices,
                                   int stacks)
        void glutWireSphere (GLdouble radius, GLint slices, GLint stacks)
      • glutSolidSphere

        public void glutSolidSphere​(double radius,
                                    int slices,
                                    int stacks)
        void glutSolidSphere (GLdouble radius, GLint slices, GLint stacks)
      • glutWireCone

        public void glutWireCone​(double base,
                                 double height,
                                 int slices,
                                 int stacks)
        void glutWireCone (GLdouble base, GLdouble height, GLint slices, GLint stacks)
      • glutSolidCone

        public void glutSolidCone​(double base,
                                  double height,
                                  int slices,
                                  int stacks)
        void glutSolidCone (GLdouble base, GLdouble height, GLint slices, GLint stacks)
      • glutWireCube

        public void glutWireCube​(double size)
        void glutWireCube (GLdouble size)
      • glutSolidCube

        public void glutSolidCube​(double size)
        void glutSolidCube (GLdouble size)
      • glutWireTorus

        public void glutWireTorus​(double innerRadius,
                                  double outerRadius,
                                  int nsides,
                                  int rings)
        void glutWireTorus (GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings)
      • glutSolidTorus

        public void glutSolidTorus​(double innerRadius,
                                   double outerRadius,
                                   int nsides,
                                   int rings)
        void glutSolidTorus (GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings)
      • glutWireIcosahedron

        public void glutWireIcosahedron()
        void glutWireIcosahedron (void)
      • glutSolidIcosahedron

        public void glutSolidIcosahedron()
        void glutWireIcosahedron (void)
      • glutWireTeapot

        public void glutWireTeapot​(double scale)
        void glutWireTeapot (GLdouble scale)
      • glutSolidTeapot

        public void glutSolidTeapot​(double scale)
        void glutSolidTeapot (GLdouble scale)
      • glutCreateMenu

        public int glutCreateMenu​(String func)
        int glutCreateMenu (void (*)(int))
      • glutDestroyMenu

        public void glutDestroyMenu​(int menu)
        void glutDestroyMenu (int menu)
      • glutGetMenu

        public int glutGetMenu()
        int glutGetMenu (void)
      • glutSetMenu

        public void glutSetMenu​(int menu)
        void glutSetMenu (int menu)
      • glutAddMenuEntry

        public void glutAddMenuEntry​(String label,
                                     int value)
        void glutAddMenuEntry (const char *label, int value)
      • glutAddSubMenu

        public void glutAddSubMenu​(String label,
                                   int submenu)
        void glutAddSubMenu (const char *label, int submenu)
      • glutChangeToMenuEntry

        public void glutChangeToMenuEntry​(int item,
                                          String label,
                                          int value)
        void glutChangeToMenuEntry (int item, const char *label, int value)
      • glutChangeToSubMenu

        public void glutChangeToSubMenu​(int item,
                                        String label,
                                        int submenu)
        void glutChangeToSubMenu (int item, const char *label, int submenu)
      • glutRemoveMenuItem

        public void glutRemoveMenuItem​(int item)
        void glutRemoveMenuItem (int item)
      • glutAttachMenu

        public void glutAttachMenu​(int button)
        void glutAttachMenu (int button)
      • glutDetachMenu

        public void glutDetachMenu​(int button)
        void glutDetachMenu (int button)
      • processEvent

        public void processEvent​(AWTEvent e)
        GLUT window callback sub-API to handle events from canvas, mouse or keyboard.
      • processKeyEvent

        public void processKeyEvent​(KeyEvent e)
      • processMouseEvent

        public void processMouseEvent​(MouseEvent e)
      • glutDisplayFunc

        @Deprecated
        public void glutDisplayFunc​(String func)
        Deprecated.
        Register the name of the JavaComponent method that should be called upon mouse motion. This method should have no argument. void glutDisplayFunc (void (*func)(void))
      • glutReshapeFunc

        @Deprecated
        public void glutReshapeFunc​(String func)
        Deprecated.
        Register the name of the JavaComponent method that should be called upon component resize events. This method should have two int as arguments. void glutReshapeFunc (void (*func)(int width, int height))
      • glutReshapeFunc

        public void glutReshapeFunc​(ReshapeCallback reshapeFunc)
      • glutKeyboardFunc

        @Deprecated
        public void glutKeyboardFunc​(String func)
        Deprecated.
        void glutKeyboardFunc (void (*func)(unsigned char key, int x, int y))
      • glutKeyboardFunc

        public void glutKeyboardFunc​(KeyboardCallback keyboardFunc)
      • glutKeyboardUpFunc

        @Deprecated
        public void glutKeyboardUpFunc​(String func)
        Deprecated.
        void glutKeyboardUpFunc (void (*func)(unsigned char key, int x, int y))
      • glutKeyboardUpFunc

        public void glutKeyboardUpFunc​(KeyboardCallback keyboardFunc)
      • glutSpecialFunc

        @Deprecated
        public void glutSpecialFunc​(String func)
        Deprecated.
      • glutSpecialFunc

        public void glutSpecialFunc​(KeyboardCallback keyboardFunc)
      • glutSpecialUpFunc

        @Deprecated
        public void glutSpecialUpFunc​(String func)
        Deprecated.
        void glutSpecialUpFunc (void (*func)(unsigned char key, int x, int y))
      • glutSpecialUpFunc

        public void glutSpecialUpFunc​(KeyboardCallback keyboardFunc)
      • glutMouseFunc

        @Deprecated
        public void glutMouseFunc​(String func)
        Deprecated.
        Register the name of the JavaComponent method that should be called upon mouse events. This method should have four int as arguments. void glutMouseFunc (void (*func)(int button, int state, int x, int y))
      • glutMouseFunc

        public void glutMouseFunc​(MouseCallback mouseFunc)
      • glutMotionFunc

        @Deprecated
        public void glutMotionFunc​(String func)
        Deprecated.
        Register the name of the JavaComponent method that should be called upon mouse motion. This method should have two int as arguments. void glutMotionFunc (void (*func)(int x, int y))
      • glutMotionFunc

        public void glutMotionFunc​(MotionCallback motionFunc)
      • glutIdleFunc

        @Deprecated
        public void glutIdleFunc​(String func)
        Deprecated.
        void glutIdleFunc (void (*func)(void))
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • glutTimerFunc

        public void glutTimerFunc​(int millis,
                                  String func,
                                  int value)
        void glutTimerFunc (unsigned int millis, void (*func)(int value), int value)
      • glutGetModifiers

        public int glutGetModifiers()
        int glutGetModifiers (void)