This FAQ is a mirror of this thread. You may also be interested in the OpenGL Forum FAQ.
I've been at NeHe for a few years now and I notice the same questions cropping up so I thought a FAQ might be a good idea. I've started one out and I've included it below. Please let me know if you think this is a good idea, I'm overstepping the mark, my answers suck or whether anything needs to be added. Hopefully if this turns out to be a useful thing then perhaps a moderator would sticky it for us. Thanks.
NeHe Productions FAQThis forum is for the discussion of NeHe's tutorials and projects although discussion about any aspect of OpenGL is welcome and in fact encouraged. If you have a more general OpenGL question then you might want to look at the OpenGL forum FAQ here. Two superb resources for OpenGL information are the OpenGL Programming Guide, known as "The Red Book" and the OpenGL Reference Manual, known as "The Blue Book".
Frequently Asked Questions
Links
Resources
Answers to Frequently Asked Questions
- When I compile a lesson I get '[Linker error] undefined reference' or 'error LNK2019: unresolved external symbol', what's going on?
Answer: You have not linked the relevant libraries for your linker and so when you compile the files holding the methods from the header (.h) files they are not found. To resolve this follow these steps:
Dev-C++
Go to your linker options using 'Project > Project Options > Parameters Tab > Linker Box' and make sure you have the following included:
-lopengl32
-lglu32
Microsoft Visual C++.
Add the following lines under at the start of the .cpp file:
#pragma comment(lib, "opengl32")
#pragma comment(lib, "glu32")
- When I try to run a program I get 'missing glaux.dll'?
Answer: You need to place the glaux.dll in the same folder as the executable (.exe) file. To get the glaux.dll file see here. A forum poster (lc_overlord) has kindly donated some replacement code so you don't have to use the glaux.dll file at all, see this thread for instructions on how to use it.
- When I try to run a program I get 'missing glut32.dll'?
Answer: You need to place the glut32.dll in the same folder as the executable (.exe) file. To get the glut32.dll file, download the 'glut-3.7.6-bin.zip (117 KB)' file from here.
- NeHe has been taken over by GameDev, what's happening with that?
Answer: After many personal problems Jeff Molofee (NeHe) decided to sell NeHe Productions to GameDev who are currently in the process of updating the site, adding new content and other time-consuming things. See this thread, this thread and this threadfor more answers.
Update 2006-03-11: Andrew Russell has been named as the new moderator for the NeHe forums, for more details see this thread.
Update 2006-05-18: Andrew Russell has made a post looking for skilled C++/OpenGL coders. Presumably this means that plans have been made for the site and that the ball should start rolling soon. This thread has all the details.
- How do I post source code? How do I make a hyperlink?
Answer: Please see this FAQ.
- My rotations and translations are not working correctly!
Answer: Remember that the order in which you do rotations and translations is very important, for example rotating 45° about the z-axis and then translating 3 units on the y-axis is very different from translating 3 units on the y-axis and then rotating 45° on the z-axis. The Red Book (see link at the beginning of this document) has a very good example in it.
- My object is coloured incorrectly!
Answer: OpenGL is a state machine, that is to say whatever values you set will stay the same until you change them. To draw an object green then another blue you would use:// set colour to green
glColor3f(0.0f, 1.0f, 0.0f);
// render green object
/* COLOUR IS STILL SET TO GREEN! */
// change to blue colour
glColor3f(0.0f, 0.0f, 1.0f);
// render blue object
/* COLOUR IS NOW BLUE! */
If you've tried these steps and still have incorrect colours then you may have enabled lighting and this is causing the colours to not work. This can be resolved by telling OpenGL to blend lighting and colours together. To do this add "glEnable(GL_COLOR_MATERIAL)" to the initialization part of your program, i.e. after you set up OpenGL.
- My screen is black, what do I do?
Answer: There are a variety of reasons why this might happen, please describe your situation in detail on the forum and we will try our best to help.
- How big is 1.0f in OpenGL? How many pixels is 1.0f in OpenGL?
Answer: It can be pretty much any amount, it depends on how far away from the camera you are, assuming a perspective projection that is. As an example, take your finger, let's say it's 20mm wide, now hold it as far away from your face as possible, it looks a lot smaller doesn't it? Now hold it right in front of your face, it looks a lot bigger. This is the problem, OpenGL will render your scene and it is totally dependent on where you are looking from as to how many pixels are occupied by an object.
- My light(s) don't work as I want them to.
Answer: Lights in OpenGL are affected by modelview transformations, that is to say glRotate* and glTranslate* calls will affect the light, check the Red Book link earlier in this document for more advice.
- When's the next NeHe competition and what's it going to be about?
Answer: As the site is being overhauled at the moment there isn't anything planned as yet. A forum member (llvllatrix) has run a couple of contests using this forum and extremely generously donated the prizes from his own pocket. He has written a document on managing a contest here and some potential contest themes here
- Why is nobody responding to my post?
Answer: People usually ignore posts that do not have enough detail. Here are some tips on posting:
- The first thing you should always do is search for a solution; people ignore posts that have obvious solutions. There is a high probability that some one else has had similar problems and has already found a solution. Searching both Google and the forums for an answer should always be done before posting.
- POST CODE! This is the best way to increase chances of getting a reply/solution to your problem. Please see here on the correct way to post code.
- Describe your intentions and give context. The more we know about the problem, the better we can help. It may be that there is a better/easier solution to your problem.
- A screenshot or two could be helpful to showcase any graphical errors. Try using ImageShack or Photobucket if you don't have your own storage space.
- I want to make a great game but I am new at this, tell me what I should do.
Answer: Hold on a minute, making even the simplest game takes a lot of work. A normal game that you buy in a store can take a 15 person team of professionals 2-3 years to make, a MMORPG takes a lot longer with a lot more personnel. To start with, go though NeHe's tutorials from first to last, then you can start out making ultra-simple game clones, such as Pong or Space Invaders. Try this article and also this article for more guidance.
- I can't get textures to work properly, my object is textured incorrectly, my object shows up as white when I texture it or my texture is not used?
Answer: Remember that colours are set until you change them, see this answer for more information.
You may have inadvertently set up your texture co-ordinates incorrectly, a common problem is that the texture appears to be one colour or it is stretched or smeared across an object. This is usually caused when no texture co-ordinates have been set and therefore OpenGL uses its default set of co-ordinates for each vertex, resulting in a single coloured object or stretch/smear effect. Generally, you should be using a separate co-ordinate for each vertex using glTexCoord2f. Have a look at Chapter 9 in The Red Book here for examples and information on texture mapping.
If you find that your object is not textured at all or is showing up as totally white then check that your program can actually find the texture in question. Some compilers, such as Microsoft's Visual Studio variants, temporarily change the directory the program runs from when you run it from the IDE. To see if this is your problem then make sure you use an absolute path to a simple directory to test. For example, move the texture to the root of the C: drive and load your texture in your source with "C:\\texture_name.blah" and see if that solves the problem.
Another problem that can occur is that you either haven't loaded your texture or it is not at the ID you think it is. I.e. you loaded your texture into ID 2 but are trying to bind the texture at ID 3, which doesn't exist. In these cases you will generally just get a pure white texture instead.
Contributors
FAQ maintained by eSCHEn. Many thanks to the following contributors:
llvllatrix,
lc_overlord,
DrewGreen,
Dybbuk,
Kazgaroth,
gregs
Revision 1.10 | 2006-05-18 |