Package org.lwjgl.opengl
Class Pbuffer
- java.lang.Object
-
- org.lwjgl.opengl.Pbuffer
-
-
Field Summary
Fields Modifier and Type Field Description static intBACK_LEFT_BUFFERThe Pbuffer back left buffer.static intBACK_RIGHT_BUFFERThe Pbuffer back right buffer.protected org.lwjgl.opengl.ContextGLcontextThe OpenGL Context.static intCUBE_MAP_FACEThe render-to-texture cube map face attribute.static intDEPTH_BUFFERThe Pbuffer depth buffer.static intFRONT_LEFT_BUFFERThe Pbuffer front left buffer.static intFRONT_RIGHT_BUFFERThe Pbuffer front right buffer.static intMIPMAP_LEVELThe render-to-texture mipmap level attribute.static intPBUFFER_SUPPORTEDIndicates that Pbuffers can be created.protected org.lwjgl.opengl.PeerInfopeer_infoHandle to the native GL rendering contextprotected PixelFormatpixel_formatThe PixelFormat used to create the drawable.static intRENDER_DEPTH_TEXTURE_SUPPORTEDIndicates that Pbuffers can be used as depth render-textures.static intRENDER_TEXTURE_RECTANGLE_SUPPORTEDIndicates that Pbuffers can be used as non-power-of-two render-textures.static intRENDER_TEXTURE_SUPPORTEDIndicates that Pbuffers can be used as render-textures.static intTEXTURE_CUBE_MAP_NEGATIVE_XThe render-to-texture cube map negative X face value.static intTEXTURE_CUBE_MAP_NEGATIVE_YThe render-to-texture cube map negative Y face value.static intTEXTURE_CUBE_MAP_NEGATIVE_ZThe render-to-texture cube map negative Z face value.static intTEXTURE_CUBE_MAP_POSITIVE_XThe render-to-texture cube map positive X face value.static intTEXTURE_CUBE_MAP_POSITIVE_YThe render-to-texture cube map positive Y face value.static intTEXTURE_CUBE_MAP_POSITIVE_ZThe render-to-texture cube map positive Z face value.
-
Constructor Summary
Constructors Constructor Description Pbuffer(int width, int height, PixelFormat pixel_format, Drawable shared_drawable)Create an instance of a Pbuffer with a unique OpenGL context.Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable)Create an instance of a Pbuffer with a unique OpenGL context.Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable, ContextAttribs attribs)Create an instance of a Pbuffer with a unique OpenGL context.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindTexImage(int buffer)Binds the currently bound texture to the buffer specified.protected voidcheckDestroyed()voidcheckGLError()org.lwjgl.opengl.ContextGLcreateSharedContext()voiddestroy()Destroys the Drawable.static intgetCapabilities()Gets the Pbuffer capabilities.org.lwjgl.opengl.ContextGLgetContext()intgetHeight()PixelFormatLWJGLgetPixelFormat()intgetWidth()voidinitContext(float r, float g, float b)booleanisBufferLost()Method to test for validity of the buffer.booleanisCurrent()Returns true if the Drawable's context is current in the current thread.voidmakeCurrent()Makes the Drawable's context current in the current thread.voidreleaseContext()If the Drawable's context is current in the current thread, no context will be current after a call to this method.voidreleaseTexImage(int buffer)Releases the currently bound texture from the buffer specified.voidsetAttrib(int attrib, int value)Sets a render-to-texture attribute.voidsetCLSharingProperties(PointerBuffer properties)Sets the appropriate khr_gl_sharing properties in the targetPointerBuffer, so that if it is used in aclCreateContext(FromType)call, the created CL context will be sharing objects with thisDrawable's GL context.voidsetPixelFormat(PixelFormatLWJGL pf)voidsetPixelFormat(PixelFormatLWJGL pf, ContextAttribs attribs)voidsetSwapInterval(int swap_interval)voidswapBuffers()
-
-
-
Field Detail
-
PBUFFER_SUPPORTED
@Native public static final int PBUFFER_SUPPORTED
Indicates that Pbuffers can be created.- See Also:
- Constant Field Values
-
RENDER_TEXTURE_SUPPORTED
public static final int RENDER_TEXTURE_SUPPORTED
Indicates that Pbuffers can be used as render-textures.- See Also:
- Constant Field Values
-
RENDER_TEXTURE_RECTANGLE_SUPPORTED
public static final int RENDER_TEXTURE_RECTANGLE_SUPPORTED
Indicates that Pbuffers can be used as non-power-of-two render-textures.- See Also:
- Constant Field Values
-
RENDER_DEPTH_TEXTURE_SUPPORTED
public static final int RENDER_DEPTH_TEXTURE_SUPPORTED
Indicates that Pbuffers can be used as depth render-textures.- See Also:
- Constant Field Values
-
MIPMAP_LEVEL
public static final int MIPMAP_LEVEL
The render-to-texture mipmap level attribute.- See Also:
- Constant Field Values
-
CUBE_MAP_FACE
public static final int CUBE_MAP_FACE
The render-to-texture cube map face attribute.- See Also:
- Constant Field Values
-
TEXTURE_CUBE_MAP_POSITIVE_X
public static final int TEXTURE_CUBE_MAP_POSITIVE_X
The render-to-texture cube map positive X face value.- See Also:
- Constant Field Values
-
TEXTURE_CUBE_MAP_NEGATIVE_X
public static final int TEXTURE_CUBE_MAP_NEGATIVE_X
The render-to-texture cube map negative X face value.- See Also:
- Constant Field Values
-
TEXTURE_CUBE_MAP_POSITIVE_Y
public static final int TEXTURE_CUBE_MAP_POSITIVE_Y
The render-to-texture cube map positive Y face value.- See Also:
- Constant Field Values
-
TEXTURE_CUBE_MAP_NEGATIVE_Y
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y
The render-to-texture cube map negative Y face value.- See Also:
- Constant Field Values
-
TEXTURE_CUBE_MAP_POSITIVE_Z
public static final int TEXTURE_CUBE_MAP_POSITIVE_Z
The render-to-texture cube map positive Z face value.- See Also:
- Constant Field Values
-
TEXTURE_CUBE_MAP_NEGATIVE_Z
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z
The render-to-texture cube map negative Z face value.- See Also:
- Constant Field Values
-
FRONT_LEFT_BUFFER
public static final int FRONT_LEFT_BUFFER
The Pbuffer front left buffer.- See Also:
- Constant Field Values
-
FRONT_RIGHT_BUFFER
public static final int FRONT_RIGHT_BUFFER
The Pbuffer front right buffer.- See Also:
- Constant Field Values
-
BACK_LEFT_BUFFER
public static final int BACK_LEFT_BUFFER
The Pbuffer back left buffer.- See Also:
- Constant Field Values
-
BACK_RIGHT_BUFFER
public static final int BACK_RIGHT_BUFFER
The Pbuffer back right buffer.- See Also:
- Constant Field Values
-
DEPTH_BUFFER
public static final int DEPTH_BUFFER
The Pbuffer depth buffer.- See Also:
- Constant Field Values
-
pixel_format
protected PixelFormat pixel_format
The PixelFormat used to create the drawable.
-
peer_info
protected org.lwjgl.opengl.PeerInfo peer_info
Handle to the native GL rendering context
-
context
protected org.lwjgl.opengl.ContextGL context
The OpenGL Context.
-
-
Constructor Detail
-
Pbuffer
public Pbuffer(int width, int height, PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLExceptionCreate an instance of a Pbuffer with a unique OpenGL context. The buffer is single-buffered. NOTE: The Pbuffer will have its own context that shares display lists and textures withshared_context, or, ifshared_contextisnull, the Display context if it is created. The Pbuffer will have its own OpenGL state. Therefore, state changes to a pbuffer will not be seen in the window context and vice versa.- Parameters:
width- Pbuffer widthheight- Pbuffer heightpixel_format- Minimum Pbuffer context propertiesshared_drawable- If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share with the Display context (if created).- Throws:
LWJGLException
-
Pbuffer
public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable) throws LWJGLExceptionCreate an instance of a Pbuffer with a unique OpenGL context. The buffer is single-buffered. NOTE: The Pbuffer will have its own context that shares display lists and textures withshared_context, or, ifshared_contextisnull, the Display context if it is created. The Pbuffer will have its own OpenGL state. Therefore, state changes to a pbuffer will not be seen in the window context and vice versa. The renderTexture parameter defines the necessary state for enabling render-to-texture. When this parameter is null, render-to-texture is not available. Before using render-to-texture, the Pbuffer capabilities must be queried to ensure that it is supported. Currently only windows platform can support this feature, so it is recommended that EXT_framebuffer_object or similar is used if available, for maximum portability.- Parameters:
width- Pbuffer widthheight- Pbuffer heightpixel_format- Minimum Pbuffer context propertiesrenderTexture-shared_drawable- If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share with the Display context (if created).- Throws:
LWJGLException
-
Pbuffer
public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLExceptionCreate an instance of a Pbuffer with a unique OpenGL context. The buffer is single-buffered. NOTE: The Pbuffer will have its own context that shares display lists and textures withshared_context, or, ifshared_contextisnull, the Display context if it is created. The Pbuffer will have its own OpenGL state. Therefore, state changes to a pbuffer will not be seen in the window context and vice versa. The renderTexture parameter defines the necessary state for enabling render-to-texture. When this parameter is null, render-to-texture is not available. Before using render-to-texture, the Pbuffer capabilities must be queried to ensure that it is supported. Currently only windows platform can support this feature, so it is recommended that EXT_framebuffer_object or similar is used if available, for maximum portability.- Parameters:
width- Pbuffer widthheight- Pbuffer heightpixel_format- Minimum Pbuffer context propertiesrenderTexture-shared_drawable- If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share with the Display context (if created).attribs- The ContextAttribs to use when creating the context. (optional, may be null)- Throws:
LWJGLException
-
-
Method Detail
-
isBufferLost
public boolean isBufferLost()
Method to test for validity of the buffer. If this function returns true, the buffer contents is lost. The buffer can still be used, but the results are undefined. The application is expected to release the buffer if needed, destroy it and recreate a new buffer.- Returns:
- true if the buffer is lost and destroyed, false if the buffer is valid.
-
getCapabilities
public static int getCapabilities()
Gets the Pbuffer capabilities.- Returns:
- a bitmask of Pbuffer capabilities.
-
setAttrib
public void setAttrib(int attrib, int value)Sets a render-to-texture attribute. The attrib parameter can be one of MIPMAP_LEVEL and CUBE_MAP_FACE. When the attrib parameter is CUBE_MAP_FACE then the value parameter can be on of the following: TEXTURE_CUBE_MAP_POSITIVE_X TEXTURE_CUBE_MAP_NEGATIVE_X TEXTURE_CUBE_MAP_POSITIVE_Y TEXTURE_CUBE_MAP_NEGATIVE_Y TEXTURE_CUBE_MAP_POSITIVE_Z TEXTURE_CUBE_MAP_NEGATIVE_Z- Parameters:
attrib-value-
-
bindTexImage
public void bindTexImage(int buffer)
Binds the currently bound texture to the buffer specified. The buffer can be one of the following: FRONT_LEFT_BUFFER FRONT_RIGHT_BUFFER BACK_LEFT_BUFFER BACK_RIGHT_BUFFER DEPTH_BUFFER- Parameters:
buffer-
-
releaseTexImage
public void releaseTexImage(int buffer)
Releases the currently bound texture from the buffer specified.- Parameters:
buffer-
-
getHeight
public int getHeight()
- Returns:
- Returns the height.
-
getWidth
public int getWidth()
- Returns:
- Returns the width.
-
setPixelFormat
public void setPixelFormat(PixelFormatLWJGL pf) throws LWJGLException
- Throws:
LWJGLException
-
setPixelFormat
public void setPixelFormat(PixelFormatLWJGL pf, ContextAttribs attribs) throws LWJGLException
- Throws:
LWJGLException
-
getPixelFormat
public PixelFormatLWJGL getPixelFormat()
-
getContext
public org.lwjgl.opengl.ContextGL getContext()
-
createSharedContext
public org.lwjgl.opengl.ContextGL createSharedContext() throws LWJGLException- Throws:
LWJGLException
-
checkGLError
public void checkGLError()
-
setSwapInterval
public void setSwapInterval(int swap_interval)
-
swapBuffers
public void swapBuffers() throws LWJGLException- Throws:
LWJGLException
-
initContext
public void initContext(float r, float g, float b)
-
isCurrent
public boolean isCurrent() throws LWJGLExceptionDescription copied from interface:DrawableReturns true if the Drawable's context is current in the current thread.- Specified by:
isCurrentin interfaceDrawable- Throws:
LWJGLException
-
makeCurrent
public void makeCurrent() throws LWJGLExceptionDescription copied from interface:DrawableMakes the Drawable's context current in the current thread.- Specified by:
makeCurrentin interfaceDrawable- Throws:
LWJGLException
-
releaseContext
public void releaseContext() throws LWJGLExceptionDescription copied from interface:DrawableIf the Drawable's context is current in the current thread, no context will be current after a call to this method.- Specified by:
releaseContextin interfaceDrawable- Throws:
LWJGLException
-
destroy
public void destroy()
Description copied from interface:DrawableDestroys the Drawable.
-
setCLSharingProperties
public void setCLSharingProperties(PointerBuffer properties) throws LWJGLException
Description copied from interface:DrawableSets the appropriate khr_gl_sharing properties in the targetPointerBuffer, so that if it is used in aclCreateContext(FromType)call, the created CL context will be sharing objects with thisDrawable's GL context. After a call to this method, the target buffer position will have advanced by 2 to 4 positions, depending on the implementation.- Specified by:
setCLSharingPropertiesin interfaceDrawable- Parameters:
properties- The target properties buffer. It must have at least 4 positions remaining.- Throws:
LWJGLException
-
checkDestroyed
protected final void checkDestroyed()
-
-