WPI Computer Science Department

Computer Science Department
------------------------------------------

CS 4731 - B Term, 2007
Computer Graphics Course
Frequently Asked Questions (FAQ)


Notes and Disclaimer

The following FAQ entries were scraped off actual student postings from the the CS 4731 class. It is anticipated that students will tend to have the same problems over and over and this FAQ will help answer some of the issues that come up year over year. Where possible, I have kept the actual names of the students who posted to the message board, purely to give them credit. If your name appears and you would like me to take your name or your post off, please send me email. Also, the FAQ is provided purely to help. I haven't verified the accuracy of the suggestions, so please use at your own risk

The FAQ

Getting Started in OpenGL Issues

Problems on CCC Machines

Questions, Typos and Omissions from Textbook

C/C++ Questions

OpenGL Programming Questions

Getting Started in OpenGL Issues

==============================CUT ===========================================

Question: If I want to use Cygwin to do my CS 4731 Projects, what do I do?

Answer:

Warning: the following is not for the faint of heart. Cygwin 
is ridiculously useful when it works, but almost always 
requires tweaking, and that tweaking requires low-level 
knowledge of both the Windows and *nix environments. If 
you're not very comfortable with all of the technologies 
involved, I would recommend trying XWin first.

If you're having problems with xwin, it is possible to 
install XFree86 on Windows using the Cygwin installer. When 
setting it up, make sure that at least the 'Default' component 
set of XFree86 is being installed, as well as OpenSSH (under 
the Net category.)

The attached batch file assumes that you installed cygwin to 
\cygwin. You may want to overwrite your 
\cygwin\usr\X11R6\bin\startxwin.bat with this file as well.

It will start a 'transparent' X session so that X windows 
will act as regular Microsoft windows (no pun intended, I 
swear).

If you installed OpenSSH with Cygwin, you can now run

ssh -X -C user@cpu.wpi.edu

and X11 forwarding and compression will be enabled. You can 
rename the attached batch file and tack that line on to the 
end and have it proceed automatically.

If it's working, the X logo will be displayed in the system 
tray. Right-click to display the root window (you should not 
have to do this except if you want to run a different window 
manager) or to exit.

As a side note, you can modify that batch file to display all 
X windows as children of a root window, or to use a different 
window manager (such as twm) than Windows. The advantage of 
those methods would be easier differentiation between Microsoft 
windows and X windows.

With offcampus 600kbit DSL and no compression, I pull one frame 
every 21 seconds. With compression, I pull one frame every five 
seconds. Either way, utterly masochistic for anything other than 
final debugging, especially because OpenGL that compiles and links 
on one platform should be identical to OpenGL compiled and linked 
on another platform (well, at this level of OpenGL anyways ;). If 
you enjoy pain, try running XEmacs at that level ;)

Alexander Lash
chaos@wpi.edu

=============CUT =================================================

Question: How do I use Microsoft .NET for the CS 4731 projects?

Answer:

GLUT/OpenGL problems:

Here's a tip from Paul Tessier (grad student)
for anyone using Visual Studio .Net

This might be helpful to anyone use visual studio. 
WPI currently provide the .Net edit of visual studio 
and as such, when compiling you receive an error about
redefining exit. It might be helpful to include 
these instuctions in the current help page.

http://students.cs.tamu.edu/jwf4661/441/glut_NET.html

================================= CUT ============================


Question: I am still having problems getting Visual Studio .NET to compile

Answer:

.NET problems: 

Are you having difficulty installing the GLUT libraries? 
VS .Net keeps the libraries in a different location. If 
you put the GLu and GLUT headers/libraries into the VC 6.0 
location, you probably won't get it to compile.

If you are using VS .Net make sure to put the files in:
\Vc7\PlatformSDK\[include\GL,lib]

- Paolo Piselli (TA)

================================= CUT ======================================


Question: How can I work from home using text-based SSH and XWindows?

Answer:

In case you want to use a text-based SSH client outside of 
WPI for speed, but still want to confirm your pictures look 
ok, visit http://www.cs.umn.edu/help/offsite/graphical.php. 
This will tell you how to get xwin (available free from WPI) 
to open and display whenever a graphic is sent from SSH.







================================= CUT ======================================

Question: Is there any help for using DevShed to develop OpenGL programs?

Answer:

Hey guys,
I was finally able to get DevShed to work. Follow the instructions on this site and you'll be all set.
http://www.cs.auckland.ac.nz/~jli023/c/bloodshed.htm


-- Greg Ratner

Problems on CCC Machines


==================== CUT======================================================

Question: The rand( ) function on the CCC machines is not working

Answer:

rand() not working on CCC machines:

From Brian Corcoran:

Both rand() and random() are in stdlib.h on the CCC machines:


#include 

should work.


Type 'man rand' or 'man random' for more info.

And from Steven Gogos:

try #include [cmath]

also, you may have to wrap it in a #ifndef WIN32 so you do not get 
truncation warnings with msvc++ on your machine

Questions Typos and Omissions from Textbook


===========================CUT====================================================

Question: The GLintPoint data structure is giving me errors

Answer:


I'm having problems with:

Static GLintPoint corner[2];

it's says syntax error : missing ';' before indentifier 'corner'

What could be causing this problem? And I don't have a missing ; 
in my program, caused I checked multiple times.


Reply from Mark Figura:

Your code...
Static GLintPoint corner[2];

2 things that could be wrong. The c++ reserved word 'static' 
should be all lowercase. Also, did you add the GLintPoint 
structure to your code? This is not an official miniGL, OpenGL, 
GLU, or GLUT structure, but does appear in the book. It appears 
on the top of page 49 and should be added to your header file 
(or the top of your source file). (Remember that you'll probably 
need floating point values instead of integers, so you'll probably 
have to change the structure anyway :)

Later,
Mark
- 
================================ CUT ==================================================

Question: SetPixel( ) function from text does not work?

Answer:

From Mark Figura:

The setPixel function is not a standard OpenGL function (notice there is no 
"gl" in front of it). It is defined somewhere, a bit earlier in the book, but 
all it does is set the color and set a point. For example...

glColor3f(red, green, blue); // all between 0 and 1
glBegin(GL_POINTS);
glVertex3f(x, y, 0); // x, y are floats
glEnd();

Note that your program will be significantly faster if you only call glBegin() 
and glEnd() once and just put all your glVertex() calls in between. Function 
call and state-change overhead are very expensive for this kind of thing.

w00t,
Mark



================= CUT==================================================================

Question: The dwell( ) function in the book gives errors when I type it in

Answer:

Typo in dwell( ) function:

I just looked at the book, and if you type this up verbatim the 
variable count was defined inside the for loop but then is reference 
outside the for loop. Probably if you define count outside the for 
loop it should clear this problem.

continuation:

oh yeah, and that '};' either belongs to another part of a program or 
just superfluous. Also I read ahead and they have color assigning 
example on the next page, which has an extra ',' that is not supposed 
to be there between the 'v*' and the next 'v'.
================================== CUT ======================================================

C/C++ Questions


========================CUT ===============================================


Question: What's the ascii value of the escape character?

Answer:

Finding out the escape character:

From Vince Bullinger:

Using this little (18 lines) program I wrote - it's attached - you can 
test values of almost all characters. Escape is 27.

OpenGL Programming Questions


================================= CUT =======================================================
Question: I am having problems getting Lights in OpenGL to turn on or off properly

Answer:

About enabling/disabling lights:

Instead of disabling the lighting mode (glDisable(GL_LIGHTING)) you 
should try disabling all the lights. To do this, call glDisable(GL_LIGHTX) 
where "X" is all lights between 0 and 7.

I think the problem you're running into is that glDisable(GL_LIGHTING) does 
not actually turn off the lights. It just "cuts the power to the lights". 
When you restore the power (glEnable(GL_LIGHTING)) all the lights that were 
on, will come back again. glDisable(GL_LIGHTX) is like smashing the lightbulb 
into tiny bits - even if the power comes back, the light won't go back on 
(until you replace it with a new bulb with glEnable(GL_LIGHTX)).

I hope that helps,
Mark



[Feedback] [Search Our Web] [Help & Index]

[Return to the WPI Homepage] [Return to CS Homepage]

mailto:webmaster@cs.wpi.edu