Interface IPainter

  • All Known Implementing Classes:
    AbstractPainter, EmulGLPainter, NativeDesktopPainter, NativeEmbeddedPainter

    public interface IPainter
    An IPainter offers methods for drawing and viewing 3d objects. It draws things by providing a generalization of the OpenGL interface to allow any Drawable to be painted. The painter methods are named to both match the OpenGL function naming and also match the Jzy3d primitives (Coord3d, Color, etc)

    OpenGL naming conventions

    Traditional OpenGL methods mapping
    • GL.glBegin() -> IPainter#glBegin()
    • GLU.gluLookAt() -> IPainter#gluLookAt()
    • GLUT.glutBitmapString() -> IPainter#glutBitmapString()
    Traditional OpenGL constants mapping with "_" Traditional OpenGL constants mapping with enums, e.g.

    Jzy3d naming conventions

    NB : note that jzy3d model mapping comes in addition to the existing OpenGL methods : color(Color) and glColor4f(float, float, float, float) are both available.

    Native GL and Emulated GL

    Implementations of this interface may use native rendering (NativeDeskopPainter) or rely on pure java emulation of OpenGL1 (EmulGLPainter). They are instanciated by their factories (respectively AWTChartFactory and EmulGLChartFactory). The IPainter is initialized by a View which provides a Camera. The Camera allows drawing things based on the eye position and orientation. of the painter. Last, there are utility methods for Jzy3d for easily configuring multiple OpenGL settings with configureGL(Quality).
    Using the complete OpenGL interface Note that you may still access the "real" OpenGL interface in case the Painter does not adress your need. To get it, simply downcast the IPainter to the concrete type you are using, and call the accessors as follow. Emulated OpenGL interface Native OpenGL interface
    • GL gl = NativeDeskopPainter#getGL(); // JOGL GL interface
    • GLU glu = NativeDeskopPainter#getGLU(); // JOGL GLU interface
    • GLUT glut = NativeDeskopPainter#getGLUT(); // JOGL GLUT interface

    Text

    The drawText(Font, String, Coord3d, Color, float) and getTextLengthInPixels(Font, String) are not OpenGL related and specific to IPainter. They allows to draw 2D text easily and enabling rotation, which may not be supported by all IPainter implementations (currently only supported with EmulGL). Beside this, all implementation will provide support on glutBitmapString(int, String) and glutBitmapLength(int, String) which are the base OpenGL primitives for drawing strings. Note that the View.configureHiDPIListener(org.jzy3d.plot3d.rendering.canvas.ICanvas) will adapt the text size according to HiDPI to ensure text does not appear to small on high resolution screens.
    • Method Detail

      • acquireGL

        Object acquireGL()
        In the context of a multithreaded application, this method allows retrieving the GL context for the calling thread. Once work is done the caller should call releaseGL()
      • releaseGL

        void releaseGL()
        In the context of a multithreaded application, this method allows releasing the GL context by the calling thread to let other thread use it. acquireGL()
      • getCamera

        Camera getCamera()
      • setCamera

        void setCamera​(Camera camera)
      • getView

        View getView()
      • setView

        void setView​(View view)
      • setCanvas

        void setCanvas​(ICanvas canvas)
      • configureGL

        void configureGL​(Quality quality)
        Apply quality settings as OpenGL commands
      • normal

        void normal​(Coord3d norm)
        A convenient shortcut to glNormal3f
      • vertex

        void vertex​(Coord3d coord)
        A convenient shortcut to glVertex3f
      • vertex

        void vertex​(Coord3d coord,
                    SpaceTransformer transform)
        A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null
      • vertex

        void vertex​(float x,
                    float y,
                    float z,
                    SpaceTransformer transform)
        A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null
      • color

        void color​(Color color)
        A convenient shortcut to glColor4f
      • colorAlphaOverride

        void colorAlphaOverride​(Color color,
                                float alpha)
        A convenient shortcut to glColor4f which overrides the color's alpha channel
      • colorAlphaFactor

        void colorAlphaFactor​(Color color,
                              float alphaFactor)
        A convenient shortcut to glColor4f which multiplies the color's alpha channel by the given factor
      • transform

        void transform​(Transform transform,
                       boolean loadIdentity)
      • clearColor

        void clearColor​(Color color)
      • material

        void material​(int face,
                      int pname,
                      Color color)
      • glMaterial

        void glMaterial​(MaterialProperty material,
                        float[] value,
                        boolean b)
      • getViewPortAsInt

        int[] getViewPortAsInt()
      • getProjectionAsDouble

        double[] getProjectionAsDouble()
      • getProjectionAsFloat

        float[] getProjectionAsFloat()
      • getModelViewAsDouble

        double[] getModelViewAsDouble()
      • getModelViewAsFloat

        float[] getModelViewAsFloat()
      • glLoadIdentity

        void glLoadIdentity()
      • glPushMatrix

        void glPushMatrix()
      • glPopMatrix

        void glPopMatrix()
      • glMatrixMode

        void glMatrixMode​(int mode)
      • glScalef

        void glScalef​(float x,
                      float y,
                      float z)
      • glTranslatef

        void glTranslatef​(float x,
                          float y,
                          float z)
      • glRotatef

        void glRotatef​(float angle,
                       float x,
                       float y,
                       float z)
      • glDepthFunc

        void glDepthFunc​(int func)
      • glDepthRangef

        void glDepthRangef​(float near,
                           float far)
      • glBlendFunc

        void glBlendFunc​(int sfactor,
                         int dfactor)
      • glBegin

        void glBegin​(int type)
      • glEnd

        void glEnd()
      • glColor3f

        void glColor3f​(float r,
                       float g,
                       float b)
      • glColor4f

        void glColor4f​(float r,
                       float g,
                       float b,
                       float a)
      • glVertex3f

        void glVertex3f​(float x,
                        float y,
                        float z)
      • glVertex3d

        void glVertex3d​(double x,
                        double y,
                        double z)
      • glEnable

        void glEnable​(int type)
      • glDisable

        void glDisable​(int type)
      • glFrontFace

        void glFrontFace​(int mode)
      • glCullFace

        void glCullFace​(int mode)
      • glPolygonMode

        void glPolygonMode​(int frontOrBack,
                           int fill)
      • glPolygonOffset

        void glPolygonOffset​(float factor,
                             float units)
      • glLineStipple

        void glLineStipple​(int factor,
                           short pattern)
      • glLineWidth

        void glLineWidth​(float width)
      • glPointSize

        void glPointSize​(float width)
      • glTexCoord2f

        void glTexCoord2f​(float s,
                          float t)
      • glTexEnvf

        void glTexEnvf​(int target,
                       int pname,
                       float param)
      • glTexEnvi

        void glTexEnvi​(int target,
                       int pname,
                       int param)
      • glGenLists

        int glGenLists​(int range)
      • glNewList

        void glNewList​(int list,
                       int mode)
      • glNewList

        void glNewList​(int list,
                       ListMode compile)
      • glEndList

        void glEndList()
      • glCallList

        void glCallList​(int list)
      • glIsList

        boolean glIsList​(int list)
      • glDeleteLists

        void glDeleteLists​(int list,
                           int range)
      • glDrawPixels

        void glDrawPixels​(int width,
                          int height,
                          int format,
                          int type,
                          Buffer pixels)
      • glPixelZoom

        void glPixelZoom​(float xfactor,
                         float yfactor)
      • glPixelStorei

        void glPixelStorei​(int pname,
                           int param)
      • glPixelStore

        void glPixelStore​(PixelStore unpackAlignment,
                          int param)
      • glRasterPos3f

        void glRasterPos3f​(float x,
                           float y,
                           float z)
      • glBitmap

        void glBitmap​(int width,
                      int height,
                      float xorig,
                      float yorig,
                      float xmove,
                      float ymove,
                      byte[] bitmap,
                      int bitmap_offset)
      • drawImage

        void drawImage​(ByteBuffer imageBuffer,
                       int imageWidth,
                       int imageHeight,
                       Coord2d pixelZoom,
                       Coord3d imagePosition)
        A high level and easy way of drawing images (non OpenGL).
      • glutBitmapString

        void glutBitmapString​(int font,
                              String string)
      • glutBitmapLength

        int glutBitmapLength​(int font,
                             String string)
      • glutBitmapString

        void glutBitmapString​(Font axisFont,
                              String label,
                              Coord3d p,
                              Color c)
        An interface for AWT user, jGL only @since 2.0.0
      • getTextLengthInPixels

        int getTextLengthInPixels​(int font,
                                  String string)
      • getTextLengthInPixels

        int getTextLengthInPixels​(Font font,
                                  String string)
      • drawText

        void drawText​(Font font,
                      String label,
                      Coord3d position,
                      Color color,
                      float rotation)
        A high level and easy way of drawing texts (non OpenGL). Rotation may not be supported by all IPainter
      • glOrtho

        void glOrtho​(double left,
                     double right,
                     double bottom,
                     double top,
                     double near_val,
                     double far_val)
      • gluPerspective

        void gluPerspective​(double fovy,
                            double aspect,
                            double zNear,
                            double zFar)
      • glFrustum

        void glFrustum​(double left,
                       double right,
                       double bottom,
                       double top,
                       double zNear,
                       double zFar)
      • gluLookAt

        void gluLookAt​(float eyeX,
                       float eyeY,
                       float eyeZ,
                       float centerX,
                       float centerY,
                       float centerZ,
                       float upX,
                       float upY,
                       float upZ)
      • glViewport

        void glViewport​(int x,
                        int y,
                        int width,
                        int height)
      • gluUnProject

        boolean gluUnProject​(float winX,
                             float winY,
                             float winZ,
                             float[] model,
                             int model_offset,
                             float[] proj,
                             int proj_offset,
                             int[] view,
                             int view_offset,
                             float[] objPos,
                             int objPos_offset)
      • gluProject

        boolean gluProject​(float objX,
                           float objY,
                           float objZ,
                           float[] model,
                           int model_offset,
                           float[] proj,
                           int proj_offset,
                           int[] view,
                           int view_offset,
                           float[] winPos,
                           int winPos_offset)
      • gluDisk

        void gluDisk​(double inner,
                     double outer,
                     int slices,
                     int loops)
      • glutSolidSphere

        void glutSolidSphere​(double radius,
                             int slices,
                             int stacks)
      • gluSphere

        void gluSphere​(double radius,
                       int slices,
                       int stacks)
      • gluCylinder

        void gluCylinder​(double base,
                         double top,
                         double height,
                         int slices,
                         int stacks)
      • glutSolidCube

        void glutSolidCube​(float size)
      • glFeedbackBuffer

        void glFeedbackBuffer​(int size,
                              int type,
                              FloatBuffer buffer)
      • glRenderMode

        int glRenderMode​(int mode)
      • glRenderMode

        int glRenderMode​(RenderMode mode)
      • glPassThrough

        void glPassThrough​(float token)
      • glGetIntegerv

        void glGetIntegerv​(int pname,
                           int[] data,
                           int data_offset)
      • glGetDoublev

        void glGetDoublev​(int pname,
                          double[] params,
                          int params_offset)
      • glGetFloatv

        void glGetFloatv​(int pname,
                         float[] data,
                         int data_offset)
      • glNormal3f

        void glNormal3f​(float nx,
                        float ny,
                        float nz)
      • glShadeModel

        void glShadeModel​(int mode)
      • glLightfv

        void glLightfv​(int light,
                       int pname,
                       float[] params,
                       int params_offset)
      • glLightModeli

        void glLightModeli​(int mode,
                           int value)
      • glLightModel

        void glLightModel​(LightModel model,
                          boolean value)
      • glMaterialfv

        void glMaterialfv​(int face,
                          int pname,
                          float[] params,
                          int params_offset)
      • glHint

        void glHint​(int target,
                    int mode)
      • glClearColor

        void glClearColor​(float red,
                          float green,
                          float blue,
                          float alpha)
      • glClearDepth

        void glClearDepth​(double d)
      • glClear

        void glClear​(int mask)
      • glClearColorAndDepthBuffers

        void glClearColorAndDepthBuffers()
      • glInitNames

        void glInitNames()
      • glLoadName

        void glLoadName​(int name)
      • glPushName

        void glPushName​(int name)
      • glPopName

        void glPopName()
      • glSelectBuffer

        void glSelectBuffer​(int size,
                            IntBuffer buffer)
      • gluPickMatrix

        void gluPickMatrix​(double x,
                           double y,
                           double delX,
                           double delY,
                           int[] viewport,
                           int viewport_offset)
      • glFlush

        void glFlush()
      • glEvalCoord2f

        void glEvalCoord2f​(float u,
                           float v)
      • glMap2f

        void glMap2f​(int target,
                     float u1,
                     float u2,
                     int ustride,
                     int uorder,
                     float v1,
                     float v2,
                     int vstride,
                     int vorder,
                     FloatBuffer points)
      • glEnable_Blend

        void glEnable_Blend()
      • glDisable_Blend

        void glDisable_Blend()
      • glMatrixMode_ModelView

        void glMatrixMode_ModelView()
      • glMatrixMode_Projection

        void glMatrixMode_Projection()
      • glBegin_Polygon

        void glBegin_Polygon()
      • glBegin_Quad

        void glBegin_Quad()
      • glBegin_Triangle

        void glBegin_Triangle()
      • glBegin_Point

        void glBegin_Point()
      • glBegin_LineStrip

        void glBegin_LineStrip()
      • glBegin_LineLoop

        void glBegin_LineLoop()
      • glBegin_Line

        void glBegin_Line()
      • glEnable_LineStipple

        void glEnable_LineStipple()
      • glDisable_LineStipple

        void glDisable_LineStipple()
      • glEnable_PolygonOffsetFill

        void glEnable_PolygonOffsetFill()
      • glDisable_PolygonOffsetFill

        void glDisable_PolygonOffsetFill()
      • glEnable_PolygonOffsetLine

        void glEnable_PolygonOffsetLine()
      • glDisable_PolygonOffsetLine

        void glDisable_PolygonOffsetLine()
      • glEnable_CullFace

        void glEnable_CullFace()
      • glDisable_CullFace

        void glDisable_CullFace()
      • glFrontFace_ClockWise

        void glFrontFace_ClockWise()
      • glCullFace_Front

        void glCullFace_Front()
      • glDisable_Lighting

        void glDisable_Lighting()
      • glEnable_Lighting

        void glEnable_Lighting()
      • glEnable_Light

        void glEnable_Light​(int light)
      • glDisable_Light

        void glDisable_Light​(int light)
      • glLight_Position

        void glLight_Position​(int lightId,
                              float[] positionZero)
      • glLight_Ambiant

        void glLight_Ambiant​(int lightId,
                             Color ambiantColor)
      • glLight_Diffuse

        void glLight_Diffuse​(int lightId,
                             Color diffuseColor)
      • glLight_Specular

        void glLight_Specular​(int lightId,
                              Color specularColor)
      • glEnable_ColorMaterial

        void glEnable_ColorMaterial()
      • glEnable_PointSmooth

        void glEnable_PointSmooth()
      • glHint_PointSmooth_Nicest

        void glHint_PointSmooth_Nicest()