#### Archived

This topic is now archived and is closed to further replies.

# Beginners oGL fun...

This topic is 5590 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Not to sound like a complete idiot, but I''m left confused between the various versions and platforms available. I have programmed in oGL before (but it was simple stuff and over a year ago now) on a Linux platform using a pre-installed GLUT library. I find myself confused as to what exactly I need to get to start programming oGL on my VC++ 6.0 win32 environment. Half of the info I''ve found either mentions nothing of GL libraries and assumes I have them and know what to do with them and the other half refer solidly to the win32 port of GLUT. I notice the NeHe tutorials give steps to start a project and a simple window, but this appears to not use GLUT (which is probably a good thing). So my question is, if this is the case, can someone point me in the right direction to get some GL library files? Regards.

##### Share on other sites
This will sound amazing, but you already have everything you need. MSVC comes with OpenGL libraries.

Ofcorse you have to have OpenGL installed, not the VC++ files, the dlls.

##### Share on other sites
Thanks for the help.
So I''m half way there?

Explain; what do you mean by
"you have to have OpenGL installed, not the VC++ files, the dlls"

I ask because it might be so glaringly obvious that I''m missing the point, but if I have the oGL libraries due to having MSVC what more do I need to do, if anything?

Thanks again,
Neil.

##### Share on other sites
quote:
Original post by Juicy
Thanks for the help.
So I''m half way there?

Explain; what do you mean by
"you have to have OpenGL installed, not the VC++ files, the dlls"

I ask because it might be so glaringly obvious that I''m missing the point, but if I have the oGL libraries due to having MSVC what more do I need to do, if anything?

Thanks again,
Neil.

You need the OGL runtime libraries in order to be able to run OGL programs. That''s usually taken care of by M$haft Winblows... Don''t worry about them. I''m about pretty sure( 98% ) that you have them on your system already... [Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com] #### Share this post ##### Link to post ##### Share on other sites LOL "M$haft Winblows"

Ok, I''m set then

Thanks for the information. It''s rare to find a forum where people are so happy and quick to help out.

Regards,
Neil.

##### Share on other sites
Win98 and something after that (whatever they name it! ) comes with OpenGL. If you still use win95, you can download one from microsoft.

GLUT is a platform independent windowing toolkit, which make it a lot easier to use, compared to WinAPI.

##### Share on other sites
I was tempted to make my oGL code a class which will be portable code, then have any platform specific code seperate, but using this class.

I''m not too sure of the implications of trying this, but I need to make the code portable.
The reason for this is I will be developing on a linux environment using GLUT and on a win32 platform using MSVC.

Again, though, thankyou for the information.

##### Share on other sites
Hi Juicy,
I''m a beginner too and once I get my feet under me I plan to be on here asking questions a LOT, so I will take this opportunity to help you.

I''m actually learning Visual C++ 6.0 and OpenGL simultaneously and it''s been a hoot. I have a friend who has professional experience at OpenGL who''s been helping me along the way.

Do you have a book you''re using to learn OpenGL from? I''m using Game Programming with OpenGL (the one recommended on the main NeHe page) and I can''t say enough good things about it.

Anyway, if you have at least Windows 98, then if you follow the following instructions you will be able to get started using OpenGL inside VC++ quickly:

1. Click File/New, choose Project/Win32 application, give it a name, and choose "empty project".
2. Cick Project/Settings/Link, Category Input, and if they''re not already there, add glu32.lib opengl32.lib to the end of the line. You might need to add another if you want to use glut - the book I''m learning from doesn''t touch glut.
3. Click Tools/Options, click the Directories tab, choose Library files from the Show Directories For dropdown, and make sure that wherever those files are stored on your machine is in the list of directories.

From here you should be able to compile, link, and run any basic Windows program. I would paste you some code, but the only sample code I have is plagarized from the above book and I don''t want to get in trouble. I''m sure you can find some code to play with if you go to the website of the authors of that book though.

Do you know MFC at all? I''ve been playing around with MFC and I''ve figured out how to incorporate MFC with OpenGL. It''s actually not hard at all - every dialog object has a device context property, all you have to do is send it to wglCreateContext or whatever that is. You can create two dialogs and have one contain controls like spin buttons or color selectors and then have the second dialog render based on the first''s settings.

I haven''t yet figured out how to declare *part* of a dialog''s device context as the rendering device (so you could have buttons along the bottom and have the rendering result on the remainder of the one dialog, eliminating the need for two) but I''m sure it''s possible.

I hope this helps!

Joe

##### Share on other sites
I''d stay away from GLUT. It is portable, but it is lacking a lot of features that Windows and Linux have to offer.

##### Share on other sites
quote:
Original post by DalTXColtsFan
..*deletia*..

I hope this helps!

Joe

It did. I''ve yet to get the time to sit down and try this out, but I''ve used MSVC before. But your hints are always welcome, and in fact you reminded me about the including of the .dlls which I''d have forgotten and no doubt caused me lots of hasstle

##### Share on other sites
Just to add to what Joe said, if you don''t want to bother editing the project settings every time you want to make an oGL app, you can instruct the compiler to link the required libraries with a coupla lines at the start of code:

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glaux.lib")

This is a compiler directive, and tells the compiler to tell the linker to include those libraries in the build even if they''re not explicity mentioned in the project settings.

HTH

www.coldcity.com
code, pics, life

##### Share on other sites
is the #pragma is MSVC specific? What if I use some other compiler...
say .. MingW? (GNU GCC port for windows)

##### Share on other sites

How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

##### Share on other sites
varokasp: I believe it''s MSVC-specific; there may be an equivalent setting for MingW or the libraries to link with may only be specified in project settings/command line options/whatever (don''t know the compiler)

siaspete: He already has tried NeHe.

www.coldcity.com
code, pics, life

##### Share on other sites
quote:
Original post by siaspete

How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Sometimes, especially when you're a beginner, wading through 30 to 50 tutorials is like wading through a textbook written in Greek. And even when you do take it slow, sometimes you miss 1 or 2 important facts that totally stop you. For example, I'm learning from the Game Programming with OpenGL book mentioned on NeHe's site and I missed the line that said to add those 2 libraries. I had to ask a friend for help when I got the linker errors.

I see nothing wrong with coming on and asking a specific question - if someone knows the answer off the top of his head and it's a simple thing like what I typed it can be worth the time.

Having said that, you're right that there are some people who simply don't want to do their own thinking and abuse forums like these, but I don't think Juicy is that kind of person, and besides, people who don't at least TRY to dig into MSDN or google or sites like that to look for answers are doing themselves a HUGE disservice IMHO - you can really learn a lot accidentally!

[edited by - DalTXColtsFan on October 2, 2002 10:14:18 AM]

##### Share on other sites
quote:
Original post by IainC
Just to add to what Joe said, if you don''t want to bother editing the project settings every time you want to make an oGL app, you can instruct the compiler to link the required libraries with a coupla lines at the start of code:

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#pragma comment(lib, "glaux.lib")

This is a compiler directive, and tells the compiler to tell the linker to include those libraries in the build even if they''re not explicity mentioned in the project settings.

HTH

www.coldcity.com
code, pics, life

I did not know this - thank you!

##### Share on other sites
quote:
Original post by DalTXColtsFan
Having said that, you''re right that there are some people who simply don''t want to do their own thinking and abuse forums like these, but I don''t think Juicy is that kind of person, and besides, people who don''t at least TRY to dig into MSDN or google or sites like that to look for answers are doing themselves a HUGE disservice IMHO - you can really learn a lot accidentally!

if they don''t think, they just download the nehe tutorial, unzip it and see it works! _then_ they might ask why it works, and why there is no need for some specific opengl libraries, and they guess its already there...

btw, try sdl (www.libsdl.org) its great as well, i use it all the time..

"take a look around" - limp bizkit