summaryrefslogtreecommitdiff
path: root/test/CubeView.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1999-03-10 16:40:19 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1999-03-10 16:40:19 +0000
commit2b4b055204ca592f83e8b0fd8b44015f23c7248f (patch)
tree680f208b285ddaacaabdb693772ddd34584f1641 /test/CubeView.cxx
parent51c3b154dd186b8d6d849c75b367fbe8c9091fc3 (diff)
Updated not to use v3f() macro.
No longer use glColor4ub(), as 1) Sun's compilers have trouble with their own headers with this (glColor4ub is a macro, a VERY bad thing to do!), and 2) it's an OpenGL 1.1 feature, and not all platforms support it. Also optimized the QUAD and LINE primitives. git-svn-id: file:///fltk/svn/fltk/trunk@404 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/CubeView.cxx')
-rw-r--r--test/CubeView.cxx99
1 files changed, 81 insertions, 18 deletions
diff --git a/test/CubeView.cxx b/test/CubeView.cxx
index 65f562021..4a70ea21b 100644
--- a/test/CubeView.cxx
+++ b/test/CubeView.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: CubeView.cxx,v 1.3 1999/03/04 20:26:00 mike Exp $"
+// "$Id: CubeView.cxx,v 1.4 1999/03/10 16:40:19 mike Exp $"
//
// CubeView class implementation for the Fast Light Tool Kit (FLTK).
//
@@ -57,25 +57,88 @@ CubeView::CubeView(int x,int y,int w,int h,const char *l)
#endif /* !HAVE_GL */
};
-// The color used for the edges of the bounding cube.
-#define CUBECOLOR 255,255,255,255
-
#if HAVE_GL
void CubeView::drawCube() {
/* Draw a colored cube */
- glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0); v3f(boxv1); v3f(boxv2); v3f(boxv3); glEnd();
- glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv5); v3f(boxv4); v3f(boxv7); v3f(boxv6); glEnd();
- glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0); v3f(boxv4); v3f(boxv5); v3f(boxv1); glEnd();
- glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv2); v3f(boxv6); v3f(boxv7); v3f(boxv3); glEnd();
- glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0); v3f(boxv3); v3f(boxv7); v3f(boxv4); glEnd();
- glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv1); v3f(boxv5); v3f(boxv6); v3f(boxv2); glEnd();
-#define ALPHA 128
- glBegin(GL_QUADS); glColor4ub( 0, 0, 255, ALPHA); v3f(boxv0); v3f(boxv1); v3f(boxv2); v3f(boxv3); glEnd();
- glBegin(GL_QUADS); glColor4ub(255, 255, 0, ALPHA); v3f(boxv0); v3f(boxv4); v3f(boxv5); v3f(boxv1); glEnd();
- glBegin(GL_QUADS); glColor4ub( 0, 255, 255, ALPHA); v3f(boxv2); v3f(boxv6); v3f(boxv7); v3f(boxv3); glEnd();
- glBegin(GL_QUADS); glColor4ub(255, 0, 0, ALPHA); v3f(boxv4); v3f(boxv5); v3f(boxv6); v3f(boxv7); glEnd();
- glBegin(GL_QUADS); glColor4ub(255, 0, 255, ALPHA); v3f(boxv0); v3f(boxv3); v3f(boxv7); v3f(boxv4); glEnd();
- glBegin(GL_QUADS); glColor4ub( 0, 255, 0, ALPHA); v3f(boxv1); v3f(boxv5); v3f(boxv6); v3f(boxv2); glEnd();
+#define ALPHA 0.5
+ glShadeModel(GL_FLAT);
+
+ glBegin(GL_QUADS);
+ glColor4f(0.0, 0.0, 1.0, ALPHA);
+ glVertex3fv(boxv0);
+ glVertex3fv(boxv1);
+ glVertex3fv(boxv2);
+ glVertex3fv(boxv3);
+
+ glColor4f(1.0, 1.0, 0.0, ALPHA);
+ glVertex3fv(boxv0);
+ glVertex3fv(boxv4);
+ glVertex3fv(boxv5);
+ glVertex3fv(boxv1);
+
+ glColor4f(0.0, 1.0, 1.0, ALPHA);
+ glVertex3fv(boxv2);
+ glVertex3fv(boxv6);
+ glVertex3fv(boxv7);
+ glVertex3fv(boxv3);
+
+ glColor4f(1.0, 0.0, 0.0, ALPHA);
+ glVertex3fv(boxv4);
+ glVertex3fv(boxv5);
+ glVertex3fv(boxv6);
+ glVertex3fv(boxv7);
+
+ glColor4f(1.0, 0.0, 1.0, ALPHA);
+ glVertex3fv(boxv0);
+ glVertex3fv(boxv3);
+ glVertex3fv(boxv7);
+ glVertex3fv(boxv4);
+
+ glColor4f(0.0, 1.0, 0.0, ALPHA);
+ glVertex3fv(boxv1);
+ glVertex3fv(boxv5);
+ glVertex3fv(boxv6);
+ glVertex3fv(boxv2);
+ glEnd();
+
+ glColor3f(1.0, 1.0, 1.0);
+ glBegin(GL_LINES);
+ glVertex3fv(boxv0);
+ glVertex3fv(boxv1);
+
+ glVertex3fv(boxv1);
+ glVertex3fv(boxv2);
+
+ glVertex3fv(boxv2);
+ glVertex3fv(boxv3);
+
+ glVertex3fv(boxv3);
+ glVertex3fv(boxv0);
+
+ glVertex3fv(boxv4);
+ glVertex3fv(boxv5);
+
+ glVertex3fv(boxv5);
+ glVertex3fv(boxv6);
+
+ glVertex3fv(boxv6);
+ glVertex3fv(boxv7);
+
+ glVertex3fv(boxv7);
+ glVertex3fv(boxv4);
+
+ glVertex3fv(boxv0);
+ glVertex3fv(boxv4);
+
+ glVertex3fv(boxv1);
+ glVertex3fv(boxv5);
+
+ glVertex3fv(boxv2);
+ glVertex3fv(boxv6);
+
+ glVertex3fv(boxv3);
+ glVertex3fv(boxv7);
+ glEnd();
};//drawCube
void CubeView::draw() {
@@ -102,5 +165,5 @@ void CubeView::draw() {
#endif /* HAVE_GL */
//
-// End of "$Id: CubeView.cxx,v 1.3 1999/03/04 20:26:00 mike Exp $".
+// End of "$Id: CubeView.cxx,v 1.4 1999/03/10 16:40:19 mike Exp $".
//