Posts: 713
Joined: 2002.04
Post: #16
Because (assuming you were not the one to just copy/paste the code into an Obj-C method) that isn't NeHe's code, but that of somebody who ported one of his tutorials?

On the books front, I'd recommend OpenGL: A Primer (Edward Angel) or Beginning OpenGL Game Development (Dave Astle, Kevin Hawkins.)

Mark Bishop
Student and freelance OS X & iOS developer
Quote this message in a reply
Post: #17
glClearColor( 0.0f, 0.0f, 0.0f, 0.5f );
When you call glClear(GL_COLOR_BIT), the color buffer is filled with this color.

glClearDepth( 1.0f );
When you call glClear(GL_DEPTH_BIT), the depth buffer is filled with this value.

glEnable( GL_DEPTH_TEST );
This enables depth testing: see below.

glDepthFunc( GL_LEQUAL );
Also to do with depth testing: see below.

Tells OpenGL to use the best interpolation possible when doing texture mapping.

When a polygon is rasterized, not only is color information written to the frame buffer, but depth information is also written to a separate depth buffer. Think of a ray from your eye to each pixel on the screen lit by a polygon. If the ray hits a polygon, a pixel is lit. The distance from your eye to the point on the polygon hit is known as the depth. This number is stored in the depth buffer. When another polygon is hit by the same ray, a depth test is performed to see if the new polygon is further away or closer. If closer, the new polygon's color (or fragment in OpenGL parlance) is written to the color buffer. glDepthFunc() allows you to specify the condition under which a fragment passes the depth test. GL_LEQUAL indicates that a fragment should pass if its depth value is less than or equal to that already written into the depth buffer by a previously rasterized polygon.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  bug in OpenGL setup for NSOpenGL subclass (I think) backslash 2 4,627 Jul 18, 2007 01:10 PM
Last Post: backslash
  xCode/SDL Setup hammonjj 2 5,860 Mar 2, 2007 06:37 AM
Last Post: hammonjj
  Fullscreen/Window Setup/toggle skyhawk 10 6,476 Oct 13, 2006 04:05 PM
Last Post: skyhawk
  Testing GL Setup Code (Help Wanted) Matrix 8 5,525 Sep 11, 2006 04:06 PM
Last Post: sjstux
  SDL 2D OpenGL setup unknown 13 9,549 Jul 16, 2005 09:07 PM
Last Post: unknown