Back to Title Page ←Previous Entry Next Entry→

Jul 5

Ugh-must go show horrible test results to hapless college algebra students.  Well there’s one guy who’s been hankering for an “A”... and he got one!

 

The simplest primitive is a point. You can use glPointSize(GLfloat size) to change this from the default 1 pixel/point, to say, 2 pixels/point, but you need to do it before entering the glBegin() and glEnd() sequence.  Interestingly, just using the glColor3f() function to set the colors of the corner points on the simple02 program produces a rainbow effect of continuously modulated colors across the rectangular area. 

    glBegin(GL_POLYGON);

        glColor3f(1.0,1.0,1.0);

        glVertex2f(-0.5,-0.5);

        glColor3f(1.0,0.0,0.0);

        glVertex2f(-0.5,0.5);

        glColor3f(0.0,0.0,1.0);

        glVertex2f(0.5,0.5);

        glColor3f(0.0,1.0,0.0);

        glVertex2f(0.5,-0.5);

    glEnd();

 

Euclid starts his 13 books with rudimentary definitions in the first book.  The first two definitions are (translated from the ancient Greek,) “a point is that which has no part,” and “a line is a breadthless length.”   In some sense, a pixel comes close to meeting Euclid’s definition of a point; it is a nearly indivisible location-but it does not have zero dimension, and so is an imperfect manifestation of this concept.  But a purely zero-dimensional location would be invisible and so could not . A pixel is a electro-mechanical device, and so it must have 3 spatial dimensions

 

Just got a really dumb joke rehashed from Rick Post to the math group.   So I replied with the byline “One good turn deserves another.” and this modification of an old saw:

A physicist is learning to drive and finds herself barreling down the road at break-neck speed.  She realizes that she will soon have to slow down to make a sharp turn or catapult off a steep precipice. She quickly grabs the manual and reads up on the procedure for slowing down and then applies the brakes and makes the turn.

 

A mathematician is learning to drive and finds himself barreling down the road at break-neck speed.  He realizes that he will soon have to slow down to make a sharp turn or catapult off a steep precipice. He quickly grabs the manual and reads up on the procedure for slowing down and grinning with glee cries "aha!" as he careens off the precipice.

 

That ought to get their math teacher hating juices flowing back in the right direction.  Whichever one that might be.

 

Interestingly an rgb pixel is divisible in that it has r, g and b subpixels!  Sort of like quarks in particle, or not.  So every point in space is also it’s own 3D wonder: 3 different magnitudes in the r, g and b direction, perhaps tuned somewhat to the 3 different flavors of cones in the retina.  Wow.  As it happens, you might think of any three linearly independent colors spanning color space. 

 

I’d like to say the college algebra students took their test results stoically today, but for most it seemed like the same numb insensitivity in which they receive the rest of the information I give them.  Like throwing sloppy wet noodles at a wet, slick ceiling.  Yet they occupy space.

 

Who wants to talk about taxes?   It seems to me that the nation is flooded with a mob of business school flunkies who hurl numbers about like wet noodles.  Food fight!

 

So on to the not-so-breadthless lengths.  OpenGL provides three flavors:

GL_LINES connects a sequence of disjoint pairs, GL_LINE_STRIP connects a sequence of points, each to the next, but not the last to the first.  GL_LINE_LOOP does a strip thing, but then connects the last to the first.  The Angel Primer has a nice diagram of this I would like to modify my simple02 code to accommodate.   So here it goes. 

 

First step: plot 6 points equally space around unit circle.  For this use points of 10 pixels (is that diameter, total, or what?) and the follow code to produce picture at right.  Note that the background was changed to white and the bounds of clipping window are set by gluOrtho2D(-1.5,1.5,-1.5,1.5)
    glBegin(GL_POINTS);

        glColor3f(0.5,0.5,1.0); 

        glVertex2f(0.0,-1.0);    //bottom

        glColor3f(1.0,0.0,0.0);  //red

        glVertex2f(-0.87,-0.5);

        glColor3f(0.0,0.0,1.0);  //blue

        glVertex2f(-0.87,0.5);

        glColor3f(0.0,1.0,0.0);  //green

        glVertex2f(0.0,1.0);

        glColor3f(0.5,0.5,0.0);

        glVertex2f(0.87,0.5);

        glColor3f(0.0,0.5,0.5);

        glVertex2f(0.87,-0.5);

    glEnd();

 

 

So I’d like elongate the clipping window to accommodate some line styles with the same color/vertex lists.  So elongate the clipping window to gluOrtho2D(-1.5,7.5,-1.5,1.5) and simply copy/paste the same code as above in the display function with GL_LINES, GL_LINES_STRIP and GL_LINES_LOOP substituted for SL_POINT and 2, 4 or 6 added to each of the x-coordinates, for each figure in turn.  This makes for a lot of nearly redundant code in the display function, but I got just wanted below:

 

If you want thicker lines, preface a glbegin/end loop in the display function with, say glLineWidth(8.0).  I also tried some LineStipple(Glint factor, GLushort pattern) function calls, but I can’t see it made much difference in the picture.

 

I’m running into an error when I try to rebuild now with stippling modifications.  Damned irritating.  It says I’m either out of disk space or I don’t have privilege.  Hate the denial…reminds me of getting turned back from the gate at Heathrow.  But then we’d never have seen Gatwick, would we?

 

Could be I need to enable stippling with glEnable(GL_LINE_STIPPLE);