Package org.lwjgl.opengl
Class ContextAttribs
- java.lang.Object
-
- org.lwjgl.opengl.ContextAttribs
-
public final class ContextAttribs extends Object
This class represents the context attributes passed to CreateContextAttribs of the ARB_create_context extension. The attributes supported are described in the following extensions:
- WGL_ARB_create_context(_profile) and GLX_ARB_create_context(_profile)
- WGL_ARB_create_context_robustness and GLX_ARB_create_context_robustness
- WGL_ARB_robustness_isolation and GLX_ARB_robustness_isolation
- WGL_EXT_create_context_es2_profile and GLX_EXT_create_context_es2_profile
- KHR_context_flush_control
CONTEXT_FORWARD_COMPATIBLE_BIT_ARBflag is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification), even if the driver exposes the corresponding entry points. This extension is not supported on MacOS X. However, in order to enable the GL 3.2 context on MacOS X 10.7 or newer, an instance of this class must be passed to LWJGL. The only valid configuration isContextAttribs(3, 2, CONTEXT_CORE_PROFILE_BIT_ARB), anything else will be ignored.- Author:
- spasi
-
-
Field Summary
Fields Modifier and Type Field Description static intCONTEXT_COMPATIBILITY_PROFILE_BIT_ARBstatic intCONTEXT_CORE_PROFILE_BIT_ARBstatic intCONTEXT_DEBUG_BIT_ARBstatic intCONTEXT_ES2_PROFILE_BIT_EXTstatic intCONTEXT_FLAGS_ARBstatic intCONTEXT_FORWARD_COMPATIBLE_BIT_ARBstatic intCONTEXT_LAYER_PLANE_ARBstatic intCONTEXT_MAJOR_VERSION_ARBstatic intCONTEXT_MINOR_VERSION_ARBstatic intCONTEXT_PROFILE_MASK_ARBstatic intCONTEXT_RELEASE_BEHABIOR_ARBstatic intCONTEXT_RELEASE_BEHAVIOR_FLUSH_ARBstatic intCONTEXT_RELEASE_BEHAVIOR_NONE_ARBstatic intCONTEXT_RESET_ISOLATION_BIT_ARBstatic intCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBstatic intCONTEXT_ROBUST_ACCESS_BIT_ARBstatic intLOSE_CONTEXT_ON_RESET_ARBstatic intNO_RESET_NOTIFICATION_ARB
-
Constructor Summary
Constructors Constructor Description ContextAttribs()Creates the default ContextAttribs instance.ContextAttribs(int majorVersion, int minorVersion)Creates a ContextAttribs instance for the given OpenGL version.ContextAttribs(int majorVersion, int minorVersion, int profileMask)Creates a new ContextAttribs instance with the given attributes.ContextAttribs(int majorVersion, int minorVersion, int profileMask, int contextFlags)Creates a new ContextAttribs instance with the given attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetContextFlags()Returns theCONTEXT_FLAGS_ARBvalue.intgetContextReleaseBehavior()Returns theCONTEXT_RELEASE_BEHABIOR_ARBvalue.intgetContextResetNotificationStrategy()Returns theCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBvalue.intgetLayerPlane()Returns theCONTEXT_LAYER_PLANE_ARBvalue.intgetMajorVersion()Returns theCONTEXT_MAJOR_VERSION_ARBvalue.intgetMinorVersion()Returns theCONTEXT_MINOR_VERSION_ARBvalue.intgetProfileMask()Returns theCONTEXT_PROFILE_MASK_ARBvalue.booleanisContextResetIsolation()Returns true if theCONTEXT_RESET_ISOLATION_BIT_ARBhas been set.booleanisDebug()Returns true if theCONTEXT_DEBUG_BIT_ARBhas been set.booleanisForwardCompatible()Returns true if theCONTEXT_FORWARD_COMPATIBLE_BIT_ARBhas been set.booleanisLoseContextOnReset()Deprecated.usegetContextResetNotificationStrategy()insteadbooleanisProfileCompatibility()Returns true if theCONTEXT_COMPATIBILITY_PROFILE_BIT_ARBhas been set.booleanisProfileCore()Returns true if theCONTEXT_CORE_PROFILE_BIT_ARBhas been set.booleanisProfileES()Returns true if theCONTEXT_ES2_PROFILE_BIT_EXThas been set.booleanisRobustAccess()Returns true if theCONTEXT_ROBUST_ACCESS_BIT_ARBhas been set.StringtoString()ContextAttribswithContextReleaseBehavior(int behavior)Returns a ContextAttribs instance withCONTEXT_RELEASE_BEHABIOR_ARBset to the given behavior.ContextAttribswithContextResetIsolation(boolean contextResetIsolation)Returns a newContextAttribsinstance with theCONTEXT_RESET_ISOLATION_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.ContextAttribswithDebug(boolean debug)Returns a newContextAttribsinstance with theCONTEXT_DEBUG_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.ContextAttribswithForwardCompatible(boolean forwardCompatible)Returns a newContextAttribsinstance with theCONTEXT_FORWARD_COMPATIBLE_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.ContextAttribswithLayer(int layerPlane)Returns a newContextAttribsinstance withCONTEXT_LAYER_PLANE_ARBset to the given value.ContextAttribswithLoseContextOnReset(boolean loseContextOnReset)Deprecated.usewithResetNotificationStrategy(int)insteadContextAttribswithProfileCompatibility(boolean profileCompatibility)Returns a newContextAttribsinstance with theCONTEXT_COMPATIBILITY_PROFILE_BIT_ARBbit inCONTEXT_PROFILE_MASK_ARBset to the given value.ContextAttribswithProfileCore(boolean profileCore)Returns a newContextAttribsinstance with theCONTEXT_CORE_PROFILE_BIT_ARBbit inCONTEXT_PROFILE_MASK_ARBset to the given value.ContextAttribswithProfileES(boolean profileES)Returns a newContextAttribsinstance with theCONTEXT_ES2_PROFILE_BIT_EXTbit inCONTEXT_PROFILE_MASK_ARBset to the given value.ContextAttribswithResetNotificationStrategy(int strategy)Returns a ContextAttribs instance withCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBset to the given strategy.ContextAttribswithRobustAccess(boolean robustAccess)Returns a newContextAttribsinstance with theCONTEXT_ROBUST_ACCESS_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.
-
-
-
Field Detail
-
CONTEXT_MAJOR_VERSION_ARB
public static final int CONTEXT_MAJOR_VERSION_ARB
- See Also:
- Constant Field Values
-
CONTEXT_MINOR_VERSION_ARB
public static final int CONTEXT_MINOR_VERSION_ARB
- See Also:
- Constant Field Values
-
CONTEXT_PROFILE_MASK_ARB
public static final int CONTEXT_PROFILE_MASK_ARB
- See Also:
- Constant Field Values
-
CONTEXT_CORE_PROFILE_BIT_ARB
public static final int CONTEXT_CORE_PROFILE_BIT_ARB
- See Also:
- Constant Field Values
-
CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
public static final int CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
- See Also:
- Constant Field Values
-
CONTEXT_ES2_PROFILE_BIT_EXT
public static final int CONTEXT_ES2_PROFILE_BIT_EXT
- See Also:
- Constant Field Values
-
CONTEXT_FLAGS_ARB
public static final int CONTEXT_FLAGS_ARB
- See Also:
- Constant Field Values
-
CONTEXT_DEBUG_BIT_ARB
public static final int CONTEXT_DEBUG_BIT_ARB
- See Also:
- Constant Field Values
-
CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
public static final int CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
- See Also:
- Constant Field Values
-
CONTEXT_ROBUST_ACCESS_BIT_ARB
public static final int CONTEXT_ROBUST_ACCESS_BIT_ARB
- See Also:
- Constant Field Values
-
CONTEXT_RESET_ISOLATION_BIT_ARB
public static final int CONTEXT_RESET_ISOLATION_BIT_ARB
- See Also:
- Constant Field Values
-
CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
public static final int CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
- See Also:
- Constant Field Values
-
NO_RESET_NOTIFICATION_ARB
public static final int NO_RESET_NOTIFICATION_ARB
- See Also:
- Constant Field Values
-
LOSE_CONTEXT_ON_RESET_ARB
public static final int LOSE_CONTEXT_ON_RESET_ARB
- See Also:
- Constant Field Values
-
CONTEXT_RELEASE_BEHABIOR_ARB
public static final int CONTEXT_RELEASE_BEHABIOR_ARB
- See Also:
- Constant Field Values
-
CONTEXT_RELEASE_BEHAVIOR_NONE_ARB
public static final int CONTEXT_RELEASE_BEHAVIOR_NONE_ARB
- See Also:
- Constant Field Values
-
CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB
public static final int CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB
- See Also:
- Constant Field Values
-
CONTEXT_LAYER_PLANE_ARB
public static final int CONTEXT_LAYER_PLANE_ARB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContextAttribs
public ContextAttribs()
Creates the default ContextAttribs instance. No special attributes will be used when creating the OpenGL context.
-
ContextAttribs
public ContextAttribs(int majorVersion, int minorVersion)Creates a ContextAttribs instance for the given OpenGL version.
-
ContextAttribs
public ContextAttribs(int majorVersion, int minorVersion, int profileMask)Creates a new ContextAttribs instance with the given attributes.- Parameters:
majorVersion- the major OpenGL versionminorVersion- the minor OpenGL versionprofileMask- the context profile mask. One of:CONTEXT_CORE_PROFILE_BIT_ARB,CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,CONTEXT_ES2_PROFILE_BIT_EXT
-
ContextAttribs
public ContextAttribs(int majorVersion, int minorVersion, int profileMask, int contextFlags)Creates a new ContextAttribs instance with the given attributes.- Parameters:
majorVersion- the major OpenGL versionminorVersion- the minor OpenGL versionprofileMask- the context profile mask. One of:CONTEXT_CORE_PROFILE_BIT_ARB,CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,CONTEXT_ES2_PROFILE_BIT_EXTcontextFlags- the context flags, a bitfield value. One or more of:CONTEXT_DEBUG_BIT_ARB,CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,CONTEXT_ROBUST_ACCESS_BIT_ARB,CONTEXT_RESET_ISOLATION_BIT_ARB
-
-
Method Detail
-
getMajorVersion
public int getMajorVersion()
Returns theCONTEXT_MAJOR_VERSION_ARBvalue.
-
getMinorVersion
public int getMinorVersion()
Returns theCONTEXT_MINOR_VERSION_ARBvalue.
-
getProfileMask
public int getProfileMask()
Returns theCONTEXT_PROFILE_MASK_ARBvalue.
-
isProfileCore
public boolean isProfileCore()
Returns true if theCONTEXT_CORE_PROFILE_BIT_ARBhas been set.
-
isProfileCompatibility
public boolean isProfileCompatibility()
Returns true if theCONTEXT_COMPATIBILITY_PROFILE_BIT_ARBhas been set.
-
isProfileES
public boolean isProfileES()
Returns true if theCONTEXT_ES2_PROFILE_BIT_EXThas been set.
-
getContextFlags
public int getContextFlags()
Returns theCONTEXT_FLAGS_ARBvalue.
-
isDebug
public boolean isDebug()
Returns true if theCONTEXT_DEBUG_BIT_ARBhas been set.
-
isForwardCompatible
public boolean isForwardCompatible()
Returns true if theCONTEXT_FORWARD_COMPATIBLE_BIT_ARBhas been set.
-
isRobustAccess
public boolean isRobustAccess()
Returns true if theCONTEXT_ROBUST_ACCESS_BIT_ARBhas been set.
-
isContextResetIsolation
public boolean isContextResetIsolation()
Returns true if theCONTEXT_RESET_ISOLATION_BIT_ARBhas been set.
-
getContextResetNotificationStrategy
public int getContextResetNotificationStrategy()
Returns theCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBvalue.
-
isLoseContextOnReset
public boolean isLoseContextOnReset()
Deprecated.usegetContextResetNotificationStrategy()insteadReturns true if theCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBhas been set toLOSE_CONTEXT_ON_RESET_ARB.
-
getContextReleaseBehavior
public int getContextReleaseBehavior()
Returns theCONTEXT_RELEASE_BEHABIOR_ARBvalue.
-
getLayerPlane
public int getLayerPlane()
Returns theCONTEXT_LAYER_PLANE_ARBvalue.
-
withProfileCore
public ContextAttribs withProfileCore(boolean profileCore)
Returns a newContextAttribsinstance with theCONTEXT_CORE_PROFILE_BIT_ARBbit inCONTEXT_PROFILE_MASK_ARBset to the given value. IfprofileCoreis true, all other bits in the mask are cleared.
-
withProfileCompatibility
public ContextAttribs withProfileCompatibility(boolean profileCompatibility)
Returns a newContextAttribsinstance with theCONTEXT_COMPATIBILITY_PROFILE_BIT_ARBbit inCONTEXT_PROFILE_MASK_ARBset to the given value. IfprofileCompatibilityis true, all other bits in the mask are cleared.
-
withProfileES
public ContextAttribs withProfileES(boolean profileES)
Returns a newContextAttribsinstance with theCONTEXT_ES2_PROFILE_BIT_EXTbit inCONTEXT_PROFILE_MASK_ARBset to the given value. IfprofileESis true, all other bits in the mask are cleared.
-
withDebug
public ContextAttribs withDebug(boolean debug)
Returns a newContextAttribsinstance with theCONTEXT_DEBUG_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.
-
withForwardCompatible
public ContextAttribs withForwardCompatible(boolean forwardCompatible)
Returns a newContextAttribsinstance with theCONTEXT_FORWARD_COMPATIBLE_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.
-
withRobustAccess
public ContextAttribs withRobustAccess(boolean robustAccess)
Returns a newContextAttribsinstance with theCONTEXT_ROBUST_ACCESS_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.
-
withContextResetIsolation
public ContextAttribs withContextResetIsolation(boolean contextResetIsolation)
Returns a newContextAttribsinstance with theCONTEXT_RESET_ISOLATION_BIT_ARBbit inCONTEXT_FLAGS_ARBset to the given value.
-
withResetNotificationStrategy
public ContextAttribs withResetNotificationStrategy(int strategy)
Returns a ContextAttribs instance withCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBset to the given strategy. The default context reset notification strategy isNO_RESET_NOTIFICATION_ARB.- Parameters:
strategy- the context reset notification strategy. One of:NO_RESET_NOTIFICATION_ARB,LOSE_CONTEXT_ON_RESET_ARB- Returns:
- the new ContextAttribs
-
withLoseContextOnReset
public ContextAttribs withLoseContextOnReset(boolean loseContextOnReset)
Deprecated.usewithResetNotificationStrategy(int)insteadReturns a ContextAttribs instance withCONTEXT_RESET_NOTIFICATION_STRATEGY_ARBset toLOSE_CONTEXT_ON_RESET_ARBif the parameter is true or toNO_RESET_NOTIFICATION_ARBif the parameter is false.- Parameters:
loseContextOnReset- the context reset notification strategy- Returns:
- the new ContextAttribs
-
withContextReleaseBehavior
public ContextAttribs withContextReleaseBehavior(int behavior)
Returns a ContextAttribs instance withCONTEXT_RELEASE_BEHABIOR_ARBset to the given behavior. The default context release behavior isCONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB.- Parameters:
behavior- the context release behavior. One of:CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB,CONTEXT_RELEASE_BEHAVIOR_NONE_ARB- Returns:
- the new ContextAttribs
-
withLayer
public ContextAttribs withLayer(int layerPlane)
Returns a newContextAttribsinstance withCONTEXT_LAYER_PLANE_ARBset to the given value.
-
-