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:
authorTon Roosendaal <ton@blender.org>2004-07-11 01:35:17 +0400
committerTon Roosendaal <ton@blender.org>2004-07-11 01:35:17 +0400
commiteac4e86539b4cba3d4756a86783037ed0b3bea38 (patch)
treef936dd72208ce6895e697353988ddd0ce1b5dbb0 /source
parentd5272c665f17e39904a3c9fb3c58f1b8cca48300 (diff)
Long on the todolist: a patch to have pointsize working on systems that
don't have them larger than 1, since vertices are drawn with it. It is solved by patching code with minimal confusement. So you can get automatic patched glPoints with: bglBegin(GL_POINTS); bglVertex3fv(vector); bglEnd(); In glutil.c the wrapper can be found, that checks for maximum Pointsize, and bypasses it to a glBitmap then.
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_glutil.h7
-rw-r--r--source/blender/include/BIF_interface.h3
-rw-r--r--source/blender/src/buttons_shading.c10
-rw-r--r--source/blender/src/drawimage.c24
-rw-r--r--source/blender/src/drawipo.c14
-rw-r--r--source/blender/src/drawobject.c43
-rw-r--r--source/blender/src/glutil.c62
7 files changed, 113 insertions, 50 deletions
diff --git a/source/blender/include/BIF_glutil.h b/source/blender/include/BIF_glutil.h
index baaaf4cf40e..b04705c7b02 100644
--- a/source/blender/include/BIF_glutil.h
+++ b/source/blender/include/BIF_glutil.h
@@ -187,5 +187,12 @@ void gla2DDrawTranslatePtv (gla2DDrawInfo *di, float world[2], int screen_r[2]
*/
void glaEnd2DDraw (gla2DDrawInfo *di);
+/* use this for platform hacks. for now glPointSize is solved here */
+void bglBegin(int mode);
+void bglEnd(void);
+void bglVertex3fv(float *vec);
+void bglVertex2fv(float *vec);
+
+
#endif /* BIF_GLUTIL_H */
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index 048417dff0a..30b79c09136 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -178,6 +178,9 @@ void uiFreeBlocksWin(struct ListBase *lb, int win);
uiBlock *uiNewBlock(struct ListBase *lb, char *name, short dt, short font, short win);
uiBlock *uiGetBlock(char *name, struct ScrArea *sa);
+void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char mode);
+
+
/* automatic aligning, horiz or verical */
void uiBlockBeginAlign(uiBlock *block);
void uiBlockEndAlign(uiBlock *block);
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 5bd180dccb3..dda33e584a0 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -1473,16 +1473,6 @@ void do_radiobuts(unsigned short event)
}
-#if 0
- char str[128];
-
- rad_status_str(str);
- cpack(0);
- glRasterPos2i(210, 189);
- BMF_DrawString(uiBlockGetCurFont(block), str);
-
-#endif
-
static void radio_panel_calculation(Radio *rad, int flag)
{
uiBlock *block;
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 7ec43f486a4..d55e7380dde 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -468,15 +468,15 @@ void draw_tfaces(void)
a= me->totface;
while(a--) {
if(mface->v3 && (tface->flag & TF_SELECT) ) {
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
- if(tface->flag & TF_SEL1); else glVertex2fv(tface->uv[0]);
- if(tface->flag & TF_SEL2); else glVertex2fv(tface->uv[1]);
- if(tface->flag & TF_SEL3); else glVertex2fv(tface->uv[2]);
+ if(tface->flag & TF_SEL1); else bglVertex2fv(tface->uv[0]);
+ if(tface->flag & TF_SEL2); else bglVertex2fv(tface->uv[1]);
+ if(tface->flag & TF_SEL3); else bglVertex2fv(tface->uv[2]);
if(mface->v4) {
- if(tface->flag & TF_SEL4); else glVertex2fv(tface->uv[3]);
+ if(tface->flag & TF_SEL4); else bglVertex2fv(tface->uv[3]);
}
- glEnd();
+ bglEnd();
}
tface++;
mface++;
@@ -489,15 +489,15 @@ void draw_tfaces(void)
a= me->totface;
while(a--) {
if(mface->v3 && (tface->flag & TF_SELECT) ) {
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
- if(tface->flag & TF_SEL1) glVertex2fv(tface->uv[0]);
- if(tface->flag & TF_SEL2) glVertex2fv(tface->uv[1]);
- if(tface->flag & TF_SEL3) glVertex2fv(tface->uv[2]);
+ if(tface->flag & TF_SEL1) bglVertex2fv(tface->uv[0]);
+ if(tface->flag & TF_SEL2) bglVertex2fv(tface->uv[1]);
+ if(tface->flag & TF_SEL3) bglVertex2fv(tface->uv[2]);
if(mface->v4) {
- if(tface->flag & TF_SEL4) glVertex2fv(tface->uv[3]);
+ if(tface->flag & TF_SEL4) bglVertex2fv(tface->uv[3]);
}
- glEnd();
+ bglEnd();
}
tface++;
mface++;
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index f0cd4ce13ca..7eabd8ee523 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -896,7 +896,7 @@ static void draw_ipovertices(int sel)
* on TNT2 / Linux with NVidia's drivers
* (at least up to ver. 4349) */
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
bezt= ei->icu->bezt;
a= ei->icu->totvert;
@@ -917,7 +917,7 @@ static void draw_ipovertices(int sel)
while(b<31) {
if(val & (1<<b)) {
v1[1]= b+1;
- glVertex3fv(v1);
+ bglVertex3fv(v1);
}
b++;
}
@@ -928,23 +928,23 @@ static void draw_ipovertices(int sel)
if(ei->flag & IPO_EDIT) {
if(ei->icu->ipo==IPO_BEZ) {
if( (bezt->f1 & 1) == sel )
- glVertex3fv(bezt->vec[0]);
+ bglVertex3fv(bezt->vec[0]);
if( (bezt->f3 & 1) == sel )
- glVertex3fv(bezt->vec[2]);
+ bglVertex3fv(bezt->vec[2]);
}
if( (bezt->f2 & 1) == sel )
- glVertex3fv(bezt->vec[1]);
+ bglVertex3fv(bezt->vec[1]);
}
else {
- glVertex3fv(bezt->vec[1]);
+ bglVertex3fv(bezt->vec[1]);
}
}
bezt++;
}
- glEnd();
+ bglEnd();
}
}
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 78e5460b38e..e4aae91701c 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -91,6 +91,7 @@
#include "BIF_editarmature.h"
#include "BIF_editika.h"
#include "BIF_editmesh.h"
+#include "BIF_glutil.h"
#include "BIF_resources.h"
#include "BDR_drawmesh.h"
@@ -440,11 +441,11 @@ static void tekenshadbuflimits(Lamp *la, float mat[][4])
glEnd();
glPointSize(3.0);
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
BIF_ThemeColor(TH_WIRE);
- glVertex3fv(sta);
- glVertex3fv(end);
- glEnd();
+ bglVertex3fv(sta);
+ bglVertex3fv(end);
+ bglEnd();
glPointSize(1.0);
}
@@ -758,7 +759,7 @@ static void tekenvertslatt(short sel)
if(sel) BIF_ThemeColor(TH_VERTEX_SELECT);
else BIF_ThemeColor(TH_VERTEX);
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
bp= editLatt->def;
lt= editLatt;
@@ -774,7 +775,7 @@ static void tekenvertslatt(short sel)
if(u==0 || u==lt->pntsu-1) uxt= 1; else uxt= 0;
if(uxt || vxt || wxt) {
if(bp->hide==0) {
- if((bp->f1 & 1)==sel) glVertex3fv(bp->vec);
+ if((bp->f1 & 1)==sel) bglVertex3fv(bp->vec);
}
}
}
@@ -786,14 +787,14 @@ static void tekenvertslatt(short sel)
a= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
while(a--) {
if(bp->hide==0) {
- if((bp->f1 & 1)==sel) glVertex3fv(bp->vec);
+ if((bp->f1 & 1)==sel) bglVertex3fv(bp->vec);
}
bp++;
}
}
glPointSize(1.0);
- glEnd();
+ bglEnd();
}
static void calc_lattverts(void)
@@ -1067,7 +1068,7 @@ void tekenvertices(short sel)
size= BIF_GetThemeValuef(TH_VERTEX_SIZE);
if(sel) BIF_GetThemeColor3ubv(TH_VERTEX_SELECT, col);
else BIF_GetThemeColor3ubv(TH_VERTEX, col);
-
+
if(G.zbuf) {
glPointSize(size>2.1?size/2.0: size);
@@ -1077,11 +1078,11 @@ void tekenvertices(short sel)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0 && (eve->f & 1)==sel ) glVertex3fv(eve->co);
+ if(eve->h==0 && (eve->f & 1)==sel ) bglVertex3fv(eve->co);
}
- glEnd();
+ bglEnd();
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
@@ -1090,11 +1091,11 @@ void tekenvertices(short sel)
glPointSize(size);
glColor3ub(col[0], col[1], col[2]);
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
for(eve= em->verts.first; eve; eve= eve->next) {
- if(eve->h==0 && (eve->f & 1)==sel ) glVertex3fv(eve->co);
+ if(eve->h==0 && (eve->f & 1)==sel ) bglVertex3fv(eve->co);
}
- glEnd();
+ bglEnd();
glPointSize(1.0);
}
@@ -2808,7 +2809,7 @@ static void tekenvertsN(Nurb *nu, short sel)
size= BIF_GetThemeValuef(TH_VERTEX_SIZE);
glPointSize(size);
- glBegin(GL_POINTS);
+ bglBegin(GL_POINTS);
if((nu->type & 7)==1) {
@@ -2816,9 +2817,9 @@ static void tekenvertsN(Nurb *nu, short sel)
a= nu->pntsu;
while(a--) {
if(bezt->hide==0) {
- if((bezt->f1 & 1)==sel) glVertex3fv(bezt->vec[0]);
- if((bezt->f2 & 1)==sel) glVertex3fv(bezt->vec[1]);
- if((bezt->f3 & 1)==sel) glVertex3fv(bezt->vec[2]);
+ if((bezt->f1 & 1)==sel) bglVertex3fv(bezt->vec[0]);
+ if((bezt->f2 & 1)==sel) bglVertex3fv(bezt->vec[1]);
+ if((bezt->f3 & 1)==sel) bglVertex3fv(bezt->vec[2]);
}
bezt++;
}
@@ -2828,13 +2829,13 @@ static void tekenvertsN(Nurb *nu, short sel)
a= nu->pntsu*nu->pntsv;
while(a--) {
if(bp->hide==0) {
- if((bp->f1 & 1)==sel) glVertex3fv(bp->vec);
+ if((bp->f1 & 1)==sel) bglVertex3fv(bp->vec);
}
bp++;
}
}
- glEnd();
+ bglEnd();
glPointSize(1.0);
}
diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c
index b6b430dd52d..825ba6a8198 100644
--- a/source/blender/src/glutil.c
+++ b/source/blender/src/glutil.c
@@ -416,3 +416,65 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
MEM_freeN(di);
}
+
+/* **************** glPoint 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.0) {
+ glGetFloatv(GL_POINT_SIZE, value);
+ pointhack= floor(value[0]+0.5);
+ if(pointhack>4) pointhack= 4;
+ }
+ else glBegin(mode);
+ }
+}
+
+
+void bglVertex3fv(float *vec)
+{
+ switch(curmode) {
+ case GL_POINTS:
+ if(pointhack) {
+ glRasterPos3fv(vec);
+ glBitmap(pointhack, pointhack, (float)pointhack/2, pointhack/2, 0.0, 0.0, Squaredot);
+ }
+ else glVertex3fv(vec);
+ break;
+ }
+}
+
+void bglVertex2fv(float *vec)
+{
+ 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();
+
+}
+
+