OpenGL: no more display lists
Part of the OpenGL core profile upgrade (T49165) Use the Batch drawing API (GPU_batch.h) when you want do draw something multiple times.
This commit is contained in:
@@ -388,31 +388,20 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu)
|
||||
*/
|
||||
static void draw_fcurve_sample_control(float x, float y, float xscale, float yscale, float hsize)
|
||||
{
|
||||
static GLuint displist = 0;
|
||||
|
||||
/* initialize X shape */
|
||||
if (displist == 0) {
|
||||
displist = glGenLists(1);
|
||||
glNewList(displist, GL_COMPILE);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(-0.7f, -0.7f);
|
||||
glVertex2f(+0.7f, +0.7f);
|
||||
|
||||
glVertex2f(-0.7f, +0.7f);
|
||||
glVertex2f(+0.7f, -0.7f);
|
||||
glEnd(); /* GL_LINES */
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
/* adjust view transform before starting */
|
||||
glTranslatef(x, y, 0.0f);
|
||||
glScalef(1.0f / xscale * hsize, 1.0f / yscale * hsize, 1.0f);
|
||||
|
||||
/* draw! */
|
||||
glCallList(displist);
|
||||
|
||||
|
||||
/* draw X shape */
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(-0.7f, -0.7f);
|
||||
glVertex2f(+0.7f, +0.7f);
|
||||
|
||||
glVertex2f(-0.7f, +0.7f);
|
||||
glVertex2f(+0.7f, -0.7f);
|
||||
glEnd(); /* GL_LINES */
|
||||
|
||||
/* restore view transform */
|
||||
glScalef(xscale / hsize, yscale / hsize, 1.0);
|
||||
glTranslatef(-x, -y, 0.0f);
|
||||
|
||||
@@ -1665,22 +1665,10 @@ bool view3d_camera_border_hack_test = false;
|
||||
|
||||
static void draw_bundle_sphere(void)
|
||||
{
|
||||
static GLuint displist = 0;
|
||||
|
||||
if (displist == 0) {
|
||||
GLUquadricObj *qobj;
|
||||
|
||||
displist = glGenLists(1);
|
||||
glNewList(displist, GL_COMPILE);
|
||||
qobj = gluNewQuadric();
|
||||
gluQuadricDrawStyle(qobj, GLU_FILL);
|
||||
gluSphere(qobj, 0.05, 8, 8);
|
||||
gluDeleteQuadric(qobj);
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
glCallList(displist);
|
||||
GLUquadricObj *qobj = gluNewQuadric();
|
||||
gluQuadricDrawStyle(qobj, GLU_FILL);
|
||||
gluSphere(qobj, 0.05, 8, 8);
|
||||
gluDeleteQuadric(qobj);
|
||||
}
|
||||
|
||||
static void draw_viewport_object_reconstruction(
|
||||
|
||||
@@ -945,11 +945,9 @@ static void draw_dupli_objects_color(
|
||||
LodLevel *savedlod;
|
||||
Base tbase = {NULL};
|
||||
BoundBox bb, *bb_tmp; /* use a copy because draw_object, calls clear_mesh_caches */
|
||||
GLuint displist = 0;
|
||||
unsigned char color_rgb[3];
|
||||
const short dflag_dupli = dflag | DRAW_CONSTCOLOR;
|
||||
short transflag;
|
||||
bool use_displist = false; /* -1 is initialize */
|
||||
char dt;
|
||||
short dtx;
|
||||
DupliApplyData *apply_data;
|
||||
@@ -1014,71 +1012,16 @@ static void draw_dupli_objects_color(
|
||||
glColor3ubv(color_rgb);
|
||||
}
|
||||
|
||||
/* generate displist, test for new object */
|
||||
if (dob_prev && dob_prev->ob != dob->ob) {
|
||||
if (use_displist == true)
|
||||
glDeleteLists(displist, 1);
|
||||
|
||||
use_displist = false;
|
||||
}
|
||||
|
||||
if ((bb_tmp = BKE_object_boundbox_get(dob->ob))) {
|
||||
bb = *bb_tmp; /* must make a copy */
|
||||
testbb = true;
|
||||
}
|
||||
|
||||
if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) {
|
||||
/* generate displist */
|
||||
if (use_displist == false) {
|
||||
|
||||
/* note, since this was added, its checked (dob->type == OB_DUPLIGROUP)
|
||||
* however this is very slow, it was probably needed for the NLA
|
||||
* offset feature (used in group-duplicate.blend but no longer works in 2.5)
|
||||
* so for now it should be ok to - campbell */
|
||||
|
||||
if ( /* if this is the last no need to make a displist */
|
||||
(dob_next == NULL || dob_next->ob != dob->ob) ||
|
||||
/* lamp drawing messes with matrices, could be handled smarter... but this works */
|
||||
(dob->ob->type == OB_LAMP) ||
|
||||
(dob->type == OB_DUPLIGROUP && dob->animated) ||
|
||||
!bb_tmp ||
|
||||
draw_glsl_material(scene, dob->ob, v3d, dt) ||
|
||||
check_object_draw_texture(scene, v3d, dt) ||
|
||||
(v3d->flag2 & V3D_SOLID_MATCAP) != 0)
|
||||
{
|
||||
// printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name + 2);
|
||||
use_displist = false;
|
||||
}
|
||||
else {
|
||||
// printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2);
|
||||
|
||||
/* disable boundbox check for list creation */
|
||||
BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 1);
|
||||
/* need this for next part of code */
|
||||
unit_m4(dob->ob->obmat); /* obmat gets restored */
|
||||
|
||||
displist = glGenLists(1);
|
||||
glNewList(displist, GL_COMPILE);
|
||||
draw_object(scene, sl, ar, v3d, &tbase, dflag_dupli);
|
||||
glEndList();
|
||||
|
||||
use_displist = true;
|
||||
BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (use_displist) {
|
||||
glPushMatrix();
|
||||
glMultMatrixf(dob->mat);
|
||||
glCallList(displist);
|
||||
glPopMatrix();
|
||||
}
|
||||
else {
|
||||
copy_m4_m4(dob->ob->obmat, dob->mat);
|
||||
GPU_begin_dupli_object(dob);
|
||||
draw_object(scene, sl, ar, v3d, &tbase, dflag_dupli);
|
||||
GPU_end_dupli_object();
|
||||
}
|
||||
copy_m4_m4(dob->ob->obmat, dob->mat);
|
||||
GPU_begin_dupli_object(dob);
|
||||
draw_object(scene, sl, ar, v3d, &tbase, dflag_dupli);
|
||||
GPU_end_dupli_object();
|
||||
}
|
||||
|
||||
tbase.object->dt = dt;
|
||||
@@ -1093,9 +1036,6 @@ static void draw_dupli_objects_color(
|
||||
}
|
||||
|
||||
free_object_duplilist(lb);
|
||||
|
||||
if (use_displist)
|
||||
glDeleteLists(displist, 1);
|
||||
}
|
||||
|
||||
void draw_dupli_objects(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, BaseLegacy *base)
|
||||
|
||||
@@ -51,7 +51,6 @@ IndexedFaceSet::IndexedFaceSet() : Rep()
|
||||
_MISize = 0;
|
||||
_TIndices = NULL;
|
||||
_TISize = 0;
|
||||
_displayList = 0;
|
||||
}
|
||||
|
||||
IndexedFaceSet::IndexedFaceSet(float *iVertices, unsigned iVSize, float *iNormals, unsigned iNSize,
|
||||
@@ -150,8 +149,6 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, unsigned iVSize, float *iNormal
|
||||
_TISize = iTISize;
|
||||
_TIndices = iTIndices;
|
||||
}
|
||||
|
||||
_displayList = 0;
|
||||
}
|
||||
|
||||
IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet& iBrother) : Rep(iBrother)
|
||||
@@ -215,8 +212,6 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet& iBrother) : Rep(iBrother)
|
||||
_TIndices = new unsigned[_TISize];
|
||||
memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned));
|
||||
}
|
||||
|
||||
_displayList = 0;
|
||||
}
|
||||
|
||||
IndexedFaceSet::~IndexedFaceSet()
|
||||
@@ -276,10 +271,6 @@ IndexedFaceSet::~IndexedFaceSet()
|
||||
delete[] _TIndices;
|
||||
_TIndices = NULL;
|
||||
}
|
||||
|
||||
// should find a way to deallocates the displayList
|
||||
// glDeleteLists(GLuint list, GLSizei range)
|
||||
_displayList = 0;
|
||||
}
|
||||
|
||||
void IndexedFaceSet::accept(SceneVisitor& v)
|
||||
|
||||
@@ -150,8 +150,6 @@ public:
|
||||
std::swap(_MISize, ioOther._MISize);
|
||||
std::swap(_TISize, ioOther._TISize);
|
||||
|
||||
std::swap(_displayList, ioOther._displayList);
|
||||
|
||||
Rep::swap(ioOther);
|
||||
}
|
||||
|
||||
@@ -173,12 +171,6 @@ public:
|
||||
/*! Compute the Bounding Box */
|
||||
virtual void ComputeBBox();
|
||||
|
||||
/*! modifiers */
|
||||
inline void setDisplayList(unsigned int index)
|
||||
{
|
||||
_displayList = index;
|
||||
}
|
||||
|
||||
/*! Accessors */
|
||||
virtual const float *vertices() const
|
||||
{
|
||||
@@ -280,11 +272,6 @@ public:
|
||||
return _TISize;
|
||||
}
|
||||
|
||||
inline unsigned int displayList() const
|
||||
{
|
||||
return _displayList;
|
||||
}
|
||||
|
||||
protected:
|
||||
float *_Vertices;
|
||||
float *_Normals;
|
||||
@@ -311,8 +298,6 @@ protected:
|
||||
unsigned _MISize;
|
||||
unsigned _TISize;
|
||||
|
||||
unsigned int _displayList;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedFaceSet")
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user