Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_select.c
| Show All 28 Lines | |||||
| * Interface for accessing gpu-related methods for selection. The semantics will be | * Interface for accessing gpu-related methods for selection. The semantics will be | ||||
| * similar to glRenderMode(GL_SELECT) since the goal is to maintain compatibility. | * similar to glRenderMode(GL_SELECT) since the goal is to maintain compatibility. | ||||
| */ | */ | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include "GPU_select.h" | #include "GPU_select.h" | ||||
| #include "GPU_extensions.h" | #include "GPU_extensions.h" | ||||
| #include "GPU_glew.h" | #include "GPU_glew.h" | ||||
| #include "GPU_legacy_stubs.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "gpu_select_private.h" | #include "gpu_select_private.h" | ||||
| ▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, const rcti *input, char mode, int oldhits) | ||||
| else { | else { | ||||
| g_select_state.algorithm = ALGO_GL_QUERY; | g_select_state.algorithm = ALGO_GL_QUERY; | ||||
| } | } | ||||
| switch (g_select_state.algorithm) { | switch (g_select_state.algorithm) { | ||||
| case ALGO_GL_LEGACY: | case ALGO_GL_LEGACY: | ||||
| { | { | ||||
| g_select_state.use_cache = false; | g_select_state.use_cache = false; | ||||
| glSelectBuffer(bufsize, (GLuint *)buffer); | oldSelectBuffer(bufsize, (GLuint *)buffer); | ||||
| glRenderMode(GL_SELECT); | oldRenderMode(GL_SELECT); | ||||
| glInitNames(); | oldInitNames(); | ||||
| glPushName(-1); | oldPushName(-1); | ||||
| break; | break; | ||||
| } | } | ||||
| case ALGO_GL_QUERY: | case ALGO_GL_QUERY: | ||||
| { | { | ||||
| g_select_state.use_cache = false; | g_select_state.use_cache = false; | ||||
| gpu_select_query_begin((unsigned int (*)[4])buffer, bufsize / 4, input, mode, oldhits); | gpu_select_query_begin((unsigned int (*)[4])buffer, bufsize / 4, input, mode, oldhits); | ||||
| break; | break; | ||||
| } | } | ||||
| Show All 16 Lines | |||||
| { | { | ||||
| /* if no selection mode active, ignore */ | /* if no selection mode active, ignore */ | ||||
| if (!g_select_state.select_is_active) | if (!g_select_state.select_is_active) | ||||
| return true; | return true; | ||||
| switch (g_select_state.algorithm) { | switch (g_select_state.algorithm) { | ||||
| case ALGO_GL_LEGACY: | case ALGO_GL_LEGACY: | ||||
| { | { | ||||
| glLoadName(id); | oldLoadName(id); | ||||
| return true; | return true; | ||||
| } | } | ||||
| case ALGO_GL_QUERY: | case ALGO_GL_QUERY: | ||||
| { | { | ||||
| return gpu_select_query_load_id(id); | return gpu_select_query_load_id(id); | ||||
| } | } | ||||
| default: /* ALGO_GL_PICK */ | default: /* ALGO_GL_PICK */ | ||||
| { | { | ||||
| Show All 9 Lines | |||||
| */ | */ | ||||
| unsigned int GPU_select_end(void) | unsigned int GPU_select_end(void) | ||||
| { | { | ||||
| unsigned int hits = 0; | unsigned int hits = 0; | ||||
| switch (g_select_state.algorithm) { | switch (g_select_state.algorithm) { | ||||
| case ALGO_GL_LEGACY: | case ALGO_GL_LEGACY: | ||||
| { | { | ||||
| glPopName(); | oldPopName(); | ||||
| hits = glRenderMode(GL_RENDER); | hits = oldRenderMode(GL_RENDER); | ||||
| break; | break; | ||||
| } | } | ||||
| case ALGO_GL_QUERY: | case ALGO_GL_QUERY: | ||||
| { | { | ||||
| hits = gpu_select_query_end(); | hits = gpu_select_query_end(); | ||||
| break; | break; | ||||
| } | } | ||||
| default: /* ALGO_GL_PICK */ | default: /* ALGO_GL_PICK */ | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||