java.lang.Object | ||
↳ | sun.java2d.SurfaceData | |
↳ | sun.java2d.opengl.OGLSurfaceData |
This class describes an OpenGL "surface", that is, a region of pixels managed via OpenGL. An OGLSurfaceData can be tagged with one of three different SurfaceType objects for the purpose of registering loops, etc. This diagram shows the hierarchy of OGL SurfaceTypes: Any / \ OpenGLSurface OpenGLTexture | OpenGLSurfaceRTT OpenGLSurface This kind of surface can be rendered to using OpenGL APIs. It is also possible to copy an OpenGLSurface to another OpenGLSurface (or to itself). This is typically accomplished by calling MakeContextCurrent(dstSD, srcSD) and then calling glCopyPixels() (although there are other techniques to achieve the same goal). OpenGLTexture This kind of surface cannot be rendered to using OpenGL (in the same sense as in OpenGLSurface). However, it is possible to upload a region of pixels to an OpenGLTexture object via glTexSubImage2D(). One can also copy a surface of type OpenGLTexture to an OpenGLSurface by binding the texture to a quad and then rendering it to the destination surface (this process is known as "texture mapping"). OpenGLSurfaceRTT This kind of surface can be thought of as a sort of hybrid between OpenGLSurface and OpenGLTexture, in that one can render to this kind of surface as if it were of type OpenGLSurface, but the process of copying this kind of surface to another is more like an OpenGLTexture. (Note that "RTT" stands for "render-to-texture".) In addition to these SurfaceType variants, we have also defined some constants that describe in more detail the type of underlying OpenGL surface. This table helps explain the relationships between those "type" constants and their corresponding SurfaceType: OGL Type Corresponding SurfaceType -------- ------------------------- WINDOW OpenGLSurface PBUFFER OpenGLSurface TEXTURE OpenGLTexture FLIP_BACKBUFFER OpenGLSurface FBOBJECT OpenGLSurfaceRTT
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | FBOBJECT | ||||||||||
int | FLIP_BACKBUFFER | ||||||||||
int | PBUFFER | ||||||||||
int | PF_BYTE_GRAY | ||||||||||
int | PF_INT_ARGB | Pixel formats | |||||||||
int | PF_INT_ARGB_PRE | ||||||||||
int | PF_INT_BGR | ||||||||||
int | PF_INT_BGRX | ||||||||||
int | PF_INT_RGB | ||||||||||
int | PF_INT_RGBX | ||||||||||
int | PF_USHORT_555_RGB | ||||||||||
int | PF_USHORT_555_RGBX | ||||||||||
int | PF_USHORT_565_RGB | ||||||||||
int | PF_USHORT_GRAY | ||||||||||
int | TEXTURE | ||||||||||
int | UNDEFINED | OGL-specific surface types | |||||||||
int | WINDOW |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
oglImagePipe | |||||||||||
oglRenderPipe | |||||||||||
oglTextPipe | |||||||||||
oglTxRenderPipe | |||||||||||
type |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
For now, we can only render LCD text if:
- the fragment shader extension is available, and
- blending is disabled, and
- the source color is opaque
Eventually, we could enhance the native OGL text rendering code
and remove the above restrictions, but that would require significantly
more code just to support a few uncommon cases.
| |||||||||||
Performs a copyarea within this surface.
| |||||||||||
Synchronously releases resources associated with this surface.
| |||||||||||
Return a readable Raster which contains the pixels for the
specified rectangular region of the destination surface.
| |||||||||||
This method is called on a destination SurfaceData to choose
a proper SurfaceDataProxy subclass for a source SurfaceData
to use to control when and with what surface to override a
given image operation.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a MaskFill object that can be used on this destination
with the source (paint) and composite types determined by the given
SunGraphics2D, or null if no such MaskFill object can be located.
| |||||||||||
Initializes the appropriate OpenGL offscreen surface based on the value
of the type parameter.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Pixel formats
OGL-specific surface types
For now, we can only render LCD text if: - the fragment shader extension is available, and - blending is disabled, and - the source color is opaque Eventually, we could enhance the native OGL text rendering code and remove the above restrictions, but that would require significantly more code just to support a few uncommon cases.
Performs a copyarea within this surface. Returns false if there is no algorithm to perform the copyarea given the current settings of the SunGraphics2D.
Synchronously releases resources associated with this surface.
Return a readable Raster which contains the pixels for the specified rectangular region of the destination surface. The coordinate origin of the returned Raster is the same as the device space origin of the destination surface. In some cases the returned Raster might also be writeable. In most cases, the returned Raster might contain more pixels than requested.
This method is called on a destination SurfaceData to choose a proper SurfaceDataProxy subclass for a source SurfaceData to use to control when and with what surface to override a given image operation. The argument is the default SurfaceData for the source Image.
The type of the return object is chosen based on the acceleration capabilities of this SurfaceData and the type of the given source SurfaceData object.
In some cases the original SurfaceData will always be the best choice to use to blit to this SurfaceData. This can happen if the source image is a hardware surface of the same type as this one and so acceleration will happen without any caching. It may also be the case that the source image can never be accelerated on this SurfaceData - for example because it is translucent and there are no accelerated translucent image ops for this surface.
In those cases there is a special SurfaceDataProxy.UNCACHED instance that represents a NOP for caching purposes - it always returns the original sourceSD object as the replacement copy so no caching is ever performed.
Returns a MaskFill object that can be used on this destination with the source (paint) and composite types determined by the given SunGraphics2D, or null if no such MaskFill object can be located. Subclasses can override this method if they wish to filter other attributes (such as the hardware capabilities of the destination surface) before returning a specific MaskFill object.
Initializes the appropriate OpenGL offscreen surface based on the value of the type parameter. If the surface creation fails for any reason, an OutOfMemoryError will be thrown.