Long on the todolist: a patch to have pointsize working on systems that
authorTon Roosendaal <ton@blender.org>
Sat, 10 Jul 2004 21:35:17 +0000 (21:35 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 10 Jul 2004 21:35:17 +0000 (21:35 +0000)
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.

source/blender/include/BIF_glutil.h
source/blender/include/BIF_interface.h
source/blender/src/buttons_shading.c
source/blender/src/drawimage.c
source/blender/src/drawipo.c
source/blender/src/drawobject.c
source/blender/src/glutil.c

index baaaf4cf40ef4af15e00b56a7d0ba86fcae7fb75..b04705c7b023a45f31d029161d71310625ff25c2 100644 (file)
@@ -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 */
 
index 048417dff0a69e6849f73813966eb85abb3b62e1..30b79c091369b853cf330d26c0766e8fa169cb79 100644 (file)
@@ -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);
index 5bd180dccb3be9156a223febd966b468fd9b3aac..dda33e584a0ddfa4efefe177a8ee94cb5be6374e 100644 (file)
@@ -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;
index 7ec43f486a4052e95578fe1c2c487eeb9d4416c9..d55e7380dde5175ec25d84f1df418c671604b559 100644 (file)
@@ -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++;
index f0cd4ce13ca5c5280253fe125f46937c38e81c6b..7eabd8ee523e2bf7cb2d2c2566ad0cfbd2e7ee5f 100644 (file)
@@ -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();
                }
        }
        
index 78e5460b38e901fa7b84cfcc7a8b584bbb647f2a..e4aae91701ce8dd2f5e0ff86f110011b4a2055c1 100644 (file)
@@ -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);
 }
 
index b6b430dd52dd15abe0d00cbe1da0c80541f256d6..825ba6a819809b1fc64b99629144aef24df4be69 100644 (file)
@@ -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();
+       
+}
+
+