From Art Tevs,

"A new texture class Texture2DArray derived from
Texture extends the osg to support the new
EXT_texture_array extensions. Texture arrays provides
a feature for people interesting in GPGPU programming.


Faetures and changes:

- Full support for layered 2D textures.

- New uniform types were added (sampler2DArray)

- FrameBufferObject implementation were changed to
support attaching of 2D array textures to the
framebuffer

- StateSet was slightly changed to support texture
arrays. NOTE: array textures can not be used in fixed
function pipeline. Thus using the layered texture as a
statemode for a Drawable produce invalid enumerant
OpenGL errors.

- Image class was extended to support handling of
array textures

Tests:
I have used this class as a new feature of my
application. It works for me without problems (Note:
Texture arrays were introduced only for shading
languages and not for fixed function pipelines!!!).
RTT with Texture2DArray works, as I have tested them
as texture targets for a camera with 6 layers/faces
(i.e. replacement for cube maps). I am using the array
textures in shader programming. Array textures can be
attached to the FBO and used as input and as output."
This commit is contained in:
Robert Osfield
2007-09-07 11:21:02 +00:00
parent ed6322630f
commit c7a72c8435
11 changed files with 915 additions and 7 deletions

View File

@@ -44,6 +44,7 @@
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
@@ -105,13 +106,16 @@ namespace osg
typedef void APIENTRY TglFramebufferTexture1DEXT(GLenum, GLenum, GLenum, GLuint, GLint);
typedef void APIENTRY TglFramebufferTexture2DEXT(GLenum, GLenum, GLenum, GLuint, GLint);
typedef void APIENTRY TglFramebufferTexture3DEXT(GLenum, GLenum, GLenum, GLuint, GLint, GLint);
typedef void APIENTRY TglFramebufferTextureLayerEXT(GLenum, GLenum, GLuint, GLint, GLint);
typedef void APIENTRY TglFramebufferRenderbufferEXT(GLenum, GLenum, GLenum, GLuint);
typedef void APIENTRY TglGenerateMipmapEXT(GLenum);
typedef void APIENTRY TglRenderbufferStorageMultisampleCoverageNV(GLenum, GLuint, GLuint, GLenum, GLuint, GLuint);
TglBindRenderbufferEXT* glBindRenderbufferEXT;
TglGenRenderbuffersEXT* glGenRenderbuffersEXT;
TglDeleteRenderbuffersEXT* glDeleteRenderbuffersEXT;
TglRenderbufferStorageEXT* glRenderbufferStorageEXT;
TglRenderbufferStorageMultisampleCoverageNV* glRenderbufferStorageMultisampleCoverageNV;
TglBindFramebufferEXT* glBindFramebufferEXT;
TglDeleteFramebuffersEXT* glDeleteFramebuffersEXT;
TglGenFramebuffersEXT* glGenFramebuffersEXT;
@@ -119,6 +123,7 @@ namespace osg
TglFramebufferTexture1DEXT* glFramebufferTexture1DEXT;
TglFramebufferTexture2DEXT* glFramebufferTexture2DEXT;
TglFramebufferTexture3DEXT* glFramebufferTexture3DEXT;
TglFramebufferTextureLayerEXT* glFramebufferTextureLayerEXT;
TglFramebufferRenderbufferEXT* glFramebufferRenderbufferEXT;
TglGenerateMipmapEXT* glGenerateMipmapEXT;
@@ -246,6 +251,7 @@ namespace osg
class Texture1D;
class Texture2D;
class Texture3D;
class Texture2DArray;
class TextureCubeMap;
class TextureRectangle;
@@ -259,6 +265,7 @@ namespace osg
explicit FrameBufferAttachment(Texture1D* target, int level = 0);
explicit FrameBufferAttachment(Texture2D* target, int level = 0);
explicit FrameBufferAttachment(Texture3D* target, int zoffset, int level = 0);
explicit FrameBufferAttachment(Texture2DArray* target, int layer, int level = 0);
explicit FrameBufferAttachment(TextureCubeMap* target, int face, int level = 0);
explicit FrameBufferAttachment(TextureRectangle* target);
explicit FrameBufferAttachment(Camera::Attachment& attachment);