Setup!
can someone explain what this sequince fo commands acually does?
all i know is nehe uses it and it works...
and whats a depth test?
all i know is nehe uses it and it works...
Code:
- (BOOL) initGL
{
glShadeModel( GL_SMOOTH );
glClearColor( 0.0f, 0.0f, 0.0f, 0.5f );
glClearDepth( 1.0f );
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LEQUAL );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
return TRUE;
}and whats a depth test?
you don't need the glShadeModel call, it does nothing.
you probably don't want the glClearColor call, the default is more useful than what you're setting it to
you don't need the glClearDepth call, it does nothing
you don't need the glHint(GL_PERSPECTIVE_CORRECTION_HINT, ...) call, it does nothing
glEnable(GL_DEPTH_TEST) turns on depth testing, so you can draw 3d objects in any order and they will obscure each other correctly based on distance from the camera
glDepthTest(GL_LEQUAL) says that pixels closer to the camera (Less) or an equal distance to the camera should be in front of existing pixels.
you probably don't want the glClearColor call, the default is more useful than what you're setting it to
you don't need the glClearDepth call, it does nothing
you don't need the glHint(GL_PERSPECTIVE_CORRECTION_HINT, ...) call, it does nothing
glEnable(GL_DEPTH_TEST) turns on depth testing, so you can draw 3d objects in any order and they will obscure each other correctly based on distance from the camera
glDepthTest(GL_LEQUAL) says that pixels closer to the camera (Less) or an equal distance to the camera should be in front of existing pixels.
and this enables texture stuff?
glEnable( GL_TEXTURE_2D );
glEnable( GL_TEXTURE_2D );
Coin Wrote:and this enables texture stuff?
glEnable( GL_TEXTURE_2D );
Its pretty much just telling OpenGL that you are enabling textures and you will be using 2d textures, not 3d textures. 2d textures is what you will want to use most the time especially when first learning OpenGL.
Must...Have...Last....Word..... Thanks.
Not to step on your last word, but sounds to me like you could use the Red Book
OneSadCookie Wrote:you don't need the glShadeModel call, it does nothing.To be pedantic, "it does nothing" isn't accurate. It sets the shading model to SMOOTH, just like it says. It so happens that SMOOTH is the default value, so the first time you do this, there is no effect.
But, maybe your app later changes the shading model to FLAT. Then if you call initGL again to re-initialize the state, this does something.
Coin Wrote:and this enables texture stuff?This enables application of the currently bound 2D texture during rasterization. There is a good deal of other state that affects this, so you really need to read the manual to understand what's going on.
glEnable( GL_TEXTURE_2D );
TomorrowPlusX Wrote:Not to step on your last word, but sounds to me like you could use the Red Book
will this do?
http://www.dei.isep.ipp.pt/cg/ftpdei/cgra/RedBook/
This looks to be the first edition from OGL 1 published in 1994.
The current printed is much more recent, I think 4th edition, covering additions since 1994, which I would think to be somewhat essential as there have been some changes since 1 to 1.4 ...
What it will do, like any doc, is explain to you systematically the elements of its target content. There is also a Blue Book available which is the corresponding reference manual.
Look through http://www.opengl.org/documentation/index.html
in other words, this is the FM.
manatee
The current printed is much more recent, I think 4th edition, covering additions since 1994, which I would think to be somewhat essential as there have been some changes since 1 to 1.4 ...
What it will do, like any doc, is explain to you systematically the elements of its target content. There is also a Blue Book available which is the corresponding reference manual.
Look through http://www.opengl.org/documentation/index.html
in other words, this is the FM.
manatee
For using the Blue Book, there are a couple of things that work well in addition to having a paper copy or pdf. Simply googling for the function, i.e. "glShadeModel" will turn up some reference pages. Alternatively, you could go into the Terminal application and type "man glShadeModel". Or, you could choose the menu item "Open man page..." from the Help menu of Xcode, and type in glShadeModel.
Most of these are faster than futzing with a PDF or a printed copy.
I'd really suggest going through _some_ edition of the Red book, though. At least the beginning parts.
-Jon
Most of these are faster than futzing with a PDF or a printed copy.
I'd really suggest going through _some_ edition of the Red book, though. At least the beginning parts.
-Jon
Thats a good reference but you really need to read something about fitting it all together. Try NeHe's guides if you cant afford the redbook, but if you have the money i REALLY recommend reading the redbook, its a great source of knowledge.
Ive been using NeHi's tutorials. They always die when i try to go full screen.... makes me sad
And if you just search the forum you'll find the fix for that.
And why hasn't nehe changed this. Has no one said anything?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| xCode/SDL Setup | hammonjj | 2 | 4,290 |
Mar 2, 2007 06:37 AM Last Post: hammonjj |
|
| SDL 2D OpenGL setup | unknown | 13 | 6,375 |
Jul 16, 2005 09:07 PM Last Post: unknown |
|
| OpenGL / SDL setup problem | Diplomtennis | 2 | 2,780 |
Oct 12, 2004 06:04 AM Last Post: Diplomtennis |
|
| OpenGL Setup - NIB or Code? | Justin Brimm | 16 | 6,460 |
Jun 24, 2004 02:48 PM Last Post: kelvin |
|
| OpenGL Setup Without GLUT | Justin Brimm | 3 | 3,450 |
Jan 25, 2004 11:44 PM Last Post: skyhawk |
|

