Package org.jzy3d.painters
Interface IPainter
-
- All Known Implementing Classes:
AbstractPainter
,EmulGLPainter
,NativeDesktopPainter
,NativeEmbeddedPainter
public interface IPainter
AnIPainter
offers methods for drawing and viewing 3d objects. It draws things by providing a generalization of the OpenGL interface to allow anyDrawable
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()
- GL.glEnable(GL.GL_BLEND) ->
glEnable_Blend()
- GL.glBegin(GL.GL_POLYGON) ->
glBegin_Polygon()
- GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, float[], 0) ->
glMaterial(MaterialProperty, Color, boolean)
Jzy3d naming conventions
- GL.glNormal3f(x,y,z) ->
normal(Coord3d)
- GL.glVertex3f(x,y,z) ->
vertex(Coord3d)
- GL.glColor4f(r,g,b,a) ->
color(Color)
color(Color)
andglColor4f(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 (respectivelyAWTChartFactory
andEmulGLChartFactory
). TheIPainter
is initialized by aView
which provides aCamera
. TheCamera
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 withconfigureGL(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 theIPainter
to the concrete type you are using, and call the accessors as follow. Emulated OpenGL interface- GL gl =
EmulGLPainter.getGL()
; // jGL GL interface - GLU glu =
EmulGLPainter.getGLU()
; // jGL GLU interface - GLUT glut =
EmulGLPainter.getGLUT()
; // jGL GLUT interface
- GL gl =
NativeDeskopPainter#getGL()
; // JOGL GL interface - GLU glu =
NativeDeskopPainter#getGLU()
; // JOGL GLU interface - GLUT glut =
NativeDeskopPainter#getGLUT()
; // JOGL GLUT interface
Text
ThedrawText(Font, String, Coord3d, Color, float)
andgetTextLengthInPixels(Font, String)
are not OpenGL related and specific toIPainter
. They allows to draw 2D text easily and enabling rotation, which may not be supported by allIPainter
implementations (currently only supported with EmulGL). Beside this, all implementation will provide support onglutBitmapString(int, String)
andglutBitmapLength(int, String)
which are the base OpenGL primitives for drawing strings. Note that theView.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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
acquireGL()
In the context of a multithreaded application, this method allows retrieving the GL context for the calling thread.void
box(BoundingBox3d box, Color color, float width, SpaceTransformer spaceTransformer)
A helper to draw a bounding box.void
clearColor(Color color)
void
clip(int plane, ClipEq equation, double value)
A convenient shortcut to glClipPlanevoid
clip(BoundingBox3d box)
A convenient shortcut to glClipPlane that defines the 6 clipping planes according to the min/max values of the bounding box.void
clipOff()
Disable all clipping planesvoid
clipOn()
Enable all clipping planesint
clipPlaneId(int id)
void
color(Color color)
A convenient shortcut to glColor4fvoid
colorAlphaFactor(Color color, float alphaFactor)
A convenient shortcut to glColor4f which multiplies the color's alpha channel by the given factorvoid
colorAlphaOverride(Color color, float alpha)
A convenient shortcut to glColor4f which overrides the color's alpha channelvoid
configureGL(Quality quality)
Apply quality settings as OpenGL commandsvoid
drawImage(ByteBuffer imageBuffer, int imageWidth, int imageHeight, Coord2d pixelZoom, Coord3d imagePosition)
A high level and easy way of drawing images (non OpenGL).void
drawText(Font font, String label, Coord3d position, Color color, float rotation)
A high level and easy way of drawing texts (non OpenGL).Camera
getCamera()
ICanvas
getCanvas()
double[]
getModelViewAsDouble()
float[]
getModelViewAsFloat()
OperatingSystem
getOS()
double[]
getProjectionAsDouble()
float[]
getProjectionAsFloat()
Quality
getQuality()
Return the Quality setting of the chart, which may be different from the one given at theconfigureGL(Quality)
step.int
getTextLengthInPixels(int font, String string)
int
getTextLengthInPixels(Font font, String string)
View
getView()
int[]
getViewPortAsInt()
WindowingToolkit
getWindowingToolkit()
void
glBegin(int type)
void
glBegin_Line()
void
glBegin_LineLoop()
void
glBegin_LineStrip()
void
glBegin_Point()
void
glBegin_Polygon()
void
glBegin_Quad()
void
glBegin_Triangle()
void
glBitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, byte[] bitmap, int bitmap_offset)
void
glBlendFunc(int sfactor, int dfactor)
void
glCallList(int list)
void
glClear(int mask)
void
glClearColor(float red, float green, float blue, float alpha)
void
glClearColorAndDepthBuffers()
void
glClearDepth(double d)
void
glClearStencil(int s)
glClearStencil specifies the index used by glClear to clear the stencil buffer. s is masked with 2 m - 1 , where m is the number of bits in the stencil buffer.void
glClipPlane(int plane, double[] equation)
void
glColor3f(float r, float g, float b)
void
glColor4f(float r, float g, float b, float a)
void
glCullFace(int mode)
void
glCullFace_Front()
void
glDeleteLists(int list, int range)
void
glDepthFunc(int func)
void
glDepthFunc(DepthFunc func)
void
glDepthRangef(float near, float far)
void
glDisable(int type)
void
glDisable_Blend()
void
glDisable_ClipPlane(int plane)
void
glDisable_CullFace()
void
glDisable_DepthTest()
void
glDisable_Light(int light)
void
glDisable_Lighting()
void
glDisable_LineStipple()
void
glDisable_PolygonOffsetFill()
void
glDisable_PolygonOffsetLine()
void
glDisable_Stencil()
void
glDrawPixels(int width, int height, int format, int type, Buffer pixels)
void
glEnable(int type)
void
glEnable_Blend()
void
glEnable_ClipPlane(int plane)
void
glEnable_ColorMaterial()
void
glEnable_CullFace()
void
glEnable_DepthTest()
void
glEnable_Light(int light)
void
glEnable_Lighting()
void
glEnable_LineStipple()
void
glEnable_PointSmooth()
void
glEnable_PolygonOffsetFill()
void
glEnable_PolygonOffsetLine()
void
glEnable_Stencil()
void
glEnd()
void
glEndList()
void
glEvalCoord2f(float u, float v)
void
glFeedbackBuffer(int size, int type, FloatBuffer buffer)
void
glFlush()
void
glFrontFace(int mode)
void
glFrontFace_ClockWise()
void
glFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
int
glGenLists(int range)
void
glGetDoublev(int pname, double[] params, int params_offset)
void
glGetFloatv(int pname, float[] data, int data_offset)
void
glGetIntegerv(int pname, int[] data, int data_offset)
void
glHint(int target, int mode)
void
glHint_PointSmooth_Nicest()
void
glInitNames()
boolean
glIsList(int list)
void
glLight_Ambiant(int lightId, Color ambiantColor)
void
glLight_Diffuse(int lightId, Color diffuseColor)
void
glLight_Position(int lightId, float[] positionZero)
void
glLight_Shininess(int lightId, float value)
void
glLight_Specular(int lightId, Color specularColor)
void
glLightf(int light, int pname, float value)
void
glLightf(int light, Attenuation.Type type, float value)
void
glLightfv(int light, int pname, float[] params, int params_offset)
void
glLightModel(LightModel model, boolean value)
void
glLightModel(LightModel model, Color color)
void
glLightModelfv(int mode, float[] value)
void
glLightModeli(int mode, int value)
void
glLineStipple(int factor, short pattern)
void
glLineWidth(float width)
void
glLoadIdentity()
void
glLoadName(int name)
void
glMap2f(int target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, FloatBuffer points)
void
glMaterial(MaterialProperty material, float[] value, boolean b)
void
glMaterial(MaterialProperty material, Color color, boolean b)
void
glMaterialfv(int face, int pname, float[] params, int params_offset)
void
glMatrixMode(int mode)
void
glMatrixMode_ModelView()
void
glMatrixMode_Projection()
void
glNewList(int list, int mode)
void
glNewList(int list, ListMode compile)
void
glNormal3f(float nx, float ny, float nz)
void
glOrtho(double left, double right, double bottom, double top, double near_val, double far_val)
void
glPassThrough(float token)
void
glPixelStore(PixelStore unpackAlignment, int param)
void
glPixelStorei(int pname, int param)
void
glPixelZoom(float xfactor, float yfactor)
void
glPointSize(float width)
void
glPolygonMode(int frontOrBack, int fill)
void
glPolygonMode(PolygonMode mode, PolygonFill fill)
void
glPolygonOffset(float factor, float units)
void
glPopMatrix()
void
glPopName()
void
glPushMatrix()
void
glPushName(int name)
void
glRasterPos3f(float x, float y, float z)
int
glRenderMode(int mode)
int
glRenderMode(RenderMode mode)
void
glRotatef(float angle, float x, float y, float z)
void
glScalef(float x, float y, float z)
void
glSelectBuffer(int size, IntBuffer buffer)
void
glShadeModel(int mode)
void
glShadeModel(ColorModel colorModel)
void
glShadeModel_Flat()
void
glShadeModel_Smooth()
void
glStencilFunc(StencilFunc func, int ref, int mask)
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis.void
glStencilMask(int mask)
glStencilMask controls the writing of individual bits in the stencil planes.void
glStencilMask_False()
void
glStencilMask_True()
void
glStencilOp(StencilOp fail, StencilOp zfail, StencilOp zpass)
The glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass) contains three options of which we can specify for each option what action to take:void
glTexCoord2f(float s, float t)
void
glTexEnvf(int target, int pname, float param)
void
glTexEnvi(int target, int pname, int param)
void
glTranslatef(float x, float y, float z)
void
gluCylinder(double base, double top, double height, int slices, int stacks)
void
gluDisk(double inner, double outer, int slices, int loops)
void
gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
void
gluOrtho2D(double left, double right, double bottom, double top)
void
gluPerspective(double fovy, double aspect, double zNear, double zFar)
void
gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset)
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)
void
gluSphere(double radius, int slices, int stacks)
int
glutBitmapLength(int font, String string)
void
glutBitmapString(int font, String string)
void
glutBitmapString(Font axisFont, String label, Coord3d p, Color c)
An interface for AWT user, jGL only @since 2.0.0void
glutSolidCube(float size)
void
glutSolidSphere(double radius, int slices, int stacks)
void
glutSolidTeapot(float scale)
void
glutWireTeapot(float scale)
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)
void
glVertex3d(double x, double y, double z)
void
glVertex3f(float x, float y, float z)
void
glViewport(int x, int y, int width, int height)
boolean
isJVMScaleLargerThanNativeScale()
Verify if pixel scale of JVM is different than the one return by the canvasboolean
isJVMScaleLargerThanNativeScale(Coord2d scaleHardware, Coord2d scaleJVM)
void
material(int face, int pname, Color color)
ArrayList<ArrayList<Coord3d>>
modelToScreen(ArrayList<ArrayList<Coord3d>> polygons)
List<Coord3d>
modelToScreen(List<Coord3d> points)
Coord3d
modelToScreen(Coord3d point)
Coord3d[]
modelToScreen(Coord3d[] points)
Coord3d[][]
modelToScreen(Coord3d[][] points)
PolygonArray
modelToScreen(PolygonArray polygon)
PolygonArray[][]
modelToScreen(PolygonArray[][] polygons)
void
normal(Coord3d norm)
A convenient shortcut to glNormal3fvoid
raster(Coord3d coord, SpaceTransformer transform)
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.Coord3d
screenToModel(Coord3d screen)
void
setCamera(Camera camera)
void
setCanvas(ICanvas canvas)
void
setView(View view)
void
transform(Transform transform, boolean loadIdentity)
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 nullvoid
vertex(Coord3d coord)
A convenient shortcut to glVertex3fvoid
vertex(Coord3d coord, SpaceTransformer transform)
A convenient shortcut to glVertex3f, able to apply a space transform in case it is not null
-
-
-
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 callreleaseGL()
-
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)
-
getCanvas
ICanvas getCanvas()
-
setCanvas
void setCanvas(ICanvas canvas)
-
getOS
OperatingSystem getOS()
-
getWindowingToolkit
WindowingToolkit getWindowingToolkit()
-
getQuality
Quality getQuality()
Return the Quality setting of the chart, which may be different from the one given at theconfigureGL(Quality)
step.
-
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
-
box
void box(BoundingBox3d box, Color color, float width, SpaceTransformer spaceTransformer)
A helper to draw a bounding box.
-
clip
void clip(int plane, ClipEq equation, double value)
A convenient shortcut to glClipPlane
-
clip
void clip(BoundingBox3d box)
A convenient shortcut to glClipPlane that defines the 6 clipping planes according to the min/max values of the bounding box. Then requires to enable clipping withclipOn()
.
-
clipOn
void clipOn()
Enable all clipping planes
-
clipOff
void clipOff()
Disable all clipping planes
-
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)
-
raster
void raster(Coord3d coord, SpaceTransformer transform)
-
clearColor
void clearColor(Color color)
-
material
void material(int face, int pname, Color color)
-
glMaterial
void glMaterial(MaterialProperty material, Color color, boolean b)
-
glMaterial
void glMaterial(MaterialProperty material, float[] value, boolean b)
-
getViewPortAsInt
int[] getViewPortAsInt()
-
getProjectionAsDouble
double[] getProjectionAsDouble()
-
getProjectionAsFloat
float[] getProjectionAsFloat()
-
getModelViewAsDouble
double[] getModelViewAsDouble()
-
getModelViewAsFloat
float[] getModelViewAsFloat()
-
modelToScreen
PolygonArray modelToScreen(PolygonArray polygon)
-
modelToScreen
PolygonArray[][] modelToScreen(PolygonArray[][] polygons)
-
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(PolygonMode mode, PolygonFill fill)
-
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)
-
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 allIPainter
-
glOrtho
void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val)
-
gluOrtho2D
void gluOrtho2D(double left, double right, double bottom, double top)
-
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)
-
glClipPlane
void glClipPlane(int plane, double[] equation)
-
glEnable_ClipPlane
void glEnable_ClipPlane(int plane)
-
glDisable_ClipPlane
void glDisable_ClipPlane(int plane)
-
clipPlaneId
int clipPlaneId(int id)
-
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)
-
gluSphere
void gluSphere(double radius, int slices, int stacks)
-
gluCylinder
void gluCylinder(double base, double top, double height, int slices, int stacks)
-
glutSolidSphere
void glutSolidSphere(double radius, int slices, int stacks)
-
glutSolidCube
void glutSolidCube(float size)
-
glutSolidTeapot
void glutSolidTeapot(float scale)
-
glutWireTeapot
void glutWireTeapot(float scale)
-
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)
-
glStencilFunc
void glStencilFunc(StencilFunc func, int ref, int mask)
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. Stencil planes are first drawn into using GL drawing primitives, then geometry and images are rendered using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering. The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the reference value and the value in the stencil buffer. To enable and disable the test, call glEnable and glDisable with argument GL_STENCIL_TEST. To specify actions based on the outcome of the stencil test, call glStencilOp or glStencilOpSeparate. There can be two separate sets of func, ref, and mask parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. glStencilFunc sets both front and back stencil state to the same values. Use glStencilFuncSeparate to set front and back stencil state to different values. func is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. ref is an integer reference value that is used in the stencil comparison. It is clamped to the range 0 2 n - 1 , where n is the number of bitplanes in the stencil buffer. mask is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison. If stencil represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by func. Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see glStencilOp). All tests treat stencil values as unsigned integers in the range 0 2 n - 1 , where n is the number of bitplanes in the stencil buffer. The following values are accepted by func:- GL_NEVER Always fails.
- GL_LESS Passes if ( ref & mask ) < ( stencil & mask ).
- GL_LEQUAL Passes if ( ref & mask ) <= ( stencil & mask ).
- GL_GREATER Passes if ( ref & mask ) > ( stencil & mask ).
- GL_GEQUAL Passes if ( ref & mask ) >= ( stencil & mask ).
- GL_EQUAL Passes if ( ref & mask ) = ( stencil & mask ).
- GL_NOTEQUAL Passes if ( ref & mask ) != ( stencil & mask ).
- GL_ALWAYS Always passes.
- Parameters:
func
- sets the stencil test function that determines whether a fragment passes or is discarded. This test function is applied to the stored stencil value and the glStencilFunc's ref value. Possible options are: GL_NEVER, GL_LESS, GL_LEQUAL, GL_GREATER, GL_GEQUAL, GL_EQUAL, GL_NOTEQUAL and GL_ALWAYS. The semantic meaning of these is similar to the depth buffer's functions.ref
- specifies the reference value for the stencil test. The stencil buffer's content is compared to this value.mask
- specifies a mask that is ANDed with both the reference value and the stored stencil value before the test compares them. Initially set to all 1s.
-
glStencilMask
void glStencilMask(int mask)
glStencilMask controls the writing of individual bits in the stencil planes. The least significant n bits of mask, where n is the number of bits in the stencil buffer, specify a mask. Where a 1 appears in the mask, it's possible to write to the corresponding bit in the stencil buffer. Where a 0 appears, the corresponding bit is write-protected. Initially, all bits are enabled for writing. There can be two separate mask writemasks; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. glStencilMask sets both front and back stencil writemasks to the same values. Use glStencilMaskSeparate to set front and back stencil writemasks to different values.- Parameters:
mask
-
-
glStencilMask_True
void glStencilMask_True()
-
glStencilMask_False
void glStencilMask_False()
-
glStencilOp
void glStencilOp(StencilOp fail, StencilOp zfail, StencilOp zpass)
The glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass) contains three options of which we can specify for each option what action to take:- Parameters:
fail
- action to take if the stencil test fails.zfail
- action to take if the stencil test passes, but the depth test fails.zpass
- action to take if both the stencil and the depth test pass. Then for each of the options you can take any of the following actions:- Action : Description
- GL_KEEP : The currently stored stencil value is kept.
- GL_ZERO : The stencil value is set to 0.
- GL_REPLACE : The stencil value is replaced with the reference value set with glStencilFunc.
- GL_INCR : The stencil value is increased by 1 if it is lower than the maximum value.
- GL_INCR_WRAP : Same as GL_INCR, but wraps it back to 0 as soon as the maximum value is exceeded.
- GL_DECR : The stencil value is decreased by 1 if it is higher than the minimum value.
- GL_DECR_WRAP : Same as GL_DECR, but wraps it to the maximum value if it ends up lower than 0.
- GL_INVERT : Bitwise inverts the current stencil buffer value.
-
glClearStencil
void glClearStencil(int s)
glClearStencil specifies the index used by glClear to clear the stencil buffer. s is masked with 2 m - 1 , where m is the number of bits in the stencil buffer.- Parameters:
s
-
-
glNormal3f
void glNormal3f(float nx, float ny, float nz)
-
glShadeModel
void glShadeModel(int mode)
-
glShadeModel
void glShadeModel(ColorModel colorModel)
-
glShadeModel_Smooth
void glShadeModel_Smooth()
-
glShadeModel_Flat
void glShadeModel_Flat()
-
glLightf
void glLightf(int light, Attenuation.Type type, float value)
-
glLightf
void glLightf(int light, int pname, float value)
-
glLightfv
void glLightfv(int light, int pname, float[] params, int params_offset)
-
glLightModeli
void glLightModeli(int mode, int value)
-
glLightModelfv
void glLightModelfv(int mode, float[] value)
-
glLightModel
void glLightModel(LightModel model, boolean value)
-
glLightModel
void glLightModel(LightModel model, Color color)
-
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)
-
glLight_Shininess
void glLight_Shininess(int lightId, float 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)
-
glEnable_ColorMaterial
void glEnable_ColorMaterial()
-
glEnable_PointSmooth
void glEnable_PointSmooth()
-
glHint_PointSmooth_Nicest
void glHint_PointSmooth_Nicest()
-
glEnable_DepthTest
void glEnable_DepthTest()
-
glDisable_DepthTest
void glDisable_DepthTest()
-
glDepthFunc
void glDepthFunc(DepthFunc func)
-
glEnable_Stencil
void glEnable_Stencil()
-
glDisable_Stencil
void glDisable_Stencil()
-
isJVMScaleLargerThanNativeScale
boolean isJVMScaleLargerThanNativeScale(Coord2d scaleHardware, Coord2d scaleJVM)
-
isJVMScaleLargerThanNativeScale
boolean isJVMScaleLargerThanNativeScale()
Verify if pixel scale of JVM is different than the one return by the canvas
-
-