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
a79ddb60
Commit
a79ddb60
authored
Feb 03, 2012
by
Robert Menzel
Browse files
added sampler objects
parent
16474f3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Objects/Sampler.hh
0 → 100644
View file @
a79ddb60
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OPENGL_OBJECTS_SAMPLER_HH
#define ACGL_OPENGL_OBJECTS_SAMPLER_HH
#include <ACGL/ACGL.hh>
#include <ACGL/Base/Macros.hh>
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/OpenGL/Tools.hh>
namespace
ACGL
{
namespace
OpenGL
{
/*
* OpenGL Sampler Objects
*/
#if (ACGL_OPENGL_VERSION >= 33)
class
Sampler
{
ACGL_NOT_COPYABLE
(
Sampler
)
public:
Sampler
()
{
glGenSamplers
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate sampler!"
<<
std
::
endl
;
mObjectName
=
0
;
return
;
}
}
~
Sampler
(
void
)
{
// sampler 0 will get ignored by OpenGL
glDeleteSamplers
(
1
,
&
mObjectName
);
}
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline
GLuint
operator
()
(
void
)
const
{
return
mObjectName
;
}
inline
GLuint
getObjectName
(
void
)
const
{
return
mObjectName
;
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
// ===================================================================================================== \/
inline
void
bind
(
GLuint
_textureUnit
)
const
{
glBindSampler
(
_textureUnit
,
mObjectName
);
// yes, no adding of GL_TEXTURE0 !
openGLRareError
();
}
//! generic parameter setting
inline
void
parameter
(
GLenum
_parameterName
,
GLint
_parameter
)
{
glSamplerParameteri
(
mObjectName
,
_parameterName
,
_parameter
);
}
inline
void
parameter
(
GLenum
_parameterName
,
GLfloat
_parameter
)
{
glSamplerParameterf
(
mObjectName
,
_parameterName
,
_parameter
);
}
private:
GLuint
mObjectName
;
};
ACGL_SHARED_TYPEDEF
(
Sampler
)
#endif // OpenGL >= 3.3
}
// OpenGL
}
// ACGL
#endif // ACGL_OPENGL_OBJECTS_SAMPLER_HH
src/ACGL/OpenGL/Objects/Sampler.cc
0 → 100644
View file @
a79ddb60
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