PDA

View Full Version : where find functional samples



oscar leo
07-11-2010, 11:12 AM
i try to learn of http://www.opengl.org/resources/code/samples/glut_examples/ this page but all sources is wrong every sample gives me compiler errors i using windows 7 and all samples are from 1994

marshats
07-11-2010, 01:15 PM
Those examples all are still good learning code. They compile and run fine. What are your compiler errors?

My guess is that you may need the glut library ... take a look at freeglut (http://freeglut.sourceforge.net/index.php#download) and the link to "Windows binaries".

oscar leo
07-11-2010, 01:55 PM
errors like this

1> LINK: not found C: \ Users \ Oscar \ Documents \ Visual Studio 2008 \ Projects \ trianglew \ Debug \ trianglew.exe or not generated the last incremental link; running full link
1> main.obj: error LNK2019: ___glutInitWithExit external symbol unresolved at @ 12 referenced in function @ 8 _glutInit_ATEXIT_HACK
1> main.obj: error LNK2019: ___glutCreateWindowWithExit external symbol unresolved at @ 8 referenced in function @ 4 _glutCreateWindow_ATEXIT_HACK
1> C: \ Users \ Oscar \ Documents \ Visual Studio 2008 \ Projects \ trianglew \ Debug \ trianglew.exe: fatal error LNK1120: 2 unresolved externals
1> The build log was saved at "file: / / c: \ Users \ Oscar \ Documents \ Visual Studio 2008 \ Projects \ trianglew \ trianglew \ Debug \ BuildLog.htm"
1> trianglew - 3 errors, 0 warnings
========== Build: 0 correct, 1 wrong, 0 upgraded, 0 skipped ==========

marshats
07-11-2010, 02:11 PM
Sounds like you are failing to link glut32.lib. Did you add that to your IDE's link options? You may also need two other libs ie

Linker -> Input and copy and paste this line in the Additional Dependencies field. "opengl32.lib glu32.lib glut32.lib"

Again, I suggest taking a look at freeglut link from above and freeglut binaries (http://www.transmissionzero.co.uk/software/freeglut-devel/). freeglut replaces glut and is a drop in replacement that is actively maintained. There is an Readme.txt file there that may require you to replace glut32.lib with freeglut.lib but other than that I believe it is the same. One nice thing is that you can compile it from source and thereby remove any issues with incorrect DLL for your particular OS.

ps a quick search online gave a link to installing and compiling freeglut (although for the older 2.4 rather than 2.6 version) at additional instructions (http://blog.thegabrielflores.com/2008/02/installing-freeglut-on-visual-studio.html)

oscar leo
07-11-2010, 08:49 PM
no if i make the link in additional library directories gives me error that the glu32.lib is not valid or damage

marshats
07-11-2010, 10:32 PM
Damaged or not valid, then that is exactly what is causing the problem because you do need that library. Are you 32bit or 64bit Win7? It could be that you have the wrong lib for your OS. If it were me I would compile the glut library from source that way you would have exactly what you need compiled for Win7--hence the link to freeglut. In addition, there is a link to windows binaries there if you don't want to take the time to compile for yourself.

Edit: did you mean glut32.lib or glu32.lib was giving the error message about being damaged/non-valid? The above paragraph was refering to glut32.lib not glu32.lib. If it is glu32.lib then the problem is the version that came with your compiler and has nothing to do with GLUT and its examples. glu is part of the SDK that comes with your compiler so it should already match your OS. Did you download and use a different glu32.lib than what came with your compiler? Seems to be similar to a previous post of yours that you had solved Post279128 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=279128#Post2791 28)

oscar leo
07-15-2010, 10:31 AM
ready but the application doesnt shows just the blackwindow of the cmd

marshats
07-15-2010, 07:45 PM
Which example are you trying?

Are you running Win7 in a Linux virtual machine?

oscar leo
07-16-2010, 11:37 AM
no in win7 and the sample is the olimpic

marshats
07-17-2010, 04:17 PM
Since it compiles fine but doesn't show a window when run then I am at a loss to explain the problem. A quick visit to the MSDN help forums -- many people are seeing this issue with Windows 7. Microsoft points the finger at the ATI/Nvidia drivers. You may want to go to the source of the problem Microsoft (http://social.msdn.microsoft.com/Forums/en-US/categories) and ask them your question with details of where you got your GLUT libraries and your specific OS? 32/64bit?, video card make and model? and video card driver software version number, and specific compiler VS2010?. Be as specific as possible and it doesn't hurt to give them the link to the exact glut example you are trying Olympic Example (http://www.opengl.org/resources/code/samples/glut_examples/examples/olympic.c)

Sorry I couldn't help resolve your problem. As a check, olympic.c compiles and runs fine on my Nvidia GeForce 9600 box so there is nothing wrong with the code.