Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
e56585ad
Commit
e56585ad
authored
Mar 22, 2012
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
texture saving parameter type fixed and made uniform buffer parameter const
parent
1f350574
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
+13
-10
include/ACGL/OpenGL/Objects/Texture.hh
include/ACGL/OpenGL/Objects/Texture.hh
+1
-1
include/ACGL/OpenGL/Objects/UniformBuffer.hh
include/ACGL/OpenGL/Objects/UniformBuffer.hh
+1
-1
src/ACGL/OpenGL/Objects/Texture.cc
src/ACGL/OpenGL/Objects/Texture.cc
+10
-7
src/ACGL/OpenGL/Objects/UniformBuffer.cc
src/ACGL/OpenGL/Objects/UniformBuffer.cc
+1
-1
No files found.
include/ACGL/OpenGL/Objects/Texture.hh
View file @
e56585ad
...
...
@@ -352,7 +352,7 @@ public:
}
//! Returns a TextureData objects holding the contents of the texture
SharedTextureData
getImageData
(
GLint
_lod
=
0
,
GL
int
_type
=
0
)
const
;
SharedTextureData
getImageData
(
GLint
_lod
=
0
,
GL
enum
_type
=
GL_INVALID_ENUM
)
const
;
//! Generate mipmaps from the current base texture (i.e. the texture from level 0)
//! Note: The function is not const, because it changes the corresponding GPU data
...
...
include/ACGL/OpenGL/Objects/UniformBuffer.hh
View file @
e56585ad
...
...
@@ -59,7 +59,7 @@ public:
{}
//! inits the uniformbuffer to be used with the given shaderprogram, _uboName is the name of this buffer in the shader
UniformBuffer
(
const
ptr
::
shared_ptr
<
ShaderProgram
>
&
_shaderProgram
,
const
std
::
string
&
_uboName
);
UniformBuffer
(
const
ptr
::
shared_ptr
<
const
ShaderProgram
>
&
_shaderProgram
,
const
std
::
string
&
_uboName
);
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
...
...
src/ACGL/OpenGL/Objects/Texture.cc
View file @
e56585ad
...
...
@@ -75,20 +75,23 @@ void Texture::setAnisotropicFilter( GLfloat _sampleCount )
}
}
SharedTextureData
Texture
::
getImageData
(
GLint
_lod
,
GL
int
_type
)
const
SharedTextureData
Texture
::
getImageData
(
GLint
_lod
,
GL
enum
_type
)
const
{
if
(
_type
==
0
)
_type
=
mType
;
if
(
_type
==
GL_INVALID_ENUM
)
_type
=
mType
;
// determine the required buffer size to hold the requested LOD level
bind
();
GLint
width
,
height
,
depth
;
glGetTexLevelParameteriv
(
mTarget
,
_lod
,
GL_TEXTURE_WIDTH
,
&
width
);
glGetTexLevelParameteriv
(
mTarget
,
_lod
,
GL_TEXTURE_WIDTH
,
&
width
);
glGetTexLevelParameteriv
(
mTarget
,
_lod
,
GL_TEXTURE_HEIGHT
,
&
height
);
glGetTexLevelParameteriv
(
mTarget
,
_lod
,
GL_TEXTURE_DEPTH
,
&
depth
);
glGetTexLevelParameteriv
(
mTarget
,
_lod
,
GL_TEXTURE_DEPTH
,
&
depth
);
// fetch the image data
GLubyte
*
imageData
=
new
GLubyte
[
width
*
height
*
getGLTypeSize
(
_type
)
*
4
];
glGetTexImage
(
mTarget
,
_lod
,
GL_RGBA
,
_type
,
(
GLvoid
*
)
imageData
);
int
channels
=
4
;
if
(
mFormat
==
GL_RGB
)
channels
=
3
;
// TODO: check the other channel types
GLubyte
*
imageData
=
new
GLubyte
[
width
*
height
*
getGLTypeSize
(
_type
)
*
channels
];
glGetTexImage
(
mTarget
,
_lod
,
GL_RGB
,
_type
,
(
GLvoid
*
)
imageData
);
// store the image data and meta information in a TextureData object
SharedTextureData
dataObject
=
SharedTextureData
(
new
TextureData
());
...
...
@@ -96,7 +99,7 @@ SharedTextureData Texture::getImageData(GLint _lod, GLint _type) const
dataObject
->
setHeight
(
height
);
dataObject
->
setDepth
(
depth
);
dataObject
->
setType
(
_type
);
dataObject
->
setFormat
(
GL_RGB
A
);
dataObject
->
setFormat
(
GL_RGB
);
dataObject
->
setData
(
imageData
);
// dataObject will take care of freeing imageData
return
dataObject
;
...
...
src/ACGL/OpenGL/Objects/UniformBuffer.cc
View file @
e56585ad
...
...
@@ -11,7 +11,7 @@ using namespace ACGL::OpenGL;
#if (ACGL_OPENGL_VERSION >= 31)
UniformBuffer
::
UniformBuffer
(
const
ptr
::
shared_ptr
<
ShaderProgram
>
&
_shaderProgram
,
const
std
::
string
&
_uboName
)
:
Buffer
(
GL_UNIFORM_BUFFER
)
UniformBuffer
::
UniformBuffer
(
const
ptr
::
shared_ptr
<
const
ShaderProgram
>
&
_shaderProgram
,
const
std
::
string
&
_uboName
)
:
Buffer
(
GL_UNIFORM_BUFFER
)
{
reserveMemory
(
_shaderProgram
->
getUniformBlockSize
(
_uboName
)
);
setUniformOffsets
(
_shaderProgram
->
getUniformOffsetsOfBlock
(
_uboName
)
);
// to enable intuitive setUniform functions
...
...
Write
Preview
Markdown
is supported
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