Package org.lwjgl.opengl
Class PixelFormat
java.lang.Object
org.lwjgl.opengl.PixelFormat
- All Implemented Interfaces:
PixelFormatLWJGL
This class describes pixel format properties for an OpenGL context. Instances
of this class is used as arguments to Display.create(), Pbuffer.create() and
AWTGLCanvas, to indicate minimum required properties.
Instants of this class are immutable. An example of the expected way to set
the PixelFormat property values is the following:
PixelFormat pf = new PixelFormat().withDepthBits(24).withSamples(4).withSRGB(true);
WARNING: Some pixel formats are known to cause troubles on certain buggy drivers.
Example: Under Windows, specifying samples != 0 will enable the ARB
pixel format selection path, which could trigger a crash.- Version:
- $Revision$
- Author:
- elias_naur@sourceforge.net
-
Constructor Summary
ConstructorsConstructorDescriptionDefault pixel format is minimum 8 bits depth, and no alpha nor stencil requirements.PixelFormat
(int alpha, int depth, int stencil) PixelFormat
(int alpha, int depth, int stencil, int samples) PixelFormat
(int bpp, int alpha, int depth, int stencil, int samples) PixelFormat
(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo) PixelFormat
(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo, boolean floating_point) -
Method Summary
Modifier and TypeMethodDescriptionint
int
int
int
int
int
int
int
boolean
boolean
isSRGB()
boolean
isStereo()
withAccumulationAlpha
(int accum_alpha) Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits in the accumulation buffer value.withAccumulationBitsPerPixel
(int accum_bpp) Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel in the accumulation buffer value.withAlphaBits
(int alpha) Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits value.withAuxBuffers
(int num_aux_buffers) Returns a new PixelFormat object with the same properties as this PixelFormat and the new auxiliary buffers value.withBitsPerPixel
(int bpp) Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel value.withCoverageSamples
(int colorSamples) Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples values.withCoverageSamples
(int colorSamples, int coverageSamples) Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples and coverage samples values.withDepthBits
(int depth) Returns a new PixelFormat object with the same properties as this PixelFormat and the new depth bits value.withFloatingPoint
(boolean floating_point) Returns a new PixelFormat object with the same properties as this PixelFormat and the new floating point value.withFloatingPointPacked
(boolean floating_point_packed) Returns a new PixelFormat object with the same properties as this PixelFormat and the new packed floating point value.withSamples
(int samples) Returns a new PixelFormat object with the same properties as this PixelFormat and the new samples value.withSRGB
(boolean sRGB) Returns a new PixelFormat object with the same properties as this PixelFormat and the new sRGB value.withStencilBits
(int stencil) Returns a new PixelFormat object with the same properties as this PixelFormat and the new stencil bits value.withStereo
(boolean stereo) Returns a new PixelFormat object with the same properties as this PixelFormat and the new stereo value.
-
Constructor Details
-
PixelFormat
public PixelFormat()Default pixel format is minimum 8 bits depth, and no alpha nor stencil requirements. -
PixelFormat
public PixelFormat(int alpha, int depth, int stencil) -
PixelFormat
public PixelFormat(int alpha, int depth, int stencil, int samples) -
PixelFormat
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples) -
PixelFormat
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo) -
PixelFormat
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo, boolean floating_point)
-
-
Method Details
-
getBitsPerPixel
public int getBitsPerPixel() -
withBitsPerPixel
Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel value.- Parameters:
bpp
- the new bits per pixel value.- Returns:
- the new PixelFormat
-
getAlphaBits
public int getAlphaBits() -
withAlphaBits
Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits value.- Parameters:
alpha
- the new alpha bits value.- Returns:
- the new PixelFormat
-
getDepthBits
public int getDepthBits() -
withDepthBits
Returns a new PixelFormat object with the same properties as this PixelFormat and the new depth bits value.- Parameters:
depth
- the new depth bits value.- Returns:
- the new PixelFormat
-
getStencilBits
public int getStencilBits() -
withStencilBits
Returns a new PixelFormat object with the same properties as this PixelFormat and the new stencil bits value.- Parameters:
stencil
- the new stencil bits value.- Returns:
- the new PixelFormat
-
getSamples
public int getSamples() -
withSamples
Returns a new PixelFormat object with the same properties as this PixelFormat and the new samples value.- Parameters:
samples
- the new samples value.- Returns:
- the new PixelFormat
-
withCoverageSamples
Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples values. A value greater than 0 is valid only if thesamples
property is also greater than 0. Additionally, the color samples value needs to be lower than or equal to thesamples
property.- Parameters:
colorSamples
- the new color samples value.- Returns:
- the new PixelFormat
-
withCoverageSamples
Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples and coverage samples values.- Parameters:
colorSamples
- the new color samples value. This value must be lower than or equal to the coverage samples value.coverageSamples
- the new coverage samples value.- Returns:
- the new PixelFormat
-
getAuxBuffers
public int getAuxBuffers() -
withAuxBuffers
Returns a new PixelFormat object with the same properties as this PixelFormat and the new auxiliary buffers value.- Parameters:
num_aux_buffers
- the new auxiliary buffers value.- Returns:
- the new PixelFormat
-
getAccumulationBitsPerPixel
public int getAccumulationBitsPerPixel() -
withAccumulationBitsPerPixel
Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel in the accumulation buffer value.- Parameters:
accum_bpp
- the new bits per pixel in the accumulation buffer value.- Returns:
- the new PixelFormat
-
getAccumulationAlpha
public int getAccumulationAlpha() -
withAccumulationAlpha
Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits in the accumulation buffer value.- Parameters:
accum_alpha
- the new alpha bits in the accumulation buffer value.- Returns:
- the new PixelFormat
-
isStereo
public boolean isStereo() -
withStereo
Returns a new PixelFormat object with the same properties as this PixelFormat and the new stereo value.- Parameters:
stereo
- the new stereo value.- Returns:
- the new PixelFormat
-
isFloatingPoint
public boolean isFloatingPoint() -
withFloatingPoint
Returns a new PixelFormat object with the same properties as this PixelFormat and the new floating point value. If floating_point is true, floating_point_packed will be reset to false.- Parameters:
floating_point
- the new floating point value.- Returns:
- the new PixelFormat
-
withFloatingPointPacked
Returns a new PixelFormat object with the same properties as this PixelFormat and the new packed floating point value. If floating_point_packed is true, floating_point will be reset to false.- Parameters:
floating_point_packed
- the new packed floating point value.- Returns:
- the new PixelFormat
-
isSRGB
public boolean isSRGB() -
withSRGB
Returns a new PixelFormat object with the same properties as this PixelFormat and the new sRGB value.- Parameters:
sRGB
- the new floating point value.- Returns:
- the new PixelFormat
-