[Bf-blender-cvs] [e20b30a] master: OpenGL: remove glPointSize hack
Mike Erwin
noreply at git.blender.org
Thu Jan 7 22:38:50 CET 2016
Commit: e20b30a1d8573ab687e05da606ee62e2f079a066
Author: Mike Erwin
Date: Mon Jan 4 03:30:18 2016 -0500
Branches: master
https://developer.blender.org/rBe20b30a1d8573ab687e05da606ee62e2f079a066
OpenGL: remove glPointSize hack
===================================================================
M source/blender/editors/include/BIF_glutil.h
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/screen/glutil.c
M source/blender/editors/space_graph/graph_draw.c
M source/blender/editors/space_view3d/drawobject.c
M source/blender/editors/transform/transform.c
M source/blender/editors/uvedit/uvedit_draw.c
===================================================================
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 05b733d..98ee89a 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -185,13 +185,6 @@ void gla2DGetMap(gla2DDrawInfo *di, struct rctf *rect);
void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect);
#endif
-/* use this for platform hacks. glPointSize is solved here */
-void bglBegin(int mode);
-void bglEnd(void);
-// int bglPointHack(void); /* UNUSED */
-void bglVertex3fv(const float vec[3]);
-void bglVertex3f(float x, float y, float z);
-void bglVertex2fv(const float vec[2]);
/* intel gfx cards frontbuffer problem */
// void bglFlush(void); /* UNUSED */
void set_inverted_drawing(int enable);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index a3adf65..e7f5f1b 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1506,7 +1506,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* the points, use aspect to make them visible on edges */
cmp = cuma->curve;
glPointSize(3.0f);
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
for (a = 0; a < cuma->totpoint; a++) {
if (cmp[a].flag & CUMA_SELECT)
UI_ThemeColor(TH_TEXT_HI);
@@ -1514,9 +1514,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
UI_ThemeColor(TH_TEXT);
fac[0] = rect->xmin + zoomx * (cmp[a].x - offsx);
fac[1] = rect->ymin + zoomy * (cmp[a].y - offsy);
- bglVertex2fv(fac);
+ glVertex2fv(fac);
}
- bglEnd();
+ glEnd();
glPointSize(1.0f);
/* restore scissortest */
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 0b83bf9..a870b10 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -730,101 +730,6 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
}
#endif
-/* **************** GL_POINT hack ************************ */
-
-static int curmode = 0;
-static int pointhack = 0;
-static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff};
-
-void bglBegin(int mode)
-{
- curmode = mode;
-
- if (mode == GL_POINTS) {
- float value[4];
- glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if (value[1] < 2.0f) {
- glGetFloatv(GL_POINT_SIZE, value);
- pointhack = iroundf(value[0]);
- if (pointhack > 4) pointhack = 4;
- }
- else {
- glBegin(mode);
- }
- }
-}
-
-#if 0 /* UNUSED */
-int bglPointHack(void)
-{
- float value[4];
- int pointhack_px;
- glGetFloatv(GL_POINT_SIZE_RANGE, value);
- if (value[1] < 2.0f) {
- glGetFloatv(GL_POINT_SIZE, value);
- pointhack_px = floorf(value[0] + 0.5f);
- if (pointhack_px > 4) pointhack_px = 4;
- return pointhack_px;
- }
- return 0;
-}
-#endif
-
-void bglVertex3fv(const float vec[3])
-{
- switch (curmode) {
- case GL_POINTS:
- if (pointhack) {
- glRasterPos3fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot);
- }
- else {
- glVertex3fv(vec);
- }
- break;
- }
-}
-
-void bglVertex3f(float x, float y, float z)
-{
- switch (curmode) {
- case GL_POINTS:
- if (pointhack) {
- glRasterPos3f(x, y, z);
- glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot);
- }
- else {
- glVertex3f(x, y, z);
- }
- break;
- }
-}
-
-void bglVertex2fv(const float vec[2])
-{
- switch (curmode) {
- case GL_POINTS:
- if (pointhack) {
- glRasterPos2fv(vec);
- glBitmap(pointhack, pointhack, (float)pointhack / 2, pointhack / 2, 0.0, 0.0, Squaredot);
- }
- else {
- glVertex2fv(vec);
- }
- break;
- }
-}
-
-
-void bglEnd(void)
-{
- if (pointhack) pointhack = 0;
- else glEnd();
-
-}
/* Uses current OpenGL state to get view matrices for gluProject/gluUnProject */
void bgl_get_mats(bglMats *mats)
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 51865eb..5e17476 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -102,10 +102,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
/* for now, point color is fixed, and is white */
glColor3f(1.0f, 1.0f, 1.0f);
- /* we use bgl points not standard gl points, to workaround vertex
- * drawing bugs that some drivers have (probably legacy ones only though)
- */
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* only draw if visible
* - min/max here are fixed, not relative
@@ -115,7 +112,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
glVertex2f(fed->time, fed->max);
}
}
- bglEnd(); /* GL_POINTS */
+ glEnd(); /* GL_POINTS */
glPointSize(1.0f);
}
@@ -132,10 +129,7 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo),
const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur);
int i;
- /* we use bgl points not standard gl points, to workaround vertex
- * drawing bugs that some drivers have (probably legacy ones only though)
- */
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
for (i = 0; i < fcu->totvert; i++, bezt++) {
/* as an optimization step, only draw those in view
@@ -148,17 +142,17 @@ static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo),
* -
*/
if ((bezt->f2 & SELECT) == sel)
- bglVertex3fv(bezt->vec[1]);
+ glVertex3fv(bezt->vec[1]);
}
else {
/* no check for selection here, as curve is not editable... */
/* XXX perhaps we don't want to even draw points? maybe add an option for that later */
- bglVertex3fv(bezt->vec[1]);
+ glVertex3fv(bezt->vec[1]);
}
}
}
- bglEnd(); /* GL_POINTS */
+ glEnd(); /* GL_POINTS */
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 3dd8468..de79468 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -968,10 +968,10 @@ static void drawshadbuflimits(Lamp *la, float mat[4][4])
glEnd();
glPointSize(3.0);
- bglBegin(GL_POINTS);
- bglVertex3fv(sta);
- bglVertex3fv(end);
- bglEnd();
+ glBegin(GL_POINTS);
+ glVertex3fv(sta);
+ glVertex3fv(end);
+ glEnd();
glPointSize(1.0);
}
@@ -2208,7 +2208,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
UI_ThemeColor(color);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
for (int w = 0; w < lt->pntsw; w++) {
int wxt = (w == 0 || w == lt->pntsw - 1);
@@ -2221,11 +2221,11 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
/* check for active BPoint and ensure selected */
if ((bp == actbp) && (bp->f1 & SELECT)) {
UI_ThemeColor(TH_ACTIVE_VERT);
- bglVertex3fv(dl ? co : bp->vec);
+ glVertex3fv(dl ? co : bp->vec);
UI_ThemeColor(color);
}
else if ((bp->f1 & SELECT) == sel) {
- bglVertex3fv(dl ? co : bp->vec);
+ glVertex3fv(dl ? co : bp->vec);
}
}
}
@@ -2233,7 +2233,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
}
}
- bglEnd();
+ glEnd();
glPointSize(1.0);
}
@@ -2487,16 +2487,16 @@ static void draw_dm_face_centers__mapFunc(void *userData, int index, const float
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) &&
(BM_elem_flag_test(efa, BM_ELEM_SELECT) == data->select))
{
- bglVertex3fv(cent);
+ glVertex3fv(cent);
}
}
static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, bool select)
{
drawBMSelect_userData data = {em->bm, select};
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &data, DM_FOREACH_NOP);
- bglEnd();
+ glEnd();
}
static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3])
@@ -2557,13 +2557,13 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3],
const MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(eve, data->cd_vskin_offset);
if (vs->flag & MVERT_SKIN_ROOT) {
float radius = (vs->radius[0] + vs->radius[1]) * 0.5f;
- bglEnd();
+ glEnd();
glColor4ubv(data->th_skin_root);
drawcircball(GL_LINES, co, radius, data->imat);
glColor4ubv(data->sel ? data->th_vertex_select : data->th_vertex);
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
}
}
@@ -2571,19 +2571,19 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3],
if (eve == data->eve_act) {
glColor4ubv(data->th_editmesh_active);
- bglEnd();
+ glEnd();
glPointSize(data->th_vertex_size);
- bglBegin(GL_POINTS);
- bglVertex3fv(co);
- bglEnd();
+ glBegin(GL_POINTS);
+ glVertex3fv(co);
+ glEnd();
glColor4ubv(data->sel ? data->th_vertex_select : data->th_vertex);
glPointSize(data->th_vertex_size);
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
}
else {
- bglVertex3fv(co);
+ glVertex3fv(co);
}
}
}
@@ -2609,9 +2609,9 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
mul_m4_m4m4(data.imat, rv3d->viewmat, em->ob->obmat);
invert_m4(data.imat);
- bglBegin(GL_POINTS);
+ glBegin(GL_POINTS);
dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data, DM_FOREACH_NOP);
- bglEnd();
+ glEnd();
}
/* Draw edges with color set based on selection */
@@ -3083,7 +3083,7 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, const float co[
const float bweight = BM_ELEM_CD_GET_FLOAT(eve, data->cd_layer_offset);
if (bweight != 0.0f) {
UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, bweight);
- bglVertex3fv(co);
+ glVertex3fv(co);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list