Assignment 3 is available.
Best science headline ever
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
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
Assignment 2 update
Some compilers may have trouble with Assignment 2 because their standard library's
<math.h> header files define
y1() to compute the Bessel function.
To fix the issue, replace
y_1 or download the updated version of assignment2.c
Line 194 may cause some compilers to issue warnings:
Assignment 2 is available. Check back mid-week to download a compiled executable of a working solution.
Stop trying so hard!
For those of you still scrambling to finish Course Outline says "Chapter 1 and Chapter 2," that's exactly what it means. You shouldn't be reading Chapter 5 or Chapter 12. You don't need
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:
And technically, I didn't even need to bother with
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
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?
- The error messages generated by the interpreter aren't perfect. But then again, neither are the error messages generated by Visual Studio.
- 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.
- 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.
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
- If you're writing your program in C++, note that
<GL/glut.h> needs to be
<iostream> or you'll get
error C2381: 'exit' : redefinition; __declspec(noreturn) differs
- 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
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:\.
Assignment 1 is available. There are a few questions to answer and a program to write.
Three-dimensional computer graphics architecture
This is a pretty good survey paper:
Mitra, T. and Chiueh, T., "Three-Dimensional Computer Graphics Architecture", Current Science, vol. 78, no. 2, pp. 838-846, 2000, http://www.iisc.ernet.in/currsci/apr102000/surveys2.pdf. (local copy)
Read the first two sections for an overview of the graphics pipeline with several details that we omitted in class (but most of which we will cover in detail later). Continue on if you're interested in graphics hardware.
For an example of OpenGL bindings in another language, check out
hello.py. This is a Python version of Example 1-2 from the OpenGL Programming Guide. Compare this to the C version you're using for your homework -- the language may be different, but OpenGL is the same.
Things have come a long way since the last time I went looking for OpenGL bindings. While scripting languages have always tended to have them (e.g., Perl, Python, Ruby, Lua, Io, even PHP -- yikes!), bindings for "industrial-strength" languages have always seemed to lag behind.
Instead of the panoply of Java bindings that held sway in the early years, sanity finally seems to have taken hold in the form of semi-official JOGL project. Heck, they even have a JSR.
Over in the proprietary, closed-source, Windows-only, Microsoft-owned world of C# (can you tell I'm biased? And don't tell me about Mono -- as soon as I can type "apt-get install monodevelop", start the IDE, create a project and start typing code without hanging or crashing, we'll talk) things seem to have gotten better. Or if not better, at least there are more choices:
As with all things Lisp-y, OpenGL support is pretty fragmented. Whether there is an OpenGL binding, how well it works, and whether you get get any help if it doesn't is largely dependent on which Lisp you're using. You may be better off with Scheme, where the Sgl library for PLT Scheme appears to be officially supported.
When it comes to getting all this set up, though, as I said earlier, you're on your own.
Win32 GLUT setup help
If you're not planning to do your programming in C or C++ or on Windows, that's perfectly fine, but note two things:
If we went too fast in lab Friday night, or if you're finding that the instructions in the README file included with the Win32 GLUT distribution are insufficient, you may also want to check out these resources:
- When you submit assignments, you need to document any build dependencies (i.e., libraries that you rely on)
- When it comes to getting your environment up and running, you're on your own.
Assignment 0 is available.
If you are using Visual Studio, you may run into a problem compiling Example 1-2 from the OpenGL Programming Guide. If you run into a large number of errors complaining about undefined constants like
WINGDIAPI, then problem is the two header files in the listing:
The problem is that the Win32 OpenGL implementation is done in terms of the Win32 API, and uses Win32 API constants to declare functions. You can fix this by
windows.h first, by swapping
gl.h, or by just
glut.h by itself, because the GLUT header
Incidentally, take a look at the hoops you have to jump through in the first 100 lines or so of the Win32 version of
glut.h just to get the headers straight to see why I stopped writing code for Windows in 1999 and haven't looked back.