FAQ for Graphics Town Example Code
Send your questions to the
professor, and they'll get put here if others might be interested. Or if there's
something you figured out and think others would like to know, send a note to
the professor and he'll add it here.
Town Code Page, as well as the comments in the code have many hints as to
how to work with it.
1. How do you get transparent objects to work?
Graphics town does not do full
depth sorting. Instead, each object gets to draw itself twice. First the "draw"
function is called for each object, then the "drawAfter" is called on each
object. The idea is that any opaque parts go into draw, and the transparent
parts go into drawAfter. This doesn't handle problems where multiple transparent
objects get drawn in the wrong order, but it does make it so that opaque objects
can be seen through transparent ones.
Its an ugly
hack, but it was much easier to do than depth sorting. If you want to do lots of
transparency, you probably need to use depth sorting, which would require making
changes to the core of the code.
2. Can I use a model loader? Can I use models I find on the web?
Many students in the past have
either written (or appropriated) code that reads in 3D models. This is OK, but
be sure to give proper attribution for any code that you use, and make sure that
the code you use is legal for including in your own program (e.g. its open
If you have a
model loader, you can use a modeling program to make nice models. You can also
find some models on the web. Remember, however, you need to make some of the
objects yourself. Also, if you use models from the web, be sure to give proper
attribution and make sure that they are legal for including in your own program
(e.g. its open source).
3. How come I can't use advanced OpenGL features
Because you probably have an old
version of OpenGL in
visual studio. You need an extension manager to get access to the newer stuff.
Read about it here.