|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.rendering.r3d.opengl.JOGLUtils
public class JOGLUtils
JOGL-related utility methods.
Constructor Summary | |
---|---|
JOGLUtils()
|
Method Summary | |
---|---|
static int |
convertBytesToARGBInt(byte[] color)
Create an int value ([a]rgb) from the given color array (rgb[a]), the result can be used for buffered images. |
static int |
convertBytesToRGBInt(byte[] color)
Create an int value (rgb) from the given color array (rgb), the result can be used for buffered images. |
static float[] |
convertColorFloats(Color color)
Create an a float array from the given color object, which can be used for rendering with jogl. |
static int |
convertColorGLColor(Color color)
Create an int with rgba from the given color (which returns the argb values). |
static float[] |
convertColorIntAsFloats(int color)
The float array appropriate for opengl. |
static float[] |
getEyeFromModelView(javax.media.opengl.GL gl)
Calculate the eye position from the given modelview, note, no scale may be applied. |
static ByteBuffer |
getFrameBufferRGB(javax.media.opengl.GL glContext,
ByteBuffer imageBuffer,
int viewPortX,
int viewPortY,
int width,
int height)
Read the framebuffer's rgb values and place them into a ByteBuffer . |
static BufferedImage |
getFrameBufferRGB(javax.media.opengl.GL glContext,
ByteBuffer imageBuffer,
int viewPortX,
int viewPortY,
int width,
int height,
BufferedImage resultImage)
Read the framebuffer's rgb values and place them into a BufferedImage . |
static ByteBuffer |
getFrameBufferRGBA(javax.media.opengl.GL glContext,
ByteBuffer imageBuffer,
int viewPortX,
int viewPortY,
int width,
int height)
Read the framebuffer's rgba values and place them into a ByteBuffer . |
static BufferedImage |
getFrameBufferRGBA(javax.media.opengl.GL glContext,
ByteBuffer imageBuffer,
int viewPortX,
int viewPortY,
int width,
int height,
BufferedImage resultImage)
Read the framebuffer's rgb values and place them into a BufferedImage . |
static int |
getMaxTextureSize(javax.media.opengl.GL gl)
Returns maximum texture size support by the GL driver. |
static String |
getMVAsString(javax.media.opengl.GL gl)
Get a string representation of the current modelview matrix of the given context. |
static int |
getNumTextureImageUnits(javax.media.opengl.GL gl)
Returns the number of texture image units that can be used in fragment shaders. |
static String |
getProjectionAsString(javax.media.opengl.GL gl)
Get a string representation of the current Projection matrix of the given context. |
static int |
getTextureUnitConst(int textureId)
Returns the value of the symbolic constant TEXTURE0...TEXTURE31 for a certain texture unit id. |
static String |
outputMatrix(javax.media.opengl.GL gl,
int GL_MATRIX_TYPE)
Get a string representation of the given matrix type of the given context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JOGLUtils()
Method Detail |
---|
public static int getMaxTextureSize(javax.media.opengl.GL gl)
gl
-
public static int getNumTextureImageUnits(javax.media.opengl.GL gl)
NOTE: This method evaluates the value of GL_MAX_TEXTURE_IMAGE_UNITS
. The number is usually not
identical to GL_MAX_TEXTURE_UNITS
which denotes the maximum number of texture units in fixed shader
functions.
gl
-
public static int getTextureUnitConst(int textureId)
textureId
- id of the requested texture unit (0...31)
public static String getMVAsString(javax.media.opengl.GL gl)
gl
-
public static String getProjectionAsString(javax.media.opengl.GL gl)
gl
-
public static String outputMatrix(javax.media.opengl.GL gl, int GL_MATRIX_TYPE)
gl
- GL_MATRIX_TYPE
- one of GL.GL_MODELVIEW_MATRIX
, GL.GL_PROJECTION_MATRIX
public static float[] getEyeFromModelView(javax.media.opengl.GL gl)
gl
- to get the modelview from.
public static int convertColorGLColor(Color color)
color
- to be converted.
public static float[] convertColorFloats(Color color)
color
- to be converted.
public static float[] convertColorIntAsFloats(int color)
color
- (rgba) to be converted into a float arra.
public static int convertBytesToARGBInt(byte[] color)
color
- to be converted may be of length 3 or 4, not null
.
public static int convertBytesToRGBInt(byte[] color)
color
- to be converted may be only be of length 3, not null
.
public static ByteBuffer getFrameBufferRGBA(javax.media.opengl.GL glContext, ByteBuffer imageBuffer, int viewPortX, int viewPortY, int width, int height)
ByteBuffer
. If the resultImage was
null
or it's height or width are to small a new ByteBuffer is created.
glContext
- to get the image from.imageBuffer
- to write the framebuffer to.viewPortX
- the x location in the framebuffer.viewPortY
- the y location in the framebuffer.width
- of read in the framebuffer.height
- of read in the framebuffer.
public static BufferedImage getFrameBufferRGBA(javax.media.opengl.GL glContext, ByteBuffer imageBuffer, int viewPortX, int viewPortY, int width, int height, BufferedImage resultImage)
BufferedImage
. If the resultImage was
null
or it's height or width are to small a new BufferedImage is created. The resultImage type is
supposed to be BufferedImage.TYPE_INT_RGB
.
glContext
- to get the image from.imageBuffer
- to write the framebuffer to.viewPortX
- the x location in the framebuffer.viewPortY
- the y location in the framebuffer.width
- of read in the framebuffer.height
- of read in the framebuffer.resultImage
- which will hold the result, may be null
public static ByteBuffer getFrameBufferRGB(javax.media.opengl.GL glContext, ByteBuffer imageBuffer, int viewPortX, int viewPortY, int width, int height)
ByteBuffer
. If the resultImage was
null
or it's height or width are to small a new ByteBuffer is created.
glContext
- to get the image from.imageBuffer
- to write the framebuffer to.viewPortX
- the x location in the framebuffer.viewPortY
- the y location in the framebuffer.width
- of read in the framebuffer.height
- of read in the framebuffer.
public static BufferedImage getFrameBufferRGB(javax.media.opengl.GL glContext, ByteBuffer imageBuffer, int viewPortX, int viewPortY, int width, int height, BufferedImage resultImage)
BufferedImage
. If the resultImage was
null
or it's height or width are to small a new BufferedImage is created. The resultImage type is
supposed to be BufferedImage.TYPE_INT_RGB
.
glContext
- to get the image from.imageBuffer
- to write the framebuffer to.viewPortX
- the x location in the framebuffer.viewPortY
- the y location in the framebuffer.width
- of read in the framebuffer.height
- of read in the framebuffer.resultImage
- which will hold the result, may be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |