Prof Avery's weblog
high-strung herald of the haphazard


CSU Fullerton Perl Powered Python vi Hacker

Geek News

del.icio.us bookmarks


Sun, May 08, 2005

PLY Format
If you haven't started writing the code to read object files, I recommend PLY format. I hadn't noticed it, but the page I linked to already includes code to read PLY files. The PLY page at Georgia Tech also has code to convert OBJ files to PLY format.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Sat, Apr 30, 2005

Static models
To help you get started on Assignment 5, click here for a C version of the cup object. If you want to try other models, you can download the Perl script.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Wed, Apr 27, 2005

Assignment 5
Assignment 5 is available. I will post some code to help you get started this weekend.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Apr 19, 2005

Optical Illusions
The optical illusion I mentioned in class is here, you'll probably want to collect the whole set.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Apr 12, 2005

Assignment 4
I've posted Assignment 4. Since we discussed the assignment in class last Thursday, it shouldn't come as any surprise.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Wed, Mar 30, 2005

Modeling coordinates
I chose the coordinates specified for Assignment 3 (-2 < {x, y, z} < 2) because they're relatively simple, as modeling coordinates go, but they're pretty much arbitrary -- feel free to replace them with a more convenient modeling coordinate system of your choice.

/var/spool/courses/csuf/2005/spring/cpsc465 #

John Kim points out that you can draw Assignment 3's pyramid using gluCylinder by specifying a topRadius of 0 and only drawing 4 slices.

I kinda wish I'd thought of this; it's much better than the Toblerone bar example I used in class.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Mar 29, 2005

Jason Obermeyer points out that roof of the temple in Assignment 3 has 4 sides, not 3, which is going to make using glutWireTetrahedron() kind of difficult. Try glVertex() instead.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Mon, Mar 28, 2005

trackball.c Compiler Trouble
You may have trouble compiling trackball.c, depending on the compiler that you're using. The problem is that compilers disagree over the contents of <math.h>.

Unfortunately, there are multiple standards for C libraries. The ANSI/ISO C standard <math.h> specifies only a few math functions. The POSIX standard <math.h> specifies a superset, including several useful constants like M_PI, and several additional functions, including y0() and y1() for computing Bessel functions.

Unfortunately, compilers tend to pick and choose. The "standard" library for the compiler I used includes M_PI but not y0() and y1(). If you're using Visual C++, you'll find that its "standard" library does the opposite: it defines y0() and y1() but not M_PI.

The best defense against all of this is probably to define your own constant for PI and to rename y0 and y1. By the time you read this, I'll have updated trackball.c to do this.

Computers suck. Have I mentioned that?

/var/spool/courses/csuf/2005/spring/cpsc465 #

Fri, Mar 25, 2005

Extra Credit
I've posted an Extra Credit Assignment.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Thu, Mar 24, 2005

Assignment 3
Note that I've updated the course outline to show a due date of Thursday instead of Tuesday for Assignment 3.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Mar 22, 2005

Virtual Trackball Jumpstart
Here's some help getting started with the virtual trackball part of Assignment 3: grab trackball.c. Initially the sphere doesn't move. Fill in the parts labeled "TODO" with the equations discussed in class, and you should end up with a running program similar to trackball.exe.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Mar 15, 2005

Assignment 3
Click here for Assignment 3.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Mon, Mar 07, 2005

Looking for programming partner
If you aren't currently working with a partner on Assignment 2 and would be willing to do so, please contact me.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Thu, Feb 24, 2005

Assignment 1
Now that the deadline has passed, I've posted a working solution to Assignment 1. If you weren't able to get your program working, feel free to steal the code. If your program worked, feel free to laugh at it.

Note that posting code for this assignment does not imply that I will do so again. In fact, I probably won't. But if you can't get past the first assignment, you're likely to have trouble for the rest of the semester.

One more thing: remember that you are allowed to work with a partner on programming assignments (you did read the syllabus, right?). I note that the students who didn't finish the assignment on time were all working alone. If you're having trouble, find a buddy. If you can't find a buddy, get in touch with me.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Fri, Feb 18, 2005

Assignment 2 Extra Credit
Apparently I'm getting soft in my old age. You are no longer required to add antialiasing to Assignment 2, but you may do so for extra credit.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Wed, Feb 16, 2005

The Reshape Callback
Ok, so I had to go back and re-read the documentation to get this working.

The default reshape callback (the one you get if you don't call glutReshapeFunc()) calls glViewport(0, 0, w, h) and doesn't change the coordinate system. The default coordinate system (which won't change unless you call gluOrtho2D()) has its origin in the lower left corner of the window.

Unfortunately, the coordinate system used for the mouse position has its origin in the upper left corner. That means that if you don't have a reshape callback, or if you call gluOrtho2d(0, w, 0, h);, you'll end up with mouse coordinates that are the opposite of drawing coordinates. To fix that, you need to do one of two things:

  1. Subtract the mouse y-coordinate from the height of the window
  2. Change your drawing coordinate system to match the mouse coordinate system
Luckily, option (2) also allows us to resize the window without stretching the drawing or moving it all over the screen. Use the following reshape callback:
void reshape(int w, int h)
	glViewport(0, 0, w, h); 

	gluOrtho2D(0, w, h, 0);
Don't forget to register the callback in main() with glutReshapeFunc(reshape).

Here's what the function does:

glViewport(0, 0, w, h);
Specifies that the viewport rectangle should occupy the entire window. The default reshape callback does the same thing.
We're about to specify 2D Orthographic projection. The default matrix mode is GL_MODELVIEW, so we need to switch.
Clear any existing projection matrix
gluOrtho2D(0, w, h, 0);
Specify the left, right, bottom, and top clipping planes. Note that the bottom clipping plane is h, not 0.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Feb 15, 2005

Assignment 2
Click here for details.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Feb 08, 2005

OpenGL and GLUT in Visual Studio .NET
Donn Clark has found a tutorial with screenshots for building applications with OpenGL and GLUT in Visual Studio.NET. The tutorial says that it works with both the 2002 and 2003 versions, and if I recall correctly, the steps in older versions of Visual Studio (i.e. non-.NET) are largely the same.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Assignment 1
Click here for details.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Mon, Feb 07, 2005

I've posted the documentation and code for SPiGoT, and will post the first assignment on Monday.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Sun, Feb 06, 2005

OpenGL Tutorial Site
Ok, this is really impressive: NeHe Productions has 48(!) OpenGL tutorials, including instructions for getting OpenGL up and running on Solaris and MacOS X. When you get there, note that if you scroll down to "Resources" in the left-hand column, you can download all the tutorials as a single file.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Computer Animation
We won't have a whole lot to say about animation in class; not because it's not interesting, but because it's a topic large enough to fill several books on its own. If you're interested in animation, check out Computer Animation: Algorithms and Techniques by Rick Parent.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Thu, Feb 03, 2005

You can download documentation and a copy of the library from the official GLUT page. If you grab the .ZIP file from the GLUT for Win32 page, you'll see the following files:

The DLL module definition file. You probably don't need this unless you're rebuilding GLUT from the sources.
This is the file that your C program will need to #include.
The actual GLUT library; put it somewhere in your path.
The "import" library; link your program against this to automatically import the GLUT functions from the DLL.
The, ummm... readme. You should probably read it.
If you need more help getting up and running on Windows, check out Installing GLUT on a Windows machine.

/var/spool/courses/csuf/2005/spring/cpsc465 #

Tue, Feb 01, 2005

CpSc 465, Principles of Computer Graphics
Click here for the syllabus and outline.

/var/spool/courses/csuf/2005/spring/cpsc465 #



March 2021
Sun Mon Tue Wed Thu Fri Sat