Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
b7a3e826
Commit
b7a3e826
authored
May 10, 2013
by
Robert Menzel
Browse files
Merge branch 'experimental' of
file:///data/git-repository/acgl/libraries/acgl
into experimental
parents
82c5a51b
9b59496e
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Objects/Texture.hh
View file @
b7a3e826
...
...
@@ -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
::
uvec
2
&
_newSize
);
void
resize
I
(
const
glm
::
uvec
3
&
_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
resize
I
(
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
::
uvec
2
&
_newSize
);
void
resize
I
(
const
glm
::
uvec
3
&
_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
resize
I
(
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
::
uvec
2
&
_newSize
);
void
resize
I
(
const
glm
::
uvec
3
&
_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
resize
I
(
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
::
uvec
2
&
_newSize
);
void
resize
I
(
const
glm
::
uvec
3
&
_newSize
);
private:
bool
cubeSideIsValid
(
const
GLenum
_cubeSide
)
const
;
...
...
include/ACGL/Scene/GenericCamera.hh
View file @
b7a3e826
...
...
@@ -397,6 +397,8 @@ class GenericCamera
glm
::
uvec2
mViewportSize
;
};
ACGL_SMARTPOINTER_TYPEDEFS
(
GenericCamera
)
}
// Scene
}
// ACGL
src/ACGL/OpenGL/Data/TextureDataLoadStore.cc
View file @
b7a3e826
...
...
@@ -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
;
...
...
src/ACGL/OpenGL/Objects/Texture.cc
View file @
b7a3e826
...
...
@@ -329,7 +329,7 @@ TextureData *TextureBase::getTextureImageRAW( const Image &_image, GLenum _forma
#endif // ES 2
void
TextureRectangle
::
resize
(
const
glm
::
uvec
2
&
_newSize
)
void
TextureRectangle
::
resize
I
(
const
glm
::
uvec
3
&
_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
::
resize
I
(
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
::
uvec
2
&
_newSize
)
void
Texture2D
::
resize
I
(
const
glm
::
uvec
3
&
_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
::
resize
I
(
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
::
uvec
2
&
_newSize
)
void
Texture1DArray
::
resize
I
(
const
glm
::
uvec
3
&
_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
::
resize
I
(
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
::
uvec
2
&
_newSize
)
void
TextureCubeMap
::
resize
I
(
const
glm
::
uvec
3
&
_newSize
)
{
if
(
_newSize
.
x
!=
(
unsigned
int
)
mWidth
||
_newSize
.
y
!=
(
unsigned
int
)
mHeight
)
{
SharedTextureData
sTexData
(
new
TextureData
()
);
...
...
src/ACGL/OpenGL/Objects/VertexArrayObject.cc
View file @
b7a3e826
...
...
@@ -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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment