Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_buffers.c
| Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
| static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type); | static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type); | ||||
| static const GPUBufferTypeSettings gpu_buffer_type_settings[] = { | static const GPUBufferTypeSettings gpu_buffer_type_settings[] = { | ||||
| /* vertex */ | /* vertex */ | ||||
| {GL_ARRAY_BUFFER, 3}, | {GL_ARRAY_BUFFER, 3}, | ||||
| /* normal */ | /* normal */ | ||||
| {GL_ARRAY_BUFFER, 4}, /* we copy 3 shorts per normal but we add a fourth for alignment */ | {GL_ARRAY_BUFFER, 4}, /* we copy 3 shorts per normal but we add a fourth for alignment */ | ||||
| /* mcol */ | /* mcol */ | ||||
| {GL_ARRAY_BUFFER, 3}, | {GL_ARRAY_BUFFER, 4}, | ||||
| /* uv */ | /* uv */ | ||||
| {GL_ARRAY_BUFFER, 2}, | {GL_ARRAY_BUFFER, 2}, | ||||
| /* uv for texpaint */ | /* uv for texpaint */ | ||||
| {GL_ARRAY_BUFFER, 4}, | {GL_ARRAY_BUFFER, 4}, | ||||
| /* edge */ | /* edge */ | ||||
| {GL_ELEMENT_ARRAY_BUFFER, 2}, | {GL_ELEMENT_ARRAY_BUFFER, 2}, | ||||
| /* uv edge */ | /* uv edge */ | ||||
| {GL_ELEMENT_ARRAY_BUFFER, 4}, | {GL_ELEMENT_ARRAY_BUFFER, 4}, | ||||
| ▲ Show 20 Lines • Show All 591 Lines • ▼ Show 20 Lines | else if ((dm->dirty & DM_DIRTY_MCOL_UPDATE_DRAW) || (colType != dm->drawObject->colType)) { | ||||
| dm->drawObject->colType = colType; | dm->drawObject->colType = colType; | ||||
| } | } | ||||
| if (!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR, update)) | if (!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR, update)) | ||||
| return; | return; | ||||
| glEnableClientState(GL_COLOR_ARRAY); | glEnableClientState(GL_COLOR_ARRAY); | ||||
| glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->colors->id); | glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->colors->id); | ||||
| glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0); | glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0); | ||||
| GLStates |= GPU_BUFFER_COLOR_STATE; | GLStates |= GPU_BUFFER_COLOR_STATE; | ||||
| } | } | ||||
| void GPU_buffer_bind_as_color(GPUBuffer *buffer) | void GPU_buffer_bind_as_color(GPUBuffer *buffer) | ||||
| { | { | ||||
| glEnableClientState(GL_COLOR_ARRAY); | glEnableClientState(GL_COLOR_ARRAY); | ||||
| glBindBuffer(GL_ARRAY_BUFFER, buffer->id); | glBindBuffer(GL_ARRAY_BUFFER, buffer->id); | ||||
| ▲ Show 20 Lines • Show All 1,386 Lines • Show Last 20 Lines | |||||