Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
fe6c901a
Commit
fe6c901a
authored
Jul 03, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shaders can handle integer parameters (uniforms).
parent
97f914cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
shader.cpp
common/gal/opengl/shader.cpp
+10
-2
shader.h
include/gal/opengl/shader.h
+4
-2
No files found.
common/gal/opengl/shader.cpp
View file @
fe6c901a
...
...
@@ -117,7 +117,7 @@ bool SHADER::Link()
}
void
SHADER
::
AddParameter
(
const
std
::
string
&
aParameterName
)
int
SHADER
::
AddParameter
(
const
std
::
string
&
aParameterName
)
{
GLint
location
=
glGetUniformLocation
(
programNumber
,
aParameterName
.
c_str
()
);
...
...
@@ -125,15 +125,23 @@ void SHADER::AddParameter( const std::string& aParameterName )
{
parameterLocation
.
push_back
(
location
);
}
return
location
;
}
void
SHADER
::
SetParameter
(
int
parameterNumber
,
float
value
)
void
SHADER
::
SetParameter
(
int
parameterNumber
,
float
value
)
const
{
glUniform1f
(
parameterLocation
[
parameterNumber
],
value
);
}
void
SHADER
::
SetParameter
(
int
parameterNumber
,
int
value
)
const
{
glUniform1i
(
parameterLocation
[
parameterNumber
],
value
);
}
int
SHADER
::
GetAttribute
(
std
::
string
aAttributeName
)
const
{
return
glGetAttribLocation
(
programNumber
,
aAttributeName
.
c_str
()
);
...
...
include/gal/opengl/shader.h
View file @
fe6c901a
...
...
@@ -141,8 +141,9 @@ public:
* method using the queue position.
*
* @param aParameterName is the name of the parameter.
* @return the added parameter location.
*/
void
AddParameter
(
const
std
::
string
&
aParameterName
);
int
AddParameter
(
const
std
::
string
&
aParameterName
);
/**
* @brief Set a parameter of the shader.
...
...
@@ -150,7 +151,8 @@ public:
* @param aParameterNumber is the number of the parameter.
* @param aValue is the value of the parameter.
*/
void
SetParameter
(
int
aParameterNumber
,
float
aValue
);
void
SetParameter
(
int
aParameterNumber
,
float
aValue
)
const
;
void
SetParameter
(
int
aParameterNumber
,
int
aValue
)
const
;
/**
* @brief Gets an attribute location.
...
...
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