Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.3 and later. |
Companion guide | |
Declared in | NSOpenGL.h |
Related sample code |
The NSOpenGLPixelBuffer
class gives Cocoa OpenGL implementations access to accelerated offscreen rendering. With this offscreen rendering you could, for instance, draw into the pixel buffer, then use the contents as a texture map elsewhere. Typically you initialize an NSOpenGLPixelBuffer
object using the initWithTextureTarget:textureInternalFormat:textureMaxMipMapLevel:pixelsWide:pixelsHigh:
method and attach the resulting object to an OpenGL context with the setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:
method of NSOpenGLContext
.
Returns an NSOpenGLPixelBuffer
object initialized with the specified parameters.
- (id)initWithTextureTarget:(GLenum)target textureInternalFormat:(GLenum)format textureMaxMipMapLevel:(GLint)maxLevel pixelsWide:(GLsizei)pixelsWide pixelsHigh:(GLsizei)pixelsHigh
The texture object. This value should be one of the following: GL_TEXTURE_2D
,GL_TEXTURE_CUBE_MAP
, or GL_TEXTURE_RECTANGLE_EXT
.
The base internal format of the texture. This value should be GL_RGB
, GL_RGBA
, or GL_DEPTH_COMPONENT
.
The desired maximum mipmap level of the structure, starting with zero.
The width of the texture (in pixels) in the pixel buffer.
The height of the texture (in pixels) in the pixel buffer.
An initialized NSOpenGLPixelBuffer
object or nil
if the initialization failed. Initialization can fail if there is inconsistency among the parameter values. See the OpenGL documentation for glTexImage2D
for more information.
The value you pass to the target parameter defines several other constraints that are then applied to the remaining parameters. The list below gives the values you can pass to target and the additional constraints.
GL_TEXTURE_2D
GL_TEXTURE_CUBE_MAP
- the values in pixelsWide and pixelsHigh must be equal.
GL_TEXTURE_RECTANGLE_EXT
- maxLevel must be zero.
Normally, when using the GL_TEXTURE_2D
and GL_TEXTURE_CUBE_MAP
targets, you must specify width and height values that are powers of two. When the ARB_texture_non_power_of_two
extension is present, however, some types of hardware can support values that are not powers of two. You should check for the presence of this extension before specifying non power-of-two values.
If the texture map cannot be created, you can use the glGetError
function to get the error code.
NSOpenGL.h
Returns the height of the receiver’s texture (in pixels).
- (GLsizei)pixelsHigh
The height of the texture (in pixels).
NSOpenGL.h
Returns the width of the receiver’s texture (in pixels).
- (GLsizei)pixelsWide
The width of the texture (in pixels).
NSOpenGL.h
Returns the internal format of the receiver’s texture.
- (GLenum)textureInternalFormat
The texture format, which can be one of the following values: GL_RGB
, GL_RGBA
, or GL_DEPTH_COMPONENT
.
NSOpenGL.h
Returns the maximum mipmap level of the receiver’s texture.
- (GLint)textureMaxMipMapLevel
The maximum mipmap level.
NSOpenGL.h
Returns the texture target of the receiver.
- (GLenum)textureTarget
The texture target, which can be one of the following values: GL_TEXTURE_2D
, GL_TEXTURE_CUBE_MAP
, or GL_TEXTURE_RECTANGLE_EXT
.
NSOpenGL.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-01-31)