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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-09 17:37:26 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-09 17:37:26 +0300
commitf54776b1a677a8650cf3c18111643c0379c51724 (patch)
tree9e67d27f93ef100a5a0a8abd16968cf50a2d7573 /source
parent5dd68e8cb62dd6bd755543fd4f2d152e6840234b (diff)
VBO:
* Fix #19785: curves not drawing with VBO enabled * Fix #19553: duplicate Window crashes with VBO's The convention in Blender was to have GL_VERTEX_ARRAY and GL_NORMAL_ARRAY enabled by default, and other arrays disabled. The VBO drawing code did not take this into account. I've made these now disabled by default, since that makes the code clearer in other places too.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c40
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c8
-rw-r--r--source/blender/gpu/intern/gpu_draw.c8
3 files changed, 28 insertions, 28 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index fa8eee630aa..31c12285293 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3010,7 +3010,7 @@ static int drawDispListwire(ListBase *dlbase)
if(dlbase==NULL) return 1;
- glDisableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
for(dl= dlbase->first; dl; dl= dl->next) {
@@ -3087,7 +3087,7 @@ static int drawDispListwire(ListBase *dlbase)
}
}
- glEnableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
return 0;
@@ -3106,6 +3106,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glGetFloatv(GL_CURRENT_COLOR, curcol);
glEnable(GL_LIGHTING);
+ glEnableClientState(GL_VERTEX_ARRAY);
if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
@@ -3164,10 +3165,12 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
if(dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
else glShadeModel(GL_FLAT);
-
+
+ glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glNormalPointer(GL_FLOAT, 0, dl->nors);
glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
+ glDisableClientState(GL_NORMAL_ARRAY);
}
break;
@@ -3177,32 +3180,35 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
/* voor polys only one normal needed */
- if(index3_nors_incr==0) {
- glDisableClientState(GL_NORMAL_ARRAY);
- glNormal3fv(ndata);
+ if(index3_nors_incr) {
+ glEnableClientState(GL_NORMAL_ARRAY);
+ glNormalPointer(GL_FLOAT, 0, dl->nors);
}
else
- glNormalPointer(GL_FLOAT, 0, dl->nors);
+ glNormal3fv(ndata);
glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- if(index3_nors_incr==0)
- glEnableClientState(GL_NORMAL_ARRAY);
+ if(index3_nors_incr)
+ glDisableClientState(GL_NORMAL_ARRAY);
break;
case DL_INDEX4:
GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
+ glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glNormalPointer(GL_FLOAT, 0, dl->nors);
glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
+ glDisableClientState(GL_NORMAL_ARRAY);
break;
}
dl= dl->next;
}
+ glDisableClientState(GL_VERTEX_ARRAY);
glShadeModel(GL_FLAT);
glDisable(GL_LIGHTING);
glFrontFace(GL_CCW);
@@ -3216,7 +3222,7 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
if(lb==NULL) return;
glShadeModel(GL_SMOOTH);
- glDisableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
dl= lb->first;
@@ -3255,7 +3261,7 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
}
glShadeModel(GL_FLAT);
- glEnableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
@@ -3996,14 +4002,12 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* 6. */
glGetIntegerv(GL_POLYGON_MODE, polygonmode);
- glDisableClientState(GL_NORMAL_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
if(draw_as==PART_DRAW_PATH){
ParticleCacheKey **cache, *path;
float *cd2=0,*cdata2=0;
- glEnableClientState(GL_VERTEX_ARRAY);
-
/* setup gl flags */
if(ob_dt > OB_WIRE) {
glEnableClientState(GL_NORMAL_ARRAY);
@@ -4131,7 +4135,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisableClientState(GL_COLOR_ARRAY);
cpack(0xC0C0C0);
- glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, pdd->vedata);
glDrawArrays(GL_LINES, 0, 2*totve);
@@ -4144,7 +4147,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisable(GL_LIGHTING);
glDisableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
if(states)
MEM_freeN(states);
@@ -4209,7 +4213,6 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj
}
glEnableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnable(GL_COLOR_MATERIAL);
@@ -4319,7 +4322,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glDisableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
glEnable(GL_DEPTH_TEST);
glLineWidth(1.0f);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index a59c263055d..3c178b10561 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -388,15 +388,9 @@ GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, G
DEBUG_VBO("GPU_buffer_setup\n");
- if( globalPool == 0 ) {
+ if( globalPool == 0 )
globalPool = GPU_buffer_pool_new();
- /* somehow GL_NORMAL_ARRAY is enabled on startup and causes edge drawing code to crash */
- glDisableClientState( GL_VERTEX_ARRAY );
- glDisableClientState( GL_NORMAL_ARRAY );
- glDisableClientState( GL_TEXTURE_COORD_ARRAY );
- glDisableClientState( GL_COLOR_ARRAY );
- }
buffer = GPU_buffer_alloc(size,globalPool);
if( buffer == 0 ) {
dm->drawObject->legacy = 1;
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index c2cf4dfa9fd..db6c7fa5ce0 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1276,9 +1276,11 @@ void GPU_state_init(void)
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
- /* default on, disable/enable should be local per function */
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
+ /* default disabled, enable should be local per function */
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1);