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
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/blender/src/glutil.c
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/blender/src/glutil.c')
-rw-r--r--source/blender/src/glutil.c62
1 files changed, 62 insertions, 0 deletions
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();
+
+}
+
+