Commit b7a3e826 authored by Robert Menzel's avatar Robert Menzel

Merge branch 'experimental' of file:///data/git-repository/acgl/libraries/acgl into experimental

parents 82c5a51b 9b59496e
......@@ -177,6 +177,11 @@ public:
//! Generate mipmaps from the current base texture (i.e. the texture from level 0)
void generateMipmaps(void);
void resize(const glm::uvec3& _size) { resizeI(glm::uvec3(_size.x, _size.y, _size.z)); }
void resize(const glm::uvec2& _size) { resizeI(glm::uvec3(_size.x, _size.y, 1 )); }
void resize(const glm::uvec1& _size) { resizeI(glm::uvec3(_size.x, 1, 1 )); }
void resize( GLuint _size) { resizeI(glm::uvec3(_size, 1, 1 )); }
#ifndef ACGL_OPENGLES_VERSION_20
//! get one texture image:
TextureData *getTextureImageRAW( const Image &_image = Image(), GLenum _format = GL_RGBA, GLenum _type = GL_UNSIGNED_BYTE ) const;
......@@ -229,6 +234,9 @@ protected:
{
return (mWidth != 0);
}
//! Resizes the texture. Subclasses implementing this method may use only use the first entries of _size if they are of lower dimension
virtual void resizeI(const glm::uvec3& _size) = 0;
};
ACGL_SMARTPOINTER_TYPEDEFS(TextureBase)
......@@ -268,9 +276,10 @@ public:
//! sets the content to the given TextureData, might resize the texture
void setImageData( const SharedTextureData &_data );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const glm::uvec2 &_newSize );
void resizeI( const glm::uvec3 &_newSize );
private:
void generateMipmaps(void) { ACGL::Utils::error() << "Rectangle Textures don't support MipMaps!" << std::endl; }
......@@ -296,9 +305,10 @@ public:
//! sets the content to the given TextureData, might resize the texture
void setImageData( const SharedTextureData &_data, uint32_t _mipmapLayer = 0 );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const uint32_t _newSize );
void resizeI( const glm::uvec3 &_newSize );
};
ACGL_SMARTPOINTER_TYPEDEFS(Texture1D)
......@@ -318,9 +328,10 @@ public:
//! sets the content to the given TextureData, might resize the texture
void setImageData( const SharedTextureData &_data, uint32_t _mipmapLayer = 0 );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const glm::uvec2 &_newSize );
void resizeI( const glm::uvec3 &_newSize );
};
ACGL_SMARTPOINTER_TYPEDEFS(Texture2D)
......@@ -344,9 +355,10 @@ public:
//! sets the content of all slices to the given TextureData
void setImageData( const SharedTextureData &_data, uint32_t _mipmapLayer = 0 );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const glm::uvec3 &_newSize );
void resizeI( const glm::uvec3 &_newSize );
};
ACGL_SMARTPOINTER_TYPEDEFS(Texture3D)
......@@ -369,9 +381,10 @@ public:
//! sets the content to the given TextureData to fill all layers
void setImageData( const SharedTextureData &_data, uint32_t _mipmapLayer = 0 );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const glm::uvec2 &_newSize );
void resizeI( const glm::uvec3 &_newSize );
};
ACGL_SMARTPOINTER_TYPEDEFS(Texture1DArray)
......@@ -395,9 +408,10 @@ public:
//! sets the content to the given TextureData, might resize the texture
void setImageData( const SharedTextureData &_data, uint32_t _arrayLayer = 0, uint32_t _mipmapLayer = 0 );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const glm::uvec3 &_newSize );
void resizeI( const glm::uvec3 &_newSize );
};
ACGL_SMARTPOINTER_TYPEDEFS(Texture2DArray)
......@@ -417,9 +431,10 @@ public:
//! sets the content to the given TextureData, might resize the texture
void setImageData( const SharedTextureData &_data, GLenum _cubeSide, uint32_t _mipmapLayer = 0 );
protected:
//! content of the texture is undefined after this, this texture will be bound to the active binding point
//! nothing should be bound to the pixel unpack buffer when calling this
void resize( const glm::uvec2 &_newSize );
void resizeI( const glm::uvec3 &_newSize );
private:
bool cubeSideIsValid( const GLenum _cubeSide ) const;
......
......@@ -397,6 +397,8 @@ class GenericCamera
glm::uvec2 mViewportSize;
};
ACGL_SMARTPOINTER_TYPEDEFS(GenericCamera)
} // Scene
} // ACGL
......@@ -174,6 +174,7 @@ SharedTextureData loadTextureDataFromLodepng(const std::string &_filename)
if(colorType == LCT_GREY_ALPHA) { channels = 2; glFormat = GL_RG; }
if(colorType == LCT_RGB) { channels = 3; glFormat = GL_RGB; }
if(colorType == LCT_RGBA) { channels = 4; glFormat = GL_RGBA; }
if(colorType == LCT_PALETTE) { channels = 4; glFormat = GL_RGBA; colorType = LCT_RGBA; } // force LodePNG to convert paletted data to RGBA
GLenum glType = 0;
if(bitdepth == 8) glType = GL_UNSIGNED_BYTE;
......
......@@ -329,7 +329,7 @@ TextureData *TextureBase::getTextureImageRAW( const Image &_image, GLenum _forma
#endif // ES 2
void TextureRectangle::resize( const glm::uvec2 &_newSize )
void TextureRectangle::resizeI(const glm::uvec3 &_newSize )
{
if (_newSize.x != (unsigned int)mWidth || _newSize.y != (unsigned int)mHeight) {
SharedTextureData sTexData( new TextureData() );
......@@ -371,12 +371,12 @@ void Texture1D::setImageData( const SharedTextureData &_data, uint32_t _mipmapLa
}
}
void Texture1D::resize( const uint32_t _newSize )
void Texture1D::resizeI(const glm::uvec3 &_newSize )
{
if (_newSize != (unsigned int)mWidth) {
if (_newSize.x != (unsigned int)mWidth) {
SharedTextureData sTexData( new TextureData() );
sTexData->setData (NULL);
sTexData->setWidth (_newSize);
sTexData->setWidth (_newSize.x);
sTexData->setFormat(getCompatibleFormat( mInternalFormat ));
sTexData->setType (getCompatibleType( mInternalFormat ));
......@@ -394,7 +394,7 @@ void Texture2D::setImageData( const SharedTextureData &_data, uint32_t _mipmapLa
}
}
void Texture2D::resize( const glm::uvec2 &_newSize )
void Texture2D::resizeI( const glm::uvec3 &_newSize )
{
if (_newSize.x != (unsigned int)mWidth || _newSize.y != (unsigned int)mHeight) {
SharedTextureData sTexData( new TextureData() );
......@@ -434,7 +434,7 @@ void Texture3D::setImageData( const SharedTextureData &_data, uint32_t _mipmapLa
texSubImage3D( _data, _mipmapLayer, offset );
}
void Texture3D::resize( const glm::uvec3 &_newSize )
void Texture3D::resizeI( const glm::uvec3 &_newSize )
{
if (_newSize.x != (unsigned int)mWidth || _newSize.y != (unsigned int)mHeight || _newSize.z != (unsigned int)mDepth) {
SharedTextureData sTexData( new TextureData() );
......@@ -479,7 +479,7 @@ void Texture1DArray::setImageData( const SharedTextureData &_data, uint32_t _mip
texSubImage2D( _data, _mipmapLayer );
}
void Texture1DArray::resize( const glm::uvec2 &_newSize )
void Texture1DArray::resizeI(const glm::uvec3 &_newSize )
{
if (_newSize.x != (unsigned int)mWidth || _newSize.y != (unsigned int)mHeight) {
SharedTextureData sTexData( new TextureData() );
......@@ -506,7 +506,7 @@ void Texture2DArray::setImageData( const SharedTextureData &_data, uint32_t _arr
}
}
void Texture2DArray::resize( const glm::uvec3 &_newSize )
void Texture2DArray::resizeI( const glm::uvec3 &_newSize )
{
if (_newSize.x != (unsigned int)mWidth || _newSize.y != (unsigned int)mHeight || _newSize.z != (unsigned int)mDepth) {
SharedTextureData sTexData( new TextureData() );
......@@ -539,7 +539,7 @@ void TextureCubeMap::setImageData( const SharedTextureData &_data, GLenum _cubeS
//}
}
void TextureCubeMap::resize( const glm::uvec2 &_newSize )
void TextureCubeMap::resizeI(const glm::uvec3 &_newSize )
{
if (_newSize.x != (unsigned int)mWidth || _newSize.y != (unsigned int)mHeight) {
SharedTextureData sTexData( new TextureData() );
......
......@@ -229,6 +229,9 @@ void VertexArrayObject::setAttributePointer( GLuint _index )
}
#if (ACGL_OPENGL_VERSION >= 33)
glVertexAttribDivisor( _index, arrayBufferAttribute.divisor );
#else
if(arrayBufferAttribute.divisor > 0)
warning() << "Attribute divisors are not supported in OpenGL < 3.3" << std::endl;
#endif
glEnableVertexAttribArray(_index);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment