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
8e27a4ed
Commit
8e27a4ed
authored
Dec 01, 2011
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the option to set arrays of uniforms for basic datatypes
parent
2f7b1f60
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
include/ACGL/OpenGL/Objects/ShaderProgram.hh
include/ACGL/OpenGL/Objects/ShaderProgram.hh
+23
-0
No files found.
include/ACGL/OpenGL/Objects/ShaderProgram.hh
View file @
8e27a4ed
...
...
@@ -115,14 +115,17 @@ public:
// ============================================================================================ UNIFORMS \/
// ===================================================================================================== \/
// int by location
inline
void
setUniform
(
GLint
_location
,
GLint
_v
)
const
{
glUniform1i
(
_location
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
GLsizei
_n
,
GLint
*
_v
)
const
{
glUniform1iv
(
_location
,
_n
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
ivec2
&
_v
)
const
{
glUniform2iv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
ivec3
&
_v
)
const
{
glUniform3iv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
ivec4
&
_v
)
const
{
glUniform4iv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
// int DSA by location
inline
void
setProgramUniform
(
GLint
_location
,
GLint
_v
)
const
{
glProgramUniform1i
(
mObjectName
,
_location
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
GLsizei
_n
,
GLint
*
_v
)
const
{
glProgramUniform1iv
(
mObjectName
,
_location
,
_n
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
ivec2
&
_v
)
const
{
glProgramUniform2iv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
ivec3
&
_v
)
const
{
glProgramUniform3iv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
ivec4
&
_v
)
const
{
glProgramUniform4iv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
...
...
@@ -130,12 +133,14 @@ public:
#if (ACGL_OPENGL_VERSION >= 30)
// unsigned int by location
inline
void
setUniform
(
GLint
_location
,
GLuint
_v
)
const
{
glUniform1ui
(
_location
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
GLsizei
_n
,
GLuint
*
_v
)
const
{
glUniform1uiv
(
_location
,
_n
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
uvec2
&
_v
)
const
{
glUniform2uiv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
uvec3
&
_v
)
const
{
glUniform3uiv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
uvec4
&
_v
)
const
{
glUniform4uiv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
// unsigned int DSA by location
inline
void
setProgramUniform
(
GLint
_location
,
GLuint
_v
)
const
{
glProgramUniform1ui
(
mObjectName
,
_location
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
GLsizei
_n
,
GLuint
*
_v
)
const
{
glProgramUniform1uiv
(
mObjectName
,
_location
,
_n
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
uvec2
&
_v
)
const
{
glProgramUniform2uiv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
uvec3
&
_v
)
const
{
glProgramUniform3uiv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
uvec4
&
_v
)
const
{
glProgramUniform4uiv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
...
...
@@ -143,12 +148,14 @@ public:
// float by location
inline
void
setUniform
(
GLint
_location
,
GLfloat
_v
)
const
{
glUniform1f
(
_location
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
GLsizei
_n
,
GLfloat
*
_v
)
const
{
glUniform1fv
(
_location
,
_n
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
vec2
&
_v
)
const
{
glUniform2fv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
vec3
&
_v
)
const
{
glUniform3fv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
vec4
&
_v
)
const
{
glUniform4fv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
// float DSA by location
inline
void
setProgramUniform
(
GLint
_location
,
GLfloat
_v
)
const
{
glProgramUniform1f
(
mObjectName
,
_location
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
GLsizei
_n
,
GLfloat
*
_v
)
const
{
glProgramUniform1fv
(
mObjectName
,
_location
,
_n
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
vec2
&
_v
)
const
{
glProgramUniform2fv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
vec3
&
_v
)
const
{
glProgramUniform3fv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
vec4
&
_v
)
const
{
glProgramUniform4fv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
...
...
@@ -156,12 +163,14 @@ public:
#if (ACGL_OPENGL_VERSION >= 40)
// double by location
inline
void
setUniform
(
GLint
_location
,
GLdouble
_v
)
const
{
glUniform1d
(
_location
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
GLsizei
_n
,
GLdouble
*
_v
)
const
{
glUniform1dv
(
_location
,
_n
,
_v
);
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
dvec2
&
_v
)
const
{
glUniform2dv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
dvec3
&
_v
)
const
{
glUniform3dv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setUniform
(
GLint
_location
,
const
glm
::
dvec4
&
_v
)
const
{
glUniform4dv
(
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
// double DSA by location
inline
void
setProgramUniform
(
GLint
_location
,
GLdouble
_v
)
const
{
glProgramUniform1d
(
mObjectName
,
_location
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
GLsizei
_n
,
GLdouble
*
_v
)
const
{
glProgramUniform1dv
(
mObjectName
,
_location
,
_n
,
_v
);
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
dvec2
&
_v
)
const
{
glProgramUniform2dv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
dvec3
&
_v
)
const
{
glProgramUniform3dv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
inline
void
setProgramUniform
(
GLint
_location
,
const
glm
::
dvec4
&
_v
)
const
{
glProgramUniform4dv
(
mObjectName
,
_location
,
1
,
glm
::
value_ptr
(
_v
));
}
...
...
@@ -235,6 +244,20 @@ public:
setProgramUniform
(
getUniformLocation
(
_nameInShader
),
_v
);
}
// normal for arrays:
template
<
typename
T
>
inline
void
setUniform
(
const
std
::
string
&
_nameInShader
,
GLsizei
_n
,
T
_v
)
const
{
setUniform
(
getUniformLocation
(
_nameInShader
),
_n
,
_v
);
}
// DSA for arrays:
template
<
typename
T
>
inline
void
setProgramUniform
(
const
std
::
string
&
_nameInShader
,
GLsizei
_n
,
T
_v
)
const
{
setProgramUniform
(
getUniformLocation
(
_nameInShader
),
_n
,
_v
);
}
// normal for matrices with additional transpose parameter
template
<
typename
T
>
inline
void
setUniform
(
const
std
::
string
&
_nameInShader
,
T
_v
,
GLboolean
_transpose
)
const
...
...
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