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
7b40da95
Commit
7b40da95
authored
Feb 01, 2013
by
Robert Menzel
Browse files
cleanups and additional TextureBuffer constructor
parent
e703e047
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Objects/Texture.hh
View file @
7b40da95
...
...
@@ -46,8 +46,24 @@ public:
glDeleteTextures(1, &mObjectName);
}
inline GLuint getObjectName () const { return mObjectName; }
inline GLenum getTarget () const { return mTarget; }
GLuint getObjectName () const { return mObjectName; }
GLenum getTarget () const { return mTarget; }
GLsizei getWidth () const;
GLsizei getHeight () const;
GLsizei getDepth () const;
glm::uvec3 getSize () const { return glm::uvec3( getWidth(), getHeight(), getDepth() ); }
GLenum getInternalFormat () const;
GLenum getFormat () const;
GLenum getType () const;
GLint getMinFilter () const;
GLint getMagFilter () const;
#ifndef ACGL_OPENGLES_VERSION_20
GLenum getWrapS () const;
GLenum getWrapT () const;
GLenum getWrapR () const;
#endif // ACGL_OPENGLES_VERSION_20
//! Activate texture unit and bind this texture.
void bind(GLuint _textureUnit = 0) const
...
...
@@ -78,7 +94,7 @@ ACGL_SMARTPOINTER_TYPEDEFS(TextureNG)
class
TextureBuffer
:
public
Buffer
{
public:
// _reservedMemory
is counted
in bytes
//
create a new BufferObject with
_reservedMemory
space (
in bytes
!)
TextureBuffer
(
GLenum
_dataType
,
size_t
_reservedMemory
=
1
)
:
Buffer
(
GL_TEXTURE_BUFFER
)
{
glGenTextures
(
1
,
&
mTextureObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
...
...
@@ -89,6 +105,21 @@ public:
attachBufferToTexture
();
}
// use an existing BufferObject
TextureBuffer
(
GLenum
_dataType
,
SharedBufferObject
_pBuffer
)
:
Buffer
(
_pBuffer
,
GL_TEXTURE_BUFFER
)
{
glGenTextures
(
1
,
&
mTextureObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate texture object for texture buffer!"
<<
std
::
endl
;
}
mDataType
=
_dataType
;
attachBufferToTexture
();
}
~
TextureBuffer
()
{
setBufferObject
(
SharedBufferObject
()
);
// detach the Buffer
glDeleteTextures
(
1
,
&
mTextureObjectName
);
}
//! the GL buffer can get changed at any time
void
setBufferObject
(
SharedBufferObject
_pBuffer
)
{
Buffer
::
setBufferObject
(
_pBuffer
);
...
...
@@ -100,17 +131,14 @@ public:
}
}
~
TextureBuffer
()
{
setBufferObject
(
SharedBufferObject
()
);
// detach the Buffer
glDeleteTextures
(
1
,
&
mTextureObjectName
);
}
//! Bind the texture part to access it from a shader
void
bindTexture
(
GLuint
_textureUnit
=
0
)
const
{
glActiveTexture
(
GL_TEXTURE0
+
_textureUnit
);
glBindTexture
(
GL_TEXTURE_BUFFER
,
mTextureObjectName
);
openGLRareError
();
}
//! Bind the buffer part to change the data
void
bindBuffer
()
const
{
Buffer
::
bind
();
}
...
...
include/ACGL/OpenGL/Tools.hh
View file @
7b40da95
...
...
@@ -95,8 +95,8 @@ bool doesSupportTessellationShader();
bool
doesSupportComputeShader
();
//
d
efine the shader kinds for older GL versions so the file extension detection
// can work correctly
//
D
efine the shader kinds for older
and embedded
GL versions so the file extension detection
// can work correctly
.
#ifndef GL_GEOMETRY_SHADER
#define GL_GEOMETRY_SHADER 0x8DD9
#endif
...
...
src/ACGL/OpenGL/Objects/Texture.cc
View file @
7b40da95
...
...
@@ -9,7 +9,6 @@
using
namespace
ACGL
::
OpenGL
;
#ifndef ACGL_OPENGLES_VERSION_20
void
Texture
::
setWrapS
(
GLenum
_wrapS
)
{
...
...
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