PDA

View Full Version : OpenGL Question


B_Level
10-14-2006, 08:02 AM
I was wondering if someone could clear up a few questions I've got about OpenGL, or at least point me in the right direction.
First - what's with the different API versions 1.4, 1.5, 2.0, 2.1
I'm under the assumption that you would wan the latest version?
Second - How would you go about getting it? (SDK?)
It's just libs and header files if I'm correct so is there a place to download
them (the/a SDK)?
Lastly - besides GLUT and GLU are there other toolkits/extensions that are
commonly used?

I've spent quite a bit of time scouring the web (including the OGL and SiliconGraphics websites) trying to understand this but . . .
I know these question may seem ridiculous to some of you, I just wanted some clarification and needed to know if OpenGL is wort my while. Thanks.

mot
10-14-2006, 08:49 AM
I recommend you to start here: http://nehe.gamedev.net/lesson.asp?index=01

Version 1.4 with some extensions is probably enough for most things unless you want to use shaders. Remember that extensions are optional and some cards/drivers may not implement them, so you always need to check at runtime if they are present.

Also, "extensions" is an OpenGL mechanism; GLU and GLUT are not that kind of extensions, they are libraries built on top of OpenGL; don't get confused.

Aldacron
10-14-2006, 08:53 AM
First - what's with the different API versions 1.4, 1.5, 2.0, 2.1
I'm under the assumption that you would wan the latest version?

Each version adds new features and has been backwards compatible with previous versions thus far. OpenGL is in widespread use on a variety of platforms, not all of which are up to date. You don't ship OpenGL with your application. It is already installed on the target system as part of the graphics driver, so that means that your players could potentially have any version of OpenGL on their system. Not every one keeps their graphics card drivers up to date, so most people actually won't have the latest version.

OpenGL does provide a way for you to query the version at run time. This allows you to have different code paths making use of the best version available on any given machine, if you need it. OpenGL also has an extension API. Each new version usually incorporates features that were formerly released as extensions, so even if a particular player doesn't have the latest version he still might have extensions that provide the same features.


Second - How would you go about getting it? (SDK?)
It's just libs and header files if I'm correct so is there a place to download
them (the/a SDK)?


Assuming you have a C compiler on your system, you already have the SDK.


Lastly - besides GLUT and GLU are there other toolkits/extensions that are
commonly used?


GLU is an official utility API that goes hand-in-hand with OpenGL, GLUT is not. GLUT was a third-party library developed to make it easier to enable OpenGL in a cross-platform application and has not been updated in several years. I don't recommend it. Other libraries that handle initialization for you are SDL (http://www.libsdl.org/), GLFW (http://glfw.sourceforge.net/), and FreeGLUT (http://freeglut.sourceforge.net/).


I've spent quite a bit of time scouring the web (including the OGL and SiliconGraphics websites) trying to understand this but . . .
I know these question may seem ridiculous to some of you, I just wanted some clarification and needed to know if OpenGL is wort my while. Thanks.

A great place to start with OpenGL is a book titled "OpenGL SuperBible." (http://www.amazon.com/exec/obidos/ASIN/0672326019/amzna9-1-20/ref=nosim?dev-t=D26XECQVNV6NDQ%26camp=2025%26link_code=xm2) It's a great introduction for beginners. Most ogl programmers also have two other books on their shelves, the "OpenGL Reference Manual" (http://www.amazon.com/exec/obidos/ASIN/032117383X/amzna9-1-20/ref=nosim?dev-t=D26XECQVNV6NDQ%26camp=2025%26link_code=xm2) (aka the Blue Book) and the "OpenGL Programming Guide" ("http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321335732/ref=pd_sim_b_2/104-2132471-2078357?ie=UTF8) (aka the Red Book).

B_Level
10-16-2006, 04:09 AM
Thanks! that pretty much answers all my questions. Now to read and work:D

Bad Sector
10-17-2006, 01:13 AM
Avoid NeHe's tutorials at all costs!

While they're good at teaching you how to open a GL window and draw a triangle or a cube, they'll do more harm than good to you when learning OpenGL. I would recommend to read the Red Book (OpenGL Programming Guide). For starting up, you can read the Red Book for OpenGL 1.1 (http://www.rush3d.com/reference/opengl-redbook-1.1/) online (as linked by http://www.opengl.org/'s documentation page). Note that this is an older version (we're at 2.1, although there are only books up to 1.4...).

FlySim
10-17-2006, 11:41 AM
Whats wrong with NeHe tutorial's? I use them some, along with the red book, now you have me wondering what I am doing incorrectly?

Karja
10-17-2006, 12:31 PM
I second that... I didn't like the structure of the tutorials, but they were great as a quick-and-dirty reference for how to do certain (non-shader) stuff. Have I been misled as well?

zppz
10-17-2006, 10:14 PM
I learned a lot from NeHe's tutorials. I'm straining to think of any negative points about them... the early ones go over the code about setting up windows and the message loop etc, but I don't think that's a bad thing. I probably wouldn't have ventured into managing my own message loop (instead of using SDL or something) if I didn't have those tutorials to help me tackle it a bit at a time. Once that stuff is set up it doesn't bother you much.
The red book is definitely a good one to study though for a more official perspective.

There are a number of libraries to make it easier to determine which OpenGL version you are using and load up the available extensions. The one I use can be found at http://www.levp.de/3d/ although it is a little dated now.

Bad Sector
10-18-2006, 02:14 AM
I'm not talking about using them with the Red Book or as a quick-and-dirty reference (sometimes i even use them for this reason) - i'm talking about using them to learn OpenGL.

Using the Red Book with NeHe actually disables the NeHe's effect - the book will lead you to the right way :-). Although it says everything you may want to know (including how to initialize OpenGL under Windows), so i don't see why you want to read NeHe.

Sol_HSA
10-18-2006, 06:00 AM
I've been thinking about writing a "opengl the right way" tutorial series, which would skip all glbegin/glend sillyness and would do everything with vertex buffers from the beginning.. (which is pretty much the only way to do things in opengl es actually =).

As a "competitior" of NeHe, I've been joking that I could name it based on another pair of elements, such as argon and selenium..

Never had the time, yet at least.

princec
10-18-2006, 07:14 AM
glBegin/End have their uses. NeHe explains stuff the easy way. Later on you learn how to do stuff the hard, and fast, way.

Cas :)

Bad Sector
10-18-2006, 08:07 AM
glBegin/glEnd must be used in a beginner's tutorial. When writing tutorials you must always keep in mind that people want to see stuff as soon as possible. If you go the vertex/index buffer route, you'll need to explain a lot of things if you wanna do it right and not write "okay, here is the code that does it" (which, btw, is somewhat the way that NeHe does it).

Also, NeHe is the nickname of the author, not the tutorials. The tutorials became famous, they inherited the NeHe name from their author, but if you separate them, it won't work :-). Having said that, there are NeXe tutorials (http://nexe.gamedev.net/directKnowledge/), which try to be for DirectX what NeHe is for OpenGL.

Backov
10-18-2006, 09:17 AM
My opinion of the NeHe tutorials is that, for me, they're useless.

Whenever I want to know something - like a couple weeks ago, I needed to know what format file and what blending modes/settings I should use to do texture mapped text. I couldn't find what I needed in the NeHe tutorials that claim to do that.

Also, I've noticed that he seems to be VERY much "this is the code that will do that", rather than "These are the OpenGL concepts that you are using, fully explained, and this the example code that implements those concepts."

Bad BAD way to learn OpenGL.

Sol_HSA
10-27-2006, 02:24 AM
I think I've managed to explain relatively complex things with relatively small amount of code in my tutorials.. so we'll see if I find the time to whip together the argon-selenium tutorials =)

MedievalElks
10-27-2006, 05:46 AM
I'm not talking about using them with the Red Book or as a quick-and-dirty reference (sometimes i even use them for this reason) - i'm talking about using them to learn OpenGL.

So we really don't have to avoid them at *all* costs? Whew.

Using the Red Book with NeHe actually disables the NeHe's effect - the book will lead you to the right way :-).

So far you haven't indicated why NeHe tuts are bad, other than just saying it rather loudly.

Bad Sector
10-27-2006, 05:49 AM
Writing code in tutorials is not a bad thing. Actually it is a good thing, because you show what you explain in actual code. In fact, if you can provide a complete program that shows your effect, it'll be for the best.

However, writing a tutorial that provides code without explaining in detail what the code does and why it does what it does, is a bad thing.

Bad Sector
10-27-2006, 05:58 AM
So far you haven't indicated why NeHe tuts are bad, other than just saying it rather loudly.

Backov (and others, but Backov was clear on this) said everything i wanted to say. So i don't find it necessary to say that again, but if you insist, i believe that they're bad because they're code-centric without explaining in detail what they're doing.

Besides, code like this (from Lesson 06 (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06)):
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
is pathetic. What's wrong with TextureImage = NULL; :-/ ?

Bad code + bad explanation = bad tutorial. Period.

zppz
10-27-2006, 08:26 AM
...they're code-centric without explaining in detail what they're doing.
wow. I took a look at that lesson 6 - there's almost a paragraph of explanation for each line of code. You want more?

Bad Sector
10-27-2006, 09:17 AM
It's now how MUCH it says but WHAT is saying. These "paragraphs" (most are one-line long...) explain what the code does, but not why.

For example, it doesn't say why texturing works the way it does and why the values you pass work that way. It doesn't say why textures wrap (if you set it).

And it wouldn't even need to say it, if it included at least a diagram/image on how texturing works.

Just read the texturing guide on Red Book (it's nothing more than a tutorial) and then read that "Lesson 06" and come tell me that NeHe's L6 is good.