Welcome to Dream.In.Code
Getting Help is Easy!

Join 119,059 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,463 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Need help with Opengl

 
Reply to this topicStart new topic

Need help with Opengl

sjf123abc
post 5 Aug, 2008 - 06:26 PM
Post #1


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 24


My Contributions


When I downloaded glut there are certain files that I dont know what to do with.

There are:

-glut32.dll
-glut32.lib
-glut.def
-glut.h

I dont know if I need to put glut.def and glut32.dll in the include folder in the visual C++ 5.0 folder or in the lib folder. Please help. icon_up.gif

Here is the source code:

cpp
#include <iostream>
#include <windows.h>
#include <gl.h>
#include <glu.h>
#include <glut.h>
#include opengl32.lib
#include glu32.lib
#include glut32.lib
using namespace std;
int main()
{
return 0;
}

Mod edit: Please code.gif
Thanks, gabehabe smile.gif

This post has been edited by gabehabe: 6 Aug, 2008 - 03:28 AM
User is offlineProfile CardPM

Go to the top of the page


gabehabe
post 6 Aug, 2008 - 03:29 AM
Post #2


T3H R0XX0R!

Group Icon
Joined: 6 Feb, 2008
Posts: 3,641



Thanked 73 times

Dream Kudos: 2425

Expert In: (X)HTML, CSS, Batch Scripting, C, C++

My Contributions


I'm gonna move this to game programming, and I'm pretty sure you'll get a response from either stayscrisp or Tom.

...Spending too much time on this thread, I guess tongue.gif
User is online!Profile CardPM

Go to the top of the page

stayscrisp
post 6 Aug, 2008 - 05:16 AM
Post #3


D.I.C Head

**
Joined: 14 Feb, 2008
Posts: 231



Thanked 5 times
My Contributions



Hey

Uh oh someone hasn't been using google to its full potential tongue.gif

First of all

CODE

#include <iostream>  
#include <windows.h>  
#include <gl.h>  
#include <glu.h>  
#include <glut.h>  


is all you need for your includes, you cannot include lib files like this

CODE

#include opengl32.lib  
#include glu32.lib  
#include glut32.lib  


so instead of including them like this you need to move the files to the appropriate folder so that your compiler knows where they are smile.gif

copy glut32.dll to your system folder (c:\windows\system\ or something similar)

glut32.lib goes in your compilers lib folder (c:\Program Files\Visual Studio etc. \lib\)

glut.h goes into your compilers include folder (c:\Program Files\Visual Studio etc. \include\)

I would recommend copying that glu32.lib to the lib folder as well

once you have done this once you wont have to do it again unless you get a new compiler smile.gif

and for future reference only include header files like this <> and std header files like <iostream> do not include
cpp files, lib files, dll's or anything icon_up.gif

good luck


User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 6 Aug, 2008 - 05:27 AM
Post #4


T3H R0XX0R!

Group Icon
Joined: 6 Feb, 2008
Posts: 3,641



Thanked 73 times

Dream Kudos: 2425

Expert In: (X)HTML, CSS, Batch Scripting, C, C++

My Contributions


I was right! WOOO!

Anyway, in addition to this:
QUOTE
for future reference only include header files like this <> and std header files like <iostream> do not include
cpp files, lib files, dll's or anything
I'd like to add that when you include a custom header, you would include it with #include "myHeader.h" as opposed to standard files, which you would include with #include <iostream>

smile.gif
User is online!Profile CardPM

Go to the top of the page

Tom9729
post 6 Aug, 2008 - 05:49 AM
Post #5


Debian guru

Group Icon
Joined: 30 Dec, 2007
Posts: 1,429



Thanked 10 times

Dream Kudos: 325
My Contributions


Just a bit of nitpicking.

The OpenGL header files should be in a subfolder called "GL" inside your includes folder.

If you're using GLUT then you only need to include it's header file (it pulls the others in automatically).

So your OpenGL include should like like this assuming you're using GLUT.
#include <GL/glut.h>

The slash can go either way, and Windows isn't case sensitive so it doesn't matter if the "GL" is capitalized or not, but other systems (namely Linux and Mac OS X) will expect it to be like that. Even if you aren't planning on writing cross platform code, it's still a good habit to have in case you ever decide to.

C/C++ have ways of loading library files(LoadLibrary(..) on Windows I believe), but they are platform dependent so it's just best to toss the libraries in your compiler's library directory.

Using angle brackets ('<', '>') with an include macro indicates to the pre-processor that it should look for that file on the includes path. Typically in Windows this would be somewhere in the Visual C++ folder, in Linux it would probably be /usr/include. You could certainly add your own includes directory to the includes path, and reference your header files with angle brackets, but I wouldn't recommend it. smile.gif

Here's some tutorials on setting up GLUT with Visual Studio.
Visual Studio .NET 2003
Visual C++ 6.0
Visual Studio 2005
User is offlineProfile CardPM

Go to the top of the page

stayscrisp
post 6 Aug, 2008 - 06:05 AM
Post #6


D.I.C Head

**
Joined: 14 Feb, 2008
Posts: 231



Thanked 5 times
My Contributions



I must say that i was guessing a bit hehe, but im sure i was right.

I use Mac and Xcode which is entirely different for linking libraries, so my bad if anything was unclear or didnt work smile.gif
User is offlineProfile CardPM

Go to the top of the page

sjf123abc
post 6 Aug, 2008 - 12:27 PM
Post #7


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 24


My Contributions


I also have a file named glut.def, what do I do about that file?
User is offlineProfile CardPM

Go to the top of the page

stayscrisp
post 6 Aug, 2008 - 12:35 PM
Post #8


D.I.C Head

**
Joined: 14 Feb, 2008
Posts: 231



Thanked 5 times
My Contributions



I read that you can build the library using your compiler, usually these are something like .dsw so i think its just a project file and nothing to worry about smile.gif
User is offlineProfile CardPM

Go to the top of the page

sjf123abc
post 6 Aug, 2008 - 12:38 PM
Post #9


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 24


My Contributions


Thanks for all you guys help smile.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 04:00PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month