Archive for February, 2006

Assignment 3

Saturday, February 25th, 2006

Assignment 3 is available.

Best science headline ever

Monday, February 20th, 2006

From New Scientist: Hand waving boosts mathematics learning.

So don’t complain when I do it in class: it’s a pedagogical technique.

On a more serious note, blame computers for this one: Mathematical proofs getting harder to verify:

“Twenty-five years later we’re still not sure if it’s correct or not. We sort of think it is, but no one’s ever written down the complete proof”

Demo version of Assignment 2

Monday, February 20th, 2006

A compiled executable version of Assignment 2 is now available. Download assignment2.exe to see how your program should work.

My version needed 14 new lines of code: a function to implement the vector cross product operation and some changes to the function move_point().

Assignment 2 update

Sunday, February 19th, 2006

Some compilers may have trouble with Assignment 2 because their standard library’s <math.h&gt header files define y0() and y1() to compute the Bessel function.

To fix the issue, replace y0 and y1 with y_0 and y_1 or download the updated version of assignment2.c

Line 194 may cause some compilers to issue warnings:

glutPostRedisplay;

should be

glutPostRedisplay();

Assignment 2

Saturday, February 18th, 2006

Assignment 2 is available. Check back mid-week to download a compiled executable of a working solution.

Stop trying so hard!

Friday, February 17th, 2006

For those of you still scrambling to finish Assignment 1, note that the Course Outline says “Chapter 1 and Chapter 2,” and that’s exactly what it means. You shouldn’t be reading Chapter 5 or Chapter 12. You don’t need glTranslate() or gluPickMatrix() or any other OpenGL function that you haven’t run into in Chapters 1 and 2. (Don’t worry, we’ll cover those functions later on, when we get to them.)

In the meantime, here are the GL functions I called in my solution for Assignment 1:

  • glBegin
  • glClear
  • glClearColor
  • glColor3f
  • glEnd
  • glFlush
  • glLoadIdentity
  • glMatrixMode
  • glOrtho
  • glVertex3f
  • glViewport

And technically, I didn’t even need to bother with glViewport().

If your list looks significantly different from mine, and especially if you’re trying to translate the square to move it around the window or use a pick list to figure out whether the user clicked it, you’ve gone down the wrong path. We’re not even going to talk about translation until next week. (Well, ok, possibly this week; but if so, only at the end.)

An easy way to run OpenGL programs

Thursday, February 16th, 2006

Now that I’ve put you through the pain of setting up your own
programming environment
, I’ll show you the easy way to run gears.c.

Grab a copy of igloo.zip and unzip it somewhere convenient. Run the program by typing

C:igloo> igloo gears.c

Cool. No compilation step, no moving headers and library files around, just type and go. And in less than 230 Kb.

Igloo is a version of the EIC C Interpreter, an Open Source project that seems to have gone missing in action.

Luckily, I saved a copy, just for you. I wish I’d saved a copy of the source code, too, but at least there are lots of other C interpreters.

So what’s the catch?

  1. The error messages generated by the interpreter aren’t perfect. But then again, neither are the error messages generated by Visual Studio.
  2. I’m not sure how exact it is about implementing the ANSI C Standard, and can’t find out because the web site is gone. There may be constructs that won’t work. But gears.c is pretty complicated, and it works just fine.
  3. It’s a C interpreter, not C++. Feel free to Google for one of those, and e-mail me if you find a good one.

Schedule Change

Thursday, February 16th, 2006

Please note that I’ve updated the Course Outline.

I don’t want to move too quickly through the next three weeks: transformations are the heart of the rendering pipeline.

Hints for Assignment 1

Saturday, February 11th, 2006
  1. If you’re writing your program in C++, note that <GL/glut.h> needs to be #included after <iostream> or you’ll get

    error C2381: ‘exit’ : redefinition; __declspec(noreturn) differs

  2. In order to toggle double-buffering on and off, you’ll need to destroy and re-create the window. See the API Reference for details.

Setting up OpenGL in CS-300

Saturday, February 11th, 2006

If you’re working in the lab, instead of messing around with placing the GLUT header and import library files in the right directories, just download glut.zip and unzip it into C:\.