Jump to content

  • Log In with Google      Sign In   
  • Create Account


opengl and c++


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 13 February 2013 - 04:30 PM

Hey, i recently bought the official book (8th edition) from safari books online and i have some questions:

 

1. i cant get any compiler to run opengl on c++, can you give me one that i should use? and how can i get it to work? (glut not working either)

 

2. where can i get the sample from the book? i mean there are function's that they make and i wanna see how they make it.

 

3. the book is a little hard for me because im kind of new to all that stuff (not programming) and i wanted to ask you how can i

learn what is all that shader stage's and stuff because it's really hard for me to get it and im trying really hard..

is there a site or something that explain it a little bit more understandable for me?

(my english is not that good and i some words may cause me some problems to understand and i really want to understand all of the book..)

 

 

if you guys could help me out that would be great!

i really need help on the third one though that's my priority :)

 

thanks!



Sponsor:

#2 __SKYe   Members   -  Reputation: 946

Like
3Likes
Like

Posted 13 February 2013 - 07:49 PM

Firstly, i've never read he book you're talking about, so i can't help you with those functions.

 

Now for the compilers.

If you're using windows, you can download the Microsoft Visual C++ Express 2010/2012 for free.

If not, then you can download code::blocks and use the MinGW compiler that comes with it.

 

If you can't make GLUT work, and you get linker errors, then you have to put the glut32.lib (or whatever it's called) in your compiler linker path.

 

For tutorials, you can go to http://nehe.gamedev.net/, although the tutorials are outdated, they still provide some good information.

For newer, shader based, OpenGL, you can go to http://www.arcsynthesis.org/gltut/index.html which has very useful tutorials about 3D programming. It uses GLUT in the examples though.

 

Also, these tutorials provide source code to compile and modify yourself, to try new things.

 

There are more compilers/IDEs, and sites, but i think these are the main used ones.

 

Hope it helps.



#3 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 14 February 2013 - 03:44 AM

where can i find glu32.lib?

 

thanks for the help! :)



#4 __SKYe   Members   -  Reputation: 946

Like
1Likes
Like

Posted 14 February 2013 - 07:53 AM

glu32.lib is the windows GLU static library.

You can download GLU here http://www.oocities.org/vmelkon/glu.html



#5 larspensjo   Members   -  Reputation: 1526

Like
2Likes
Like

Posted 14 February 2013 - 08:53 AM

If you need glu32.lib, chances are you are using legacy OpenGL. If you do that, make sure you understand what it means.

 

In the same way, don't spend too much time on the NEHE tutorials until you know about legacy OpenGL.


Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#6 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 14 February 2013 - 10:53 AM

i really dont knot what i need actually :\

i need glut i guess but how do i add it? (is it glu32.lib?)

 

if not, what is it and where can i find it and make it to work with my compiler?

 

thanks!



#7 __SKYe   Members   -  Reputation: 946

Like
1Likes
Like

Posted 15 February 2013 - 02:30 AM

AS larspensjo said, GLU and GLUT are deprecated, along with the NeHe tutorials (i just mentioned them, because they still provide some insight).

It's okay if you use them when you're starting learning, but they are no longer used in modern OpenGL.

 

The glu32.lib goes into the compiler lib folder. Then to use it in a project, you have to go to the project properties (this depends on the editor), and add the glu32.lib in the linker search path. Visual C++ has something like "Additional linker dependencies" in the project options, under the "Linker" tab.



#8 hikarihe   Members   -  Reputation: 243

Like
1Likes
Like

Posted 15 February 2013 - 02:59 AM

I'm not an expert but this is what works for me:

 

to use OpenGL you need to #include <GL\GL.h> and <GL\GLU.h>

 

and also you need to link to OpenGL32.lib and glu32.lib (in visual studio 2012, Project > Properties > Configuration Properties > Linker > Input > Additional Dependencies )

 

GL and GLU are part of OpenGL (correct me if I'm wrong!  ), GLUT is an external library so it's your choice if you want to use it. but if you use OpenGL you will need a library to set up your windows (so that you can use OpenGL to draw in them ) GLUT is an example of this.

 

the most useful book I came across is OpenGL Programming Guide.

 

PS. if you are a student you can use www.dreamspark.com to get Visual Studio for free

 

good luck ^^


Edited by hikarihe, 15 February 2013 - 03:01 AM.


#9 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 15 February 2013 - 03:26 AM

sorry i didnt know the differences between glu and glut.

 

so glu32.lib != GLUT?

if so what should i do to make glut to work with my compiler?

 

sorry for the newbie question's its just that im learning from the new book they going to release and there isn't any example's online (the site is down for like a month now) and

they using separate files to compile the code.. (the files that i need to see is not in the book but online.. :\ )

 

and if someone could help me out and tell me how can i learn better from this book (like how to get the online example if the main page of the site is down) that would be great! :)

 

thanks a lot for your help!



#10 __SKYe   Members   -  Reputation: 946

Like
1Likes
Like

Posted 15 February 2013 - 05:13 AM

OpenGL is the API.

Both GLU and GLUT are external libraries that provide functionality (and easiness of use) to OpenGL.

 

GLU serves many purposes, which can range from setting perspectives, building textures & mipmaps, creating predifined meshes (cone, etc) and more.

GLUT is a window management library for OpenGL. It allows you to create a window in any OS without using OS dependant code, hence it is portable.

 

glu32.lib is the GLU library.

glut32.lib is the GLUT library

 

And yes, the path for Visual C++ mentioned by hikarihe is correct, and is the same for VC++ 2010 Express.

I don't know if you need to be a student at that site though. When i downloaded Visual C++ 2010 Express i think it was on the Microsoft website (i still use 2010).



#11 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 15 February 2013 - 05:33 AM

Thanks a lot!

what do you recommend VC++ 2010 or Code::Blocks?

 

thanks again! :)



#12 __SKYe   Members   -  Reputation: 946

Like
1Likes
Like

Posted 15 February 2013 - 06:54 AM

For Windows, i prefer VC++ 2010/2012. For any other OS Code::Blocks is a choice, although i think there's some other good IDE for MacOSX that i don't remember the name.



#13 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 15 February 2013 - 07:12 AM

Thanks !

 

I have another question because i figured that my knowledge on C++ is not enough.

 

What should i learn in C++ to start developing good games and understand all the concept of it?

 

do you recommend C++ or Java to build games based on Opengl? (or other language's like C#)

 

(the main question i really want you guys to answer me is what should i learn in C++ to start developing (leaving the Opengl out))

 

Thanks for all your help that's really helpful!



#14 __SKYe   Members   -  Reputation: 946

Like
1Likes
Like

Posted 15 February 2013 - 07:34 AM

For the language I'll always advise C++, because that's probably the most used language, especially in game development, not to mention it's my favorite language, and the one i always use. But don't let me stop you from trying other languages, just ask other people and they will surely point out the good in any of them.

I know you can use LWJGL (which is a way to use OpenGL (and more, i think) on Java).

 

Now, if you don't know C++ yet, or  you think you don't know enough (and assuming that's the language you're going to learn), for now you should set apart the idea of making a game.

First you must use how to program in C++, and i mean really learn it (advanced stuff like pointers, classes, inheritance, templates, overloading, etc).

If you want online tutorials on C++, you can go to http://www.cplusplus.com/doc/tutorial/ and follow the tutorials there. They point out most of the C++ features you should know, although some of them take a lot of practice to perfect (like pointers).

 

Also, you should read about design patterns (after getting a good grasp on the language). They will help you designing better code.

 

After you have a good grasp in the language you can then start learning OpenGL.

Also, it would do you good to decide whether you want to learn the deprecated OpenGL functionality or not. I can't really said if it helps or not, but when i first learned OpenGL, i started there, so maybe when i learned shader based OpenGL the learning curve wasn't that difficult.

I'll let others advise more on this.

 

More than this, remember that a game is not only graphics (although graphics is a big part of them).

You could then learn OpenAL for audio (or FMOD, for example), DirectInput (on Windows only) for input, and a lot more.

 

Other than that i can only say to keep practicing. As they say, practice makes perfect (or at least close).



#15 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 15 February 2013 - 07:40 AM

Thanks a lot!!

That's really helpful! :)

I will finish learning C++ and then start learning some design patterns like you said i think that would be great for me :)



#16 larspensjo   Members   -  Reputation: 1526

Like
2Likes
Like

Posted 15 February 2013 - 07:47 AM

There are some really nice design patterns, and many of them are not limited to C++.

 

From my own experience, I find it hard to read about a design pattern and then start to use it. I almost always have to try to solve a problem first, develop an ugly solution, and then read about the pattern that shows how it really should have been done. Learning by mistakes.

 

C++ is a complicated language. Very powerful, but also with many opportunities to go wrong. To learn it, spend as much time as possible, and learn from mistakes.


Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#17 __SKYe   Members   -  Reputation: 946

Like
0Likes
Like

Posted 15 February 2013 - 08:45 AM

You're right, but i also think that if you starts learning about design patterns at the beginning (not exactly using them at the start, but knowing they exist), then you'd be able to adapt to them earlier.

 

I found it hard to start using them, because when i started programming i didn't even know they exist, so when i read them up, i found it difficult to start applying them, simply because i was not used to them.

 

But yes, one should always learning by trying (and failing).






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS