Replaced GL_TEXTURE_2D_ARRAY_EXT with GL_TEXTURE_2D_ARRAY

This commit is contained in:
Robert Osfield
2018-02-28 08:50:48 +00:00
parent 3dec244d5b
commit 99bcd95756
6 changed files with 31 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2017 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2007 Art Tevs
@@ -630,16 +630,15 @@ typedef char GLchar;
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
#endif
#ifndef GL_TEXTURE_2D_ARRAY_EXT
#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
#ifndef GL_TEXTURE_2D_ARRAY
#define GL_TEXTURE_2D_ARRAY 0x8C1A
#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
#define GL_COMPARE_REF_DEPTH_TO_TEXTURE 0x884E
#define GL_SAMPLER_2D_ARRAY 0x8DC1
#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
#endif
#ifndef GL_MAX_3D_TEXTURE_SIZE

View File

@@ -40,7 +40,7 @@ class OSG_EXPORT Texture2DArray : public Texture
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
virtual int compare(const StateAttribute& rhs) const;
virtual GLenum getTextureTarget() const { return GL_TEXTURE_2D_ARRAY_EXT; }
virtual GLenum getTextureTarget() const { return GL_TEXTURE_2D_ARRAY; }
/** Texture2DArray is related to non fixed pipeline usage only so isn't appropriate to enable/disable.*/
virtual bool getModeUsage(StateAttribute::ModeUsage&) const { return false; }

View File

@@ -1277,7 +1277,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
glGetBooleanv(GL_TEXTURE_BINDING_2D_ARRAY_EXT, &binding2DArray);
}
GLenum textureMode = binding1D ? GL_TEXTURE_1D : binding2D ? GL_TEXTURE_2D : bindingRect ? GL_TEXTURE_RECTANGLE : binding3D ? GL_TEXTURE_3D : binding2DArray ? GL_TEXTURE_2D_ARRAY_EXT : 0;
GLenum textureMode = binding1D ? GL_TEXTURE_1D : binding2D ? GL_TEXTURE_2D : bindingRect ? GL_TEXTURE_RECTANGLE : binding3D ? GL_TEXTURE_3D : binding2DArray ? GL_TEXTURE_2D_ARRAY : 0;
if (bindingCubeMap)
{
switch (face)
@@ -1348,7 +1348,7 @@ void Image::readImageFromCurrentTexture(unsigned int contextID, bool copyMipMaps
glGetTexLevelParameteriv(textureMode, 0, GL_TEXTURE_COMPRESSED_ARB,&compressed);
}
}
else if (textureMode==GL_TEXTURE_2D_ARRAY_EXT)
else if (textureMode==GL_TEXTURE_2D_ARRAY)
{
if (extensions->isCompressedTexImage3DSupported())
{

View File

@@ -140,7 +140,7 @@ class TextureGLModeSet
_textureModeSet.insert(GL_TEXTURE_CUBE_MAP);
_textureModeSet.insert(GL_TEXTURE_RECTANGLE_NV);
_textureModeSet.insert(GL_TEXTURE_2D_ARRAY_EXT);
_textureModeSet.insert(GL_TEXTURE_2D_ARRAY);
_textureModeSet.insert(GL_TEXTURE_2D_MULTISAMPLE);
_textureModeSet.insert(GL_TEXTURE_GEN_Q);

View File

@@ -1995,7 +1995,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
// integer textures are not supported by the shadow
// GL_TEXTURE_1D_ARRAY_EXT could be included in the check below but its not yet implemented in OSG
if (extensions->isShadowSupported &&
(target == GL_TEXTURE_2D || target == GL_TEXTURE_1D || target == GL_TEXTURE_RECTANGLE || target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_2D_ARRAY_EXT ) &&
(target == GL_TEXTURE_2D || target == GL_TEXTURE_1D || target == GL_TEXTURE_RECTANGLE || target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_2D_ARRAY ) &&
_internalFormatType != SIGNED_INTEGER && _internalFormatType != UNSIGNED_INTEGER)
{
if (_use_shadow_comparison)

View File

@@ -263,7 +263,7 @@ void Texture2DArray::apply(State& state) const
// compute the dimensions of the texture.
computeRequiredTextureDimensions(state, *image, new_width, new_height, new_numMipmapLevels);
if (!textureObject->match(GL_TEXTURE_2D_ARRAY_EXT, new_numMipmapLevels, _internalFormat, new_width, new_height, textureDepth, _borderWidth))
if (!textureObject->match(GL_TEXTURE_2D_ARRAY, new_numMipmapLevels, _internalFormat, new_width, new_height, textureDepth, _borderWidth))
{
_textureObjectBuffer[contextID]->release();
_textureObjectBuffer[contextID] = 0;
@@ -322,9 +322,9 @@ void Texture2DArray::apply(State& state) const
else if (_subloadCallback.valid())
{
// generate texture (i.e. glGenTexture) and apply parameters
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D_ARRAY_EXT);
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D_ARRAY);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT, state);
applyTexParameters(GL_TEXTURE_2D_ARRAY, state);
_subloadCallback->load(*this,state);
}
@@ -341,11 +341,11 @@ void Texture2DArray::apply(State& state) const
// create texture object
textureObject = generateAndAssignTextureObject(
contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels, _internalFormat, _textureWidth, _textureHeight, textureDepth,0);
contextID, GL_TEXTURE_2D_ARRAY,_numMipmapLevels, _internalFormat, _textureWidth, _textureHeight, textureDepth,0);
// bind texture
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT, state);
applyTexParameters(GL_TEXTURE_2D_ARRAY, state);
// First we need to allocate the texture memory
int sourceFormat = _sourceFormat ? _sourceFormat : _internalFormat;
@@ -354,7 +354,7 @@ void Texture2DArray::apply(State& state) const
sourceFormat == _internalFormat &&
extensions->isCompressedTexImage3DSupported() )
{
extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, 0, _internalFormat,
extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat,
_textureWidth, _textureHeight, textureDepth, _borderWidth,
_images[0]->getImageSizeInBytes() * textureDepth,
0);
@@ -366,7 +366,7 @@ void Texture2DArray::apply(State& state) const
if( isCompressedInternalFormat( sourceFormat ) )
sourceFormat = GL_RGBA;
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, 0, _internalFormat,
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat,
_textureWidth, _textureHeight, textureDepth, _borderWidth,
sourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
0);
@@ -431,12 +431,12 @@ void Texture2DArray::apply(State& state) const
{
// generate texture
textureObject = generateAndAssignTextureObject(
contextID, GL_TEXTURE_2D_ARRAY_EXT,_numMipmapLevels,_internalFormat, _textureWidth, _textureHeight, _textureDepth,0);
contextID, GL_TEXTURE_2D_ARRAY,_numMipmapLevels,_internalFormat, _textureWidth, _textureHeight, _textureDepth,0);
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);
applyTexParameters(GL_TEXTURE_2D_ARRAY,state);
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, 0, _internalFormat,
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, _internalFormat,
_textureWidth, _textureHeight, _textureDepth,
_borderWidth,
_sourceFormat ? _sourceFormat : _internalFormat,
@@ -448,7 +448,7 @@ void Texture2DArray::apply(State& state) const
// nothing before, so just unbind the texture target
else
{
glBindTexture( GL_TEXTURE_2D_ARRAY_EXT, 0 );
glBindTexture( GL_TEXTURE_2D_ARRAY, 0 );
}
// if texture object is now valid and we have to allocate mipmap levels, then
@@ -475,7 +475,7 @@ void Texture2DArray::applyTexImage2DArray_subload(State& state, Image* image, GL
// get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context.
const GLExtensions* extensions = state.get<GLExtensions>();
GLenum target = GL_TEXTURE_2D_ARRAY_EXT;
GLenum target = GL_TEXTURE_2D_ARRAY;
// compute the internal texture format, this set the _internalFormat to an appropriate value.
computeInternalFormat();
@@ -663,8 +663,8 @@ void Texture2DArray::copyTexSubImage2DArray(State& state, int xoffset, int yoffs
{
textureObject->bind();
applyTexParameters(GL_TEXTURE_2D_ARRAY_EXT,state);
extensions->glCopyTexSubImage3D( GL_TEXTURE_2D_ARRAY_EXT, 0, xoffset,yoffset,zoffset, x, y, width, height);
applyTexParameters(GL_TEXTURE_2D_ARRAY,state);
extensions->glCopyTexSubImage3D( GL_TEXTURE_2D_ARRAY, 0, xoffset,yoffset,zoffset, x, y, width, height);
// inform state that this texture is the current one bound.
state.haveAppliedTextureAttribute(state.getActiveTextureUnit(), this);
@@ -724,14 +724,14 @@ void Texture2DArray::allocateMipmap(State& state) const
getCompressedSize( _internalFormat, width, height, textureDepth, blockSize, size);
extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, k, _internalFormat,
extensions->glCompressedTexImage3D( GL_TEXTURE_2D_ARRAY, k, _internalFormat,
width, height, _textureDepth, _borderWidth,
size,
NULL);
}
else
{
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY_EXT, k, _internalFormat,
extensions->glTexImage3D( GL_TEXTURE_2D_ARRAY, k, _internalFormat,
width, height, textureDepth, _borderWidth,
safeSourceFormat, _sourceType ? _sourceType : GL_UNSIGNED_BYTE,
NULL);