Package org.lwjgl.opengles
Class PixelFormat
java.lang.Object
org.lwjgl.opengles.PixelFormat
- All Implemented Interfaces:
PixelFormatLWJGL
This class describes the configuration settings for an EGL surface. Instances
of this class are used as arguments to Display.create(). The attributes specified
in this class will be used to get EGLConfigs from an EGLDisplay. PixelFormat
is not the best name for this class, but it matches the corresponding class
in the official desktop LWJGL.
Instances of this class are immutable. An example of the expected way to set
the PixelFormat property values is the following:
PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4);
Attributes that correspond to EGL extensions will be silently ignored if those
extensions are not supported by the EGLDisplay.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PixelFormat with rgbSize = 8, alphaSize = 8 and depthSize = 16.PixelFormat
(int alphaSize, int depthSize, int stencilSize) Creates a new PixelFormat with rgbSize = 8 and the specified alphaSize, depthSize and stencilSize.PixelFormat
(int alphaSize, int depthSize, int stencilSize, int samples) Creates a new PixelFormat with rgbSize = 8 and the specified alphaSize, depthSize, stencilSize and samples.PixelFormat
(int rgbSize, int alphaSize, int luminanceSize, int depthSize, int stencilSize, int samples) Creates a new PixelFormat with the specified RGB sizes, EGL_ALPHA_SIZE, EGL_LUMINANCE_SIZE, EGL_DEPTH_SIZE, EGL_STENCIL_SIZE, EGL_SAMPLES. -
Method Summary
Modifier and TypeMethodDescriptionint
getAttrib
(PixelFormat.Attrib attrib) Returns the value of the specified attribute.getAttribBuffer
(EGLDisplay display, int surfaceType, int[] lwjglAttribs) Returns an IntBuffer that can be used to get/choose EGLConfigs.getBestMatch
(EGLConfig[] configs) Returns the EGL config from the specified array that best matches this PixelFormat.void
setSurfaceAttribs
(EGLSurface surface) Applies this PixelFormat's surface attributes to the specified EGL surface.withAlphaSize
(int alphaSize) Returns a new PixelFormat with the specified EGL_ALPHA_SIZE.withCoverageSamplesNV
(int samples) Returns a new PixelFormat with the specified number of EGL_COVERAGE_SAMPLES_NV.withDepthEncodingNonlinearNV
(int depthEncoding) Returns a new PixelFormat with the specified EGL_DEPTH_ENCODING_NONLINEAR_NV.withDepthSize
(int depthSize) Returns a new PixelFormat with the specified EGL_DEPTH_SIZE.withLuminanceSize
(int luminanceSize) Returns a new PixelFormat with the specified EGL_LUMINANCE_SIZE.withMaxSwapInterval
(int maxSwapInterval) Returns a new PixelFormat with the specified EGL_MAX_SWAP_INTERVAL.withMinSwapInterval
(int minSwapInterval) Returns a new PixelFormat with the specified EGL_MIN_SWAP_INTERVAL.withMultisampleResolve
(int multisampleResolve) Returns a new PixelFormat with the specified EGL_MULTISAMPLE_RESOLVE value.withRGBSize
(int rgb) Returns a new PixelFormat with the specified RGB sizes.withRGBSize
(int r, int g, int b) Returns a new PixelFormat with the specified EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE.withSamples
(int samples) Returns a new PixelFormat with the specified number of EGL_SAMPLES.withStencilSize
(int stencilSize) Returns a new PixelFormat with the specified EGL_STENCIL_SIZE.withSwapBehavior
(int swapBehavior) Returns a new PixelFormat with the specified EGL_SWAP_BEHAVIOR value.withTransparentType
(int transparentType, int r, int g, int b) Returns a new PixelFormat with the specified EGL_TRANSPARENT_TYPE and the specified transparent RGB values.
-
Constructor Details
-
PixelFormat
public PixelFormat()Creates a new PixelFormat with rgbSize = 8, alphaSize = 8 and depthSize = 16.- See Also:
-
PixelFormat
public PixelFormat(int alphaSize, int depthSize, int stencilSize) Creates a new PixelFormat with rgbSize = 8 and the specified alphaSize, depthSize and stencilSize.- Parameters:
alphaSize
- the EGL_ALPHA_SIZE valuedepthSize
- the EGL_DEPTH_SIZE valuestencilSize
- the EGL_STENCIL_SIZE value- See Also:
-
PixelFormat
public PixelFormat(int alphaSize, int depthSize, int stencilSize, int samples) Creates a new PixelFormat with rgbSize = 8 and the specified alphaSize, depthSize, stencilSize and samples.- Parameters:
alphaSize
- the EGL_ALPHA_SIZE valuedepthSize
- the EGL_DEPTH_SIZE valuestencilSize
- the EGL_STENCIL_SIZE valuesamples
- the EGL_SAMPLE_SIZE value- See Also:
-
PixelFormat
public PixelFormat(int rgbSize, int alphaSize, int luminanceSize, int depthSize, int stencilSize, int samples) Creates a new PixelFormat with the specified RGB sizes, EGL_ALPHA_SIZE, EGL_LUMINANCE_SIZE, EGL_DEPTH_SIZE, EGL_STENCIL_SIZE, EGL_SAMPLES. All values must be greater than or equal to 0. rgbSize and luminanceSize cannot both be greater than 0. depthSize greater than 24 and stencilSize greater than 8 are not recommended. The corresponding EGL_SAMPLE_BUFFERS value will become 0 if samples is 0, or 1 if samples is greater than 0.- Parameters:
rgbSize
- the RGB sizesalphaSize
- the EGL_ALPHA_SIZE valueluminanceSize
- the EGL_LUMINANCE_SIZE valuedepthSize
- the EGL_DEPTH_SIZE valuestencilSize
- the EGL_STENCIL_SIZE valuesamples
- the EGL_SAMPLE_SIZE value
-
-
Method Details
-
getAttribBuffer
Returns an IntBuffer that can be used to get/choose EGLConfigs. The contents of the IntBuffer will be the sum of the source LWJGL attributes and the user-defined attributes from this PixelFormat's configuration. The source LWJGL attributes should not contain the EGL_SURFACE_TYPE attirube, or any attributes that are handled by PixelFormat. Attributes that correspond to EGL extensions will be checked against the extensions supported in the specified EGLDisplay. Attributes that correspond to unsupported extensions will not be included in the final EGLConfig query.- Parameters:
display
- the EGL display from which the EGLConfig is going to be retrievedlwjglAttribs
- the LWJGL attributes- Returns:
- the IntBuffer
-
getBestMatch
Returns the EGL config from the specified array that best matches this PixelFormat.- Parameters:
configs
- the EGL configs- Returns:
- the best match
- Throws:
LWJGLException
-
setSurfaceAttribs
Applies this PixelFormat's surface attributes to the specified EGL surface.- Parameters:
surface
- the EGL surface- Throws:
LWJGLException
-
getAttrib
Returns the value of the specified attribute.- Parameters:
attrib
- the attribute to retrieve- Returns:
- the attribute's value
-
withRGBSize
Returns a new PixelFormat with the specified RGB sizes.- Parameters:
rgb
- the new EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE- Returns:
- the new PixelFormat
- See Also:
-
withRGBSize
Returns a new PixelFormat with the specified EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE. All 3 values must be greater than or equal to 0. If any of the 3 values is greater than 0, the luminanceSize will be set to 0.- Parameters:
r
- the new EGL_RED_SIZEg
- the new EGL_GREEN_SIZEb
- the new EGL_BLUE_SIZE- Returns:
- the new PixelFormat
-
withAlphaSize
Returns a new PixelFormat with the specified EGL_ALPHA_SIZE. The alphaSize value must be greater than or equal to 0.- Parameters:
alphaSize
- the new EGL_ALPHA_SIZE- Returns:
- the new PixelFormat
-
withLuminanceSize
Returns a new PixelFormat with the specified EGL_LUMINANCE_SIZE. The luminanceSize value must be greater than or equal to 0. If luminanceSize is greater than 0, the RGB sizes will be set to 0.- Parameters:
luminanceSize
- the new EGL_LUMINANCE_SIZE- Returns:
- the new PixelFormat
-
withDepthSize
Returns a new PixelFormat with the specified EGL_DEPTH_SIZE. The depthSize value must be greater than or equal to 0. Values greater than 24 are not recommended.- Parameters:
depthSize
- the new EGL_DEPTH_SIZE- Returns:
- the new PixelFormat
-
withStencilSize
Returns a new PixelFormat with the specified EGL_STENCIL_SIZE. The stencilSize value must be greater than or equal to 0. Values greater than 8 are not recommended.- Parameters:
stencilSize
- the new EGL_STENCIL_SIZE- Returns:
- the new PixelFormat
-
withMinSwapInterval
Returns a new PixelFormat with the specified EGL_MIN_SWAP_INTERVAL. The minSwapInterval value must be between 0 and this PixelFormat's EGL_MAX_SWAP_INTERVAL.- Parameters:
minSwapInterval
- the new EGL_MIN_SWAP_INTERVAL value- Returns:
- the new PixelFormat
-
withMaxSwapInterval
Returns a new PixelFormat with the specified EGL_MAX_SWAP_INTERVAL. The maxSwapInterval value must be greater than or equal to this PixelFormat's EGL_MIN_SWAP_INTERVAL.- Parameters:
maxSwapInterval
- the new EGL_MAX_SWAP_INTERVAL value- Returns:
- the new PixelFormat
-
withSamples
Returns a new PixelFormat with the specified number of EGL_SAMPLES. The samples value must be either 0 or greater than or equal to 2. The related EGL_SAMPLE_BUFFERS value will become 0 if samples is 0, or 1 if samples is greater than or equal to 2.- Parameters:
samples
- the new EGL_SAMPLES value- Returns:
- the new PixelFormat
-
withTransparentType
Returns a new PixelFormat with the specified EGL_TRANSPARENT_TYPE and the specified transparent RGB values. The transparentType must be either EGL_NONE or EGL_TRANSPARENT_RGB. When it is EGL_NONE, the RGB values are set to zero and ignored. When it is EGL_TRANSPARENT_RGB, the RGB values must be between 0 and 2^rgbSize - 1.- Parameters:
transparentType
- the new EGL_TRANSPARENT_TYPE valuer
- the new EGL_TRANSPARENT_RED_VALUEg
- the new EGL_TRANSPARENT_GREEN_VALUEb
- the new EGL_TRANSPARENT_BLUE_VALUE- Returns:
- the new PixelFormat
-
withMultisampleResolve
Returns a new PixelFormat with the specified EGL_MULTISAMPLE_RESOLVE value. Valid values for multisampleResolve are EGL_MULTISAMPLE_RESOLVE_DEFAULT and EGL_MULTISAMPLE_RESOLVE_BOX. An IllegalStateException will be thrown if EGL_SAMPLES has not been previously defined to be greater than or equal to 2.- Parameters:
multisampleResolve
- the new EGL_MULTISAMPLE_RESOLVE value- Returns:
- the new PixelFormat
-
withSwapBehavior
Returns a new PixelFormat with the specified EGL_SWAP_BEHAVIOR value. Valid values for swapBehavior are EGL_DONT_CARE, EGL_BUFFER_PRESERVED and EGL_BUFFER_DESTROYED.- Parameters:
swapBehavior
- the new EGL_SWAP_BEHAVIOR value- Returns:
- the new PixelFormat
-
withCoverageSamplesNV
Returns a new PixelFormat with the specified number of EGL_COVERAGE_SAMPLES_NV. The samples value must be greater than or equal to 0. The related EGL_COVERAGE_BUFFERS_NV value will become 0 if samples is 0, or 1 if samples is greater than 0.- Parameters:
samples
- the new EGL_SAMPLES value- Returns:
- the new PixelFormat
-
withDepthEncodingNonlinearNV
Returns a new PixelFormat with the specified EGL_DEPTH_ENCODING_NONLINEAR_NV. Valid values for depthEncoding are EGL_DONT_CARE, EGL_DEPTH_ENCODING_NONE_NV and EGL_DEPTH_ENCODING_NONLINEAR_NV.- Parameters:
depthEncoding
- the new EGL_DEPTH_ENCODING_NONLINEAR_NV value- Returns:
- the new PixelFormat
-