support for "Beg. OpenGL game..."

Started by
16 comments, last by Clueless 19 years, 3 months ago
Hey can anyone tell me where can I find support and a forum for asking questions relating to the book titled "Beginning openGL Game Programming"? I cant seem to get the examples compiled and working and need some help with basic concepts.
Advertisement
Given that both the authors are founders of this site, this is probably a pretty good bet.

Try either this forum or the openGL forum - either should get you an answer.

Jim.
Posting your question/problem in this thread couldn't hurt any.
If a plant cannot live according to its nature, it dies; so a man.
Ok well then hee it goes. I am using Dev C++ version 4.9.9.1 and am having trouble compiling the examples from the book. If I were to go into the directiory of say ch 02 and try to compile the winmain.cpp file I get the following list of errors:
(please cut and paste, not sure as to which tags to ue for the url)

http://www.angelfire.com/clone/wolfbane/devCerror.gif

I understand that this is a linker or missing library error, but am very new to C++ and would appreciate any help in getting the examples to run.
Let's try and get rid of some of those errors.

The first one is the lack of a newline character at the end of winmain. You probably need to add an (empty) line at the end of your program.

The linker errors for ChoosePixelFormat, SetPixelFormat and SwapBuffers probably come from not telling DevC++ where to look for the openGL libraries. Now I have an older version of DevC++ on my desktop, but this is how I would do it : If you go to Project -> Project Options, you should see a text box that says something like 'Further object files or linker options'. In this box type: -lopengl32 -lglu32 . This is all explained here - the FAQs for DevC++ which are well worth a read to explain some of the idiosyncracies of DevC++.

Now you also have some undefined references to the CGFxOpenGL class. When you are using a classes methods in a file, you have to let that file know some details of the class. You probably also have a file called 'CGFxOpenGL.h' - if this is the case, you need to #include "cgfxopengl.h" with your other includes.

For future questions - it helps readers if you post some code and errors in your mail - this can be done using the [ source ] and [ /source ] tags (minus the spaces); information about which can be found in the Forums FAQ.

Hope this helps; don't be afraid to come back with any more questions!
Jim.
Ok I managed to get rid of most of the errors, except for the ones that really count. Here is the output of the compiler:

 Executing  make...make.exe -f "C:\apps\openGL book\Chapter02\OpenGLApplication\Makefile.win" allg++.exe CGfxOpenGL.o winmain.o  -o "chapter2.exe" -L"C:/Dev-Cpp/lib" -lopengl32 -lglu32    winmain.o(.text+0x44):winmain.cpp: undefined reference to `ChoosePixelFormat@8'winmain.o(.text+0x63):winmain.cpp: undefined reference to `SetPixelFormat@12' winmain.o(.text+0x6d1):winmain.cpp: undefined reference to `SwapBuffers@4' make.exe: *** [chapter2.exe] Error 1 Execution terminated


as you can see the lopengl32 -lglu32 are now in the command line, but I stuill get the 3 errors that you say ae related to Dev C++ not seeing openGL. I am still digging around Dev C++ but have already placed the 2 parameters in the project options section. What else could be the cause of this?


Edit: humm, thats weir, why dont the code tags work?
The tags are (without spaces)
in the code tag

if it's C++ your posting it's
[ source lang="cpp"] [ /source](again without spaces, only between source and lang this time) Also gamedev forums supports HTML if your registered.



As for your problem...
Make sure you include windows.h BEFORE the opengl header files.
I think that's it..

~zix~
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
"Make sure you include windows.h BEFORE the opengl header files."

thats not the isue as it is included before the opengl header files.
does dev-c++ use lib files? I dont think so.. but if it does make sure opengl32.lib and glu32.lib is referenced.
Probably something similiar for dec-C++.
---------------------------------------------------Game Programming Resources, Tutorials, and Multimedia | Free Skyboxes
OK i give it a try once I figure out how to do that. Thanks

This topic is closed to new replies.

Advertisement