Top Description Fields Constructors Methods
org.lwjgl.opengl

public final Class PixelFormat

extends Object
implements PixelFormatLWJGL
Class Inheritance
All Implemented Interfaces
org.lwjgl.opengl.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.

Author
[email protected]
Version
$Revision$

Field Summary

Modifier and TypeField and Description
private int
accum_alpha

The number of alpha bits in the accumulation buffer

private int
accum_bpp

The number of bits per pixel in the accumulation buffer

private int
alpha

The number of alpha bits.

private int
bpp

The number of bits per pixel, exluding alpha.

private int
colorSamples

The number of COLOR_SAMPLES_NV to use for Coverage Sample Anti-aliasing (CSAA).

private int
depth

The number of depth buffer bits

private boolean
floating_point

Whether this format specifies a floating point format

private boolean
floating_point_packed

Whether this format specifies a packed floating point format (32 bit unsigned - R11F_G11F_B10F) This property is currently a no-op for the MacOS implementation.

private int
num_aux_buffers

The number of auxiliary buffers

private int
samples

The number of samples to use in anti-aliasing.

private boolean
sRGB

Whether this format specifies an sRGB format This property is currently a no-op for the MacOS implementation.

private int
stencil

The number of stencil bits

private boolean
stereo

Whether this format requires a stereo buffer

Constructor Summary

AccessConstructor and Description
public
PixelFormat()

Default pixel format is minimum 8 bits depth, and no alpha nor stencil requirements.

public
PixelFormat(int alpha, int depth, int stencil)

public
PixelFormat(int alpha, int depth, int stencil, int samples)

public
PixelFormat(int bpp, int alpha, int depth, int stencil, int samples)

public
PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo)

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)

private

Method Summary

Modifier and TypeMethod and Description
public int
public int
public int
public int
public int
public int
public int
public int
public boolean
public boolean
public boolean
public PixelFormat

Returns:

the new PixelFormat
withAccumulationAlpha
(final int
the new alpha bits in the accumulation buffer value.
accum_alpha
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits in the accumulation buffer value.

public PixelFormat

Returns:

the new PixelFormat
withAccumulationBitsPerPixel
(final int
the new bits per pixel in the accumulation buffer value.
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.

public PixelFormat

Returns:

the new PixelFormat
withAlphaBits
(final int
the new alpha bits value.
alpha
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits value.

public PixelFormat

Returns:

the new PixelFormat
withAuxBuffers
(final int
the new auxiliary buffers value.
num_aux_buffers
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new auxiliary buffers value.

public PixelFormat

Returns:

the new PixelFormat
withBitsPerPixel
(final int
the new bits per pixel value.
bpp
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel value.

public PixelFormat

Returns:

the new PixelFormat
withCoverageSamples
(final int
the new color samples value.
colorSamples
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples values.

public PixelFormat

Returns:

the new PixelFormat
withCoverageSamples
(final int
the new color samples value. This value must be lower than or equal to the coverage samples value.
colorSamples
,
final int
the new coverage samples value.
coverageSamples
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples and coverage samples values.

public PixelFormat

Returns:

the new PixelFormat
withDepthBits
(final int
the new depth bits value.
depth
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new depth bits value.

public PixelFormat

Returns:

the new PixelFormat
withFloatingPoint
(final boolean
the new floating point value.
floating_point
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new floating point value.

public PixelFormat

Returns:

the new PixelFormat
withFloatingPointPacked
(final boolean
the new packed floating point value.
floating_point_packed
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new packed floating point value.

public PixelFormat

Returns:

the new PixelFormat
withSamples
(final int
the new samples value.
samples
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new samples value.

public PixelFormat

Returns:

the new PixelFormat
withSRGB
(final boolean
the new floating point value.
sRGB
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new sRGB value.

public PixelFormat

Returns:

the new PixelFormat
withStencilBits
(final int
the new stencil bits value.
stencil
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new stencil bits value.

public PixelFormat

Returns:

the new PixelFormat
withStereo
(final boolean
the new stereo value.
stereo
)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new stereo value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accum_alphaback to summary
private int accum_alpha

The number of alpha bits in the accumulation buffer

accum_bppback to summary
private int accum_bpp

The number of bits per pixel in the accumulation buffer

alphaback to summary
private int alpha

The number of alpha bits.

bppback to summary
private int bpp

The number of bits per pixel, exluding alpha. This parameter is ignored in Display.create().

colorSamplesback to summary
private int colorSamples

The number of COLOR_SAMPLES_NV to use for Coverage Sample Anti-aliasing (CSAA). When this number is greater than 0, the samples property will be treated as if it were the COVERAGE_SAMPLES_NV property.

This property is currently a no-op for the MacOS implementation.

depthback to summary
private int depth

The number of depth buffer bits

floating_pointback to summary
private boolean floating_point

Whether this format specifies a floating point format

floating_point_packedback to summary
private boolean floating_point_packed

Whether this format specifies a packed floating point format (32 bit unsigned - R11F_G11F_B10F) This property is currently a no-op for the MacOS implementation.

num_aux_buffersback to summary
private int num_aux_buffers

The number of auxiliary buffers

samplesback to summary
private int samples

The number of samples to use in anti-aliasing. 0 means that anti-aliasing is disabled.

sRGBback to summary
private boolean sRGB

Whether this format specifies an sRGB format This property is currently a no-op for the MacOS implementation.

stencilback to summary
private int stencil

The number of stencil bits

stereoback to summary
private boolean stereo

Whether this format requires a stereo buffer

Constructor Detail

PixelFormatback to summary
public PixelFormat()

Default pixel format is minimum 8 bits depth, and no alpha nor stencil requirements.

PixelFormatback to summary
public PixelFormat(int alpha, int depth, int stencil)
PixelFormatback to summary
public PixelFormat(int alpha, int depth, int stencil, int samples)
PixelFormatback to summary
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples)
PixelFormatback to summary
public PixelFormat(int bpp, int alpha, int depth, int stencil, int samples, int num_aux_buffers, int accum_bpp, int accum_alpha, boolean stereo)
PixelFormatback to summary
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)
PixelFormatback to summary
private PixelFormat(final PixelFormat pf)

Method Detail

getAccumulationAlphaback to summary
public int getAccumulationAlpha()
getAccumulationBitsPerPixelback to summary
public int getAccumulationBitsPerPixel()
getAlphaBitsback to summary
public int getAlphaBits()
getAuxBuffersback to summary
public int getAuxBuffers()
getBitsPerPixelback to summary
public int getBitsPerPixel()
getDepthBitsback to summary
public int getDepthBits()
getSamplesback to summary
public int getSamples()
getStencilBitsback to summary
public int getStencilBits()
isFloatingPointback to summary
public boolean isFloatingPoint()
isSRGBback to summary
public boolean isSRGB()
isStereoback to summary
public boolean isStereo()
withAccumulationAlphaback to summary
public PixelFormat withAccumulationAlpha(final 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.

Parameters
accum_alpha:int

the new alpha bits in the accumulation buffer value.

Returns:PixelFormat

the new PixelFormat

withAccumulationBitsPerPixelback to summary
public PixelFormat withAccumulationBitsPerPixel(final 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.

Parameters
accum_bpp:int

the new bits per pixel in the accumulation buffer value.

Returns:PixelFormat

the new PixelFormat

withAlphaBitsback to summary
public PixelFormat withAlphaBits(final int alpha)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new alpha bits value.

Parameters
alpha:int

the new alpha bits value.

Returns:PixelFormat

the new PixelFormat

withAuxBuffersback to summary
public PixelFormat withAuxBuffers(final int num_aux_buffers)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new auxiliary buffers value.

Parameters
num_aux_buffers:int

the new auxiliary buffers value.

Returns:PixelFormat

the new PixelFormat

withBitsPerPixelback to summary
public PixelFormat withBitsPerPixel(final int bpp)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new bits per pixel value.

Parameters
bpp:int

the new bits per pixel value.

Returns:PixelFormat

the new PixelFormat

withCoverageSamplesback to summary
public PixelFormat withCoverageSamples(final int colorSamples)

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 the samples property is also greater than 0. Additionally, the color samples value needs to be lower than or equal to the samples property.

Parameters
colorSamples:int

the new color samples value.

Returns:PixelFormat

the new PixelFormat

withCoverageSamplesback to summary
public PixelFormat withCoverageSamples(final int colorSamples, final int coverageSamples)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new color samples and coverage samples values.

Parameters
colorSamples:int

the new color samples value. This value must be lower than or equal to the coverage samples value.

coverageSamples:int

the new coverage samples value.

Returns:PixelFormat

the new PixelFormat

withDepthBitsback to summary
public PixelFormat withDepthBits(final int depth)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new depth bits value.

Parameters
depth:int

the new depth bits value.

Returns:PixelFormat

the new PixelFormat

withFloatingPointback to summary
public PixelFormat withFloatingPoint(final boolean floating_point)

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:boolean

the new floating point value.

Returns:PixelFormat

the new PixelFormat

withFloatingPointPackedback to summary
public PixelFormat withFloatingPointPacked(final boolean floating_point_packed)

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:boolean

the new packed floating point value.

Returns:PixelFormat

the new PixelFormat

withSamplesback to summary
public PixelFormat withSamples(final int samples)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new samples value.

Parameters
samples:int

the new samples value.

Returns:PixelFormat

the new PixelFormat

withSRGBback to summary
public PixelFormat withSRGB(final boolean sRGB)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new sRGB value.

Parameters
sRGB:boolean

the new floating point value.

Returns:PixelFormat

the new PixelFormat

withStencilBitsback to summary
public PixelFormat withStencilBits(final int stencil)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new stencil bits value.

Parameters
stencil:int

the new stencil bits value.

Returns:PixelFormat

the new PixelFormat

withStereoback to summary
public PixelFormat withStereo(final boolean stereo)

Returns a new PixelFormat object with the same properties as this PixelFormat and the new stereo value.

Parameters
stereo:boolean

the new stereo value.

Returns:PixelFormat

the new PixelFormat