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:
authorClément Foucault <foucault.clem@gmail.com>2018-02-14 19:55:01 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-02-14 20:59:42 +0300
commit1e9ef2a25e08462a020de3897bc3b68a782c4120 (patch)
tree7e567242b21a874008398e1c2b9d0e684b9195da /intern/gawain
parent0f3bc636c828bcbaa79952375d86a222f4873ecb (diff)
GWN: Add GWN_batch_draw_procedural
This allow to drawn large amounts of primitives without any memory footprint.
Diffstat (limited to 'intern/gawain')
-rw-r--r--intern/gawain/gawain/gwn_batch.h4
-rw-r--r--intern/gawain/src/gwn_batch.c15
2 files changed, 16 insertions, 3 deletions
diff --git a/intern/gawain/gawain/gwn_batch.h b/intern/gawain/gawain/gwn_batch.h
index 9564d8cd587..94cd893f09e 100644
--- a/intern/gawain/gawain/gwn_batch.h
+++ b/intern/gawain/gawain/gwn_batch.h
@@ -85,11 +85,9 @@ void GWN_batch_uniform_4fv(Gwn_Batch*, const char* name, const float data[4]);
void GWN_batch_draw(Gwn_Batch*);
-// clement : temp stuff
void GWN_batch_draw_stupid(Gwn_Batch*, int v_first, int v_count);
void GWN_batch_draw_stupid_instanced(Gwn_Batch*, Gwn_Batch*, int instance_first, int instance_count);
-
-
+void GWN_batch_draw_procedural(Gwn_Batch*, Gwn_PrimType, int v_count);
#if 0 // future plans
diff --git a/intern/gawain/src/gwn_batch.c b/intern/gawain/src/gwn_batch.c
index 9cd5400f144..ec3f98e348c 100644
--- a/intern/gawain/src/gwn_batch.c
+++ b/intern/gawain/src/gwn_batch.c
@@ -417,3 +417,18 @@ void GWN_batch_draw_stupid_instanced(Gwn_Batch* batch_instanced, Gwn_Batch* batc
glBindVertexArray(0);
}
+
+// just draw some vertices and let shader place them where we want.
+void GWN_batch_draw_procedural(Gwn_Batch* batch, Gwn_PrimType prim_type, int v_count)
+ {
+ // we cannot draw without vao ... annoying ...
+ if (batch->vao_id)
+ glBindVertexArray(batch->vao_id);
+ else
+ Batch_prime(batch);
+
+ GLenum type = convert_prim_type_to_gl(prim_type);
+ glDrawArrays(type, 0, v_count);
+
+ glBindVertexArray(0);
+ }