diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-07-15 19:50:02 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-07-15 19:50:02 +0300 |
commit | 13c39e90b3c0ec6a470fbc3696cd73c2a65b49cf (patch) | |
tree | c4e7113f2dd911e5438eb68d4e9f49efa7e1fe1e /source/blender/gpu/intern/gpu_buffers.c | |
parent | 2daa4db8a0cb23dfd0ca417ead2413e20ec18fe7 (diff) |
VBO offscreen selection drawing, cdderivedmesh
Get rid of legacy drawing, it's only used for selection,
in which case we can prepare a temporary color buffer and draw
at once. Code is not complete here because we still redundantly
set the draw color in the draw function and don't ommit hidden
faces automatically. Still it works 100% without immediate mode
now.
Diffstat (limited to 'source/blender/gpu/intern/gpu_buffers.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index ac6329910c9..9b588512794 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -764,6 +764,21 @@ void GPU_color_setup(DerivedMesh *dm, int colType) GLStates |= GPU_BUFFER_COLOR_STATE; } +void GPU_buffer_bind_as_color(GPUBuffer *buffer) +{ + glEnableClientState(GL_COLOR_ARRAY); + if (buffer->use_vbo) { + glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id); + glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0); + } + else { + glColorPointer(4, GL_UNSIGNED_BYTE, 0, buffer->pointer); + } + + GLStates |= GPU_BUFFER_COLOR_STATE; +} + + void GPU_edge_setup(DerivedMesh *dm) { if (!gpu_buffer_setup_common(dm, GPU_BUFFER_EDGE)) |