🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

starting out...

Started by
7 comments, last by Krohm 18 years ago
hey guys, i'm very interested in game programming and while reading Sams Teach Yourself Game Programming in 24 Hours (laugh all ya want, not too bad so far); but I thought some OpenGL lessons on the side might be fun. I thought starting out with the Nehe lessons might be a good idea; keep in mind I'm a total beginner. In Lesson 1, the author says a couple things that raised a red flag for me.. "This tutorial was completely rewritten January 2000" and "NOTE #2: When the first tutorials were written, GLAUX was the way to go. Over time GLAUX lost support. Many of the tutorials on this site still use the old GLAUX code. If your compiler does not support GLAUX or you would rather not use it, download the GLAUX REPLACEMENT CODE from the main page (left menu). " So, this code is 6 years old... is it worth it for me to start out here..? I don't want to learn outdated code esp. as a beginner because unfortunately, I get really frustrated. Is this a good place to start? And can someone link me to the 'GLAUX REPLACEMENT CODE'? I'm trying to find it. p.s. I'll be using MSVS2005... any major issues I can look for? TIA.
Advertisement
Yah, it's still current code for OpenGL. It's just that GLaux was the way to go for loading images, but now it is unsupported (GLaux, the GL code is fine).

Find it here: http://nehe.gamedev.net/ - It's under NeHe Misc., which is 4 headers down of the top (NeHe) of the left menu.

Basically all you do is replace the code:
if (textures[0] = AUX_Load(...)) { // or whatever it was specific to glaux    ...    // gl texture stuff} else    status = FALSE;

with:
// copy the function that replace Glaux, it was NeheLoadImage or something// it took the texture and filename, so the above code would becomeif (!NeheLoadImage("filename", textures[0]))    status = FALSE;

You'll get it when you look at it, don't worry [wink].
First of all, howdy and welcome!

Second: do you have any prior programming experience, or are you teaching yourself from scratch with the Sams book? Because if it is the latter, I'd advise becoming a bit more familiar with C/C++ before tackling OpenGL (that's not to say I think it is too difficult for you, just that picking it up is 100% easier when you're not learning the language you are writing it in at the same time).

However! If you still want to go ahead (and by all means, why not?), I can answer your questions:

1) You ask about learning outdated code: well, C has been around since approx. 1970 (Unix Epoch) and probably before, and C++ has had widespread acceptance since mid '90s I guess and is continuing on very strongly -- so, new MS OS Vista, mostly written in unmanaged C++ code I imagine ;). Thus, the outdated code part is mostly to do with OpenGL -- and yes, the code in the first several NeHe tutorials is a little 'outdated' -- it is based on OpenGL 1.1 (which is the default version for Windows XP/2k sadly...) and we're currently up to version 2.0 -- if you check out Current version notes you can see what has changed on the way from 1.1.

Truth is though, the things you learn in the first couple of tutorials...don't need anything better than 1.1. Rendering a spinning quad procedurally is the same now as it was in 2000 -- so go ahead and learn those things, it's just like learning 'hello world' programs in C++. The meatier things (Vertex and pixel shaders for example) are made much easier in newer versions of GL, and they let you do much cooler stuff, but like I said...you don't need this power right now.

2) Replacement for glaux: With a bit of trickery -- you can see just what glaux does for you -- if you click on something that comes from glaux library -- say for example an 'AUX_RGBImageRec' -- right click on it and 'go to declaration' will hopefully bring up the glaux.h header file and you can read the declaration of the structure :)

Why is this useful? Because in a while, you might want to write your own functions and classes to replace the crud that is in glaux.

However, for the time being, because WinXP/2k have glaux come with the Platform SDK, you can probably use it until you get further on in the tutorials -- at which point, a much better system is introduced.

That said, most pros never reinvent the wheel when they don't need to, thus -- if you'd like a useful -free- library that gives you the same functionality as the oldschool GLUT (GL utilities...), check out freeglut over at source forge. It's an API that abstracts all sorts of draining tasks like setting up windows, creating menus and also keyboard input etc. It's not the best for super speed -- but it is good for cross platform abstraction (i.e., avoiding platform specific function calls).

Still, it isn't a wholesale replacement of glaux -- loading an image (one of the most useful things glaux abstracts...) isn't provided by freeglut -- so for now (until you learn how to read files manually, or find a better library -- google has plenty -- or you can just use the Ipicture stuff that Nehe made) just use glaux -- but beware! If it says that a function loads a BMP file...don't give it a JPG/PNG/TGA, whatever -- it won't work. Image files have specific data in them that we can use when we load them to find out stuff about the image itself (bit depth, etc).

That said, the use of glaux that Nehe makes is...not very in depth -- so, luckily, you can learn away without worry, because the few things that Nehe has used -- as easy to do yourself, or can be done in things like freeglut.



~Shiny.
------------'C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg.' -Bjarne Stroustrup
Anon. Poster and Shiny,
thanks for the replies. right now, i'm barely getting started. to answer a couple of questions..

Shiny, I'm a comp. sci. major so I do know C/C++. I don't think I'm a good programmer, but I should be able to understand anything in those languages. If I do have questions, I'll post 'em here ;)

I started on the Game Programming in 24 hours book last summer ('05) but I only got through 10 lessons. I'm reviewing the 10th lesson right now and having slight difficulty, but I figure I shouldn't let that discourage me, esp. as a beginner. Last year, I remember getting stuck on lessons for a few days and I wasted a lot of time that way.. so I figure learning OpenGL on the side will be worthwhile.

So... I'm stuck already. I'm suppose to link the OpenGL libraries by.. "In Visual C++ go to Project, Settings, and then click on the LINK tab." Under Project in MSVS2005, there is no 'Settings'.. I see Properties, but then I don't know where to go from there. eh, someone?
Quote: Original post by sspeedy
Anon. Poster and Shiny,
thanks for the replies. right now, i'm barely getting started. to answer a couple of questions..

Shiny, I'm a comp. sci. major so I do know C/C++. I don't think I'm a good programmer, but I should be able to understand anything in those languages. If I do have questions, I'll post 'em here ;)

I started on the Game Programming in 24 hours book last summer ('05) but I only got through 10 lessons. I'm reviewing the 10th lesson right now and having slight difficulty, but I figure I shouldn't let that discourage me, esp. as a beginner. Last year, I remember getting stuck on lessons for a few days and I wasted a lot of time that way.. so I figure learning OpenGL on the side will be worthwhile.

So... I'm stuck already. I'm suppose to link the OpenGL libraries by.. "In Visual C++ go to Project, Settings, and then click on the LINK tab." Under Project in MSVS2005, there is no 'Settings'.. I see Properties, but then I don't know where to go from there. eh, someone?


Me again [lol]:
I'm not sure about the settings thing, but a quick and easily changable way of linking is to do:
#pragma comment(lib, "OpenGL32.lib")#pragma comment(lib, "GLu32.lib")

At the beginning of the program (just at the top of main or something - only once). This is Visual C++ specific, but is ok since you're using VC++. It's pretty nice since it allows you to easily change it without being burried in menus, etc..

Good luck!

(By the way, did you get my post about the glaux thing? I think I went a little vague on that.)
Quote: Original post by Anonymous Poster
Quote: Original post by sspeedy
Anon. Poster and Shiny,
thanks for the replies. right now, i'm barely getting started. to answer a couple of questions..

Shiny, I'm a comp. sci. major so I do know C/C++. I don't think I'm a good programmer, but I should be able to understand anything in those languages. If I do have questions, I'll post 'em here ;)

I started on the Game Programming in 24 hours book last summer ('05) but I only got through 10 lessons. I'm reviewing the 10th lesson right now and having slight difficulty, but I figure I shouldn't let that discourage me, esp. as a beginner. Last year, I remember getting stuck on lessons for a few days and I wasted a lot of time that way.. so I figure learning OpenGL on the side will be worthwhile.

So... I'm stuck already. I'm suppose to link the OpenGL libraries by.. "In Visual C++ go to Project, Settings, and then click on the LINK tab." Under Project in MSVS2005, there is no 'Settings'.. I see Properties, but then I don't know where to go from there. eh, someone?


Me again [lol]:
I'm not sure about the settings thing, but a quick and easily changable way of linking is to do:
*** Source Snippet Removed ***
At the beginning of the program (just at the top of main or something - only once). This is Visual C++ specific, but is ok since you're using VC++. It's pretty nice since it allows you to easily change it without being burried in menus, etc..

Good luck!

(By the way, did you get my post about the glaux thing? I think I went a little vague on that.)


ah, thanks same Anon. Poster, ha. yeah, I think I got your post.. I found the code too btw.. but we'll see once I get there.. if I ever do!!

-----EDIT------
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "GLu32.lib")
..verbatim?


[Edited by - sspeedy on June 25, 2006 10:19:29 PM]
If you want better glAux free texture loading code i suggest that you jump ahead to lesson 24 and 33.
Quote: Original post by sspeedy
hey guys,
i'm very interested in game programming and while reading Sams Teach Yourself Game Programming in 24 Hours (laugh all ya want, not too bad so far); but I thought some OpenGL lessons on the side might be fun.

I thought starting out with the Nehe lessons might be a good idea; keep in mind I'm a total beginner.

In Lesson 1, the author says a couple things that raised a red flag for me.. "This tutorial was completely rewritten January 2000" and "NOTE #2: When the first tutorials were written, GLAUX was the way to go. Over time GLAUX lost support. Many of the tutorials on this site still use the old GLAUX code. If your compiler does not support GLAUX or you would rather not use it, download the GLAUX REPLACEMENT CODE from the main page (left menu). "

So, this code is 6 years old... is it worth it for me to start out here..? I don't want to learn outdated code esp. as a beginner because unfortunately, I get really frustrated.

Is this a good place to start? And can someone link me to the 'GLAUX REPLACEMENT CODE'? I'm trying to find it.

p.s. I'll be using MSVS2005... any major issues I can look for?

TIA.

It should be pointed out that we currently have assembled a nehedev team, we are rewriting the nehe tutorial content. So you expect to see updates on this in the near future, it may be good to check in on nehe later on. The new content should help with the concerns you have mentioned.
Quote: Original post by DevLiquidKnight
It should be pointed out that we currently have assembled a nehedev team, we are rewriting the nehe tutorial content...

I hope proper attention will be given to loading textures. Interfacing (and building) libjpeg and libpng isn't all that hard at the end. Since they're proven standards, they should be at least mentioned.

Back on topic:
sspeedy, make sure you understand pointers. Pointers are really your friends, allow you to do a lot of funny things and are the way you must use to work with GL data. They are not the monsters everyone says, just make sure you practice your swordplay before trying the tricks (or you'll really end up without your foot). ;)

Previously "Krohm"

This topic is closed to new replies.

Advertisement