aboutsummaryrefslogtreecommitdiff
path: root/src/shader/wrap
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-12-18 21:08:20 +0100
committerAdrian Kummerlaender2018-12-18 21:08:20 +0100
commit6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf (patch)
tree4dabb7259102afe4ddca25293ed3cc77640f95f8 /src/shader/wrap
parentd58c4cbeb95e25ea08994e4d39f657d078a33782 (diff)
downloadcompustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.gz
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.bz2
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.lz
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.xz
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.tar.zst
compustream-6f6073be5de8c8598c4af7f38c90c3f83b5bf1bf.zip
Hacky mouse-based fluid interaction
Diffstat (limited to 'src/shader/wrap')
-rw-r--r--src/shader/wrap/compute_shader.cc12
-rw-r--r--src/shader/wrap/compute_shader.h3
2 files changed, 11 insertions, 4 deletions
diff --git a/src/shader/wrap/compute_shader.cc b/src/shader/wrap/compute_shader.cc
index 54f50f8..134db2d 100644
--- a/src/shader/wrap/compute_shader.cc
+++ b/src/shader/wrap/compute_shader.cc
@@ -34,18 +34,24 @@ bool ComputeShader::isGood() const {
return _good;
}
-GLuint ComputeShader::setUniform(const std::string& name, float x, float y) const {
+GLuint ComputeShader::setUniform(const std::string& name, int value) const {
GLuint id = util::getUniform(_id, name);
- glUniform2f(id, x, y);
+ glUniform1i(id, value);
return id;
}
-GLuint ComputeShader::setUniform(const std::string& name, unsigned int value) const {
+GLuint ComputeShader::setUniform(const std::string& name, GLuint value) const {
GLuint id = util::getUniform(_id, name);
glUniform1ui(id, value);
return id;
}
+GLuint ComputeShader::setUniform(const std::string& name, float x, float y) const {
+ GLuint id = util::getUniform(_id, name);
+ glUniform2f(id, x, y);
+ return id;
+}
+
void ComputeShader::workOn(const std::vector<GLuint>& buffers) const {
glBindBuffersBase(GL_SHADER_STORAGE_BUFFER, 1, buffers.size(), buffers.data());
}
diff --git a/src/shader/wrap/compute_shader.h b/src/shader/wrap/compute_shader.h
index f2ab182..d7ef729 100644
--- a/src/shader/wrap/compute_shader.h
+++ b/src/shader/wrap/compute_shader.h
@@ -26,8 +26,9 @@ public:
bool isGood() const;
+ GLuint setUniform(const std::string& name, int value) const;
+ GLuint setUniform(const std::string& name, GLuint value) const;
GLuint setUniform(const std::string& name, float x, float y) const;
- GLuint setUniform(const std::string& name, unsigned int value) const;
void workOn(const std::vector<GLuint>& buffers) const;