Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ACGL
acgl
Commits
690a06cd
Commit
690a06cd
authored
Sep 30, 2014
by
Janis Born
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow setting TextureBuffers as ShaderProgram uniforms
parent
6a4b434c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
include/ACGL/OpenGL/Objects/ShaderProgram.hh
include/ACGL/OpenGL/Objects/ShaderProgram.hh
+4
-2
No files found.
include/ACGL/OpenGL/Objects/ShaderProgram.hh
View file @
690a06cd
...
...
@@ -47,6 +47,7 @@
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/OpenGL/Objects/Shader.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
#include <ACGL/OpenGL/Objects/TextureBuffer.hh>
#include <ACGL/OpenGL/Data/LocationMappings.hh>
#include <ACGL/Math/Math.hh>
...
...
@@ -255,8 +256,9 @@ public:
#endif // OpenGL >= 4.0
//! sets a texture uniform to a given texture unit and also binds the texture to the same unit
inline
void
setTexture
(
GLint
_location
,
const
ConstSharedTextureBase
&
_texture
,
GLint
_unit
)
const
{
glUniform1i
(
_location
,
_unit
);
_texture
->
bind
(
_unit
);
}
inline
void
setTexture
(
const
std
::
string
&
_nameInShader
,
const
ConstSharedTextureBase
&
_texture
,
GLint
_unit
)
const
{
setUniform
(
getUniformLocation
(
_nameInShader
),
(
GLint
)
_unit
);
_texture
->
bind
(
_unit
);
}
inline
void
setTexture
(
GLint
_location
,
const
ConstSharedTextureBase
&
_texture
,
GLint
_unit
)
const
{
glUniform1i
(
_location
,
_unit
);
_texture
->
bind
(
_unit
);
}
inline
void
setTexture
(
const
std
::
string
&
_nameInShader
,
const
ConstSharedTextureBase
&
_texture
,
GLint
_unit
)
const
{
setUniform
(
getUniformLocation
(
_nameInShader
),
(
GLint
)
_unit
);
_texture
->
bind
(
_unit
);
}
inline
void
setTexture
(
const
std
::
string
&
_nameInShader
,
const
ConstSharedTextureBuffer
&
_texture
,
GLint
_unit
)
const
{
setUniform
(
getUniformLocation
(
_nameInShader
),
(
GLint
)
_unit
);
_texture
->
bindTexture
(
_unit
);
}
#if (ACGL_OPENGL_VERSION >= 41)
// DSA versions:
...
...
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