Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-08-08 04:30:02 +0300
committerMike Erwin <significant.bit@gmail.com>2016-08-08 04:30:02 +0300
commit8e99eec0260f58fdb86713c96582aa84f6252eac (patch)
tree3c5a072e71d36da4063afe7848e4cdfa0596dd65 /source/blender/gpu/intern/gpu_immediate.c
parent11ffbfb36a94d2a461219e338a6213300b69712d (diff)
Gawain: immediate mode set uniforms for active program
Start simple with vec4 uniforms. Add more later.
Diffstat (limited to 'source/blender/gpu/intern/gpu_immediate.c')
-rw-r--r--source/blender/gpu/intern/gpu_immediate.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 80e7877ade0..cea400a5f82 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -187,6 +187,8 @@ typedef struct {
GLuint vbo_id;
GLuint vao_id;
+
+ GLuint bound_program;
} Immediate;
// size of internal buffer -- make this adjustable?
@@ -237,6 +239,27 @@ void immDestroy()
initialized = false;
}
+void immBindProgram(GLuint program)
+ {
+#if TRUST_NO_ONE
+ assert(imm.bound_program == 0);
+#endif
+
+ glUseProgram(program);
+ bind_attrib_locations(&immVertexFormat, program);
+ imm.bound_program = program;
+ }
+
+void immUnbindProgram()
+ {
+#if TRUST_NO_ONE
+ assert(imm.bound_program != 0);
+#endif
+
+ glUseProgram(0);
+ imm.bound_program = 0;
+ }
+
void immBegin(GLenum primitive, unsigned vertex_ct)
{
#if TRUST_NO_ONE
@@ -531,3 +554,14 @@ void immVertex3f(unsigned attrib_id, float x, float y, float z)
immAttrib3f(attrib_id, x, y, z);
immEndVertex();
}
+
+void immUniform4f(const char* name, float x, float y, float z, float w)
+ {
+ int loc = glGetUniformLocation(imm.bound_program, name);
+
+#if TRUST_NO_ONE
+ assert(loc != -1);
+#endif
+
+ glUniform4f(loc, x, y, z, w);
+ }