Starting with OpenGL, need some help

Posts: 3
Joined: 2010.07
Post: #1
Hi all, I just registered to this forum since I'm getting serious about developing a game and learning OpenGL. I'm following the tutorials from this blog while simultaneously starting on a game with very basic OpenGL functionality. At home I've also got the RedBook, but I intend to read more into it at a later point, once I know the basics.

I stumbled upon a problem and I could use some help. For my personal project I use Apple's OpenGL template. In the ES2Renderer class I've created a figure and now I'm trying to set the 'camera'. In order to set the camera I've added the glFrustum function, see the following code:

    [EAGLContext setCurrentContext:context];
    glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);

    glViewport(0, 0, backingWidth, backingHeight);
    glFrustumf(0.0, 200.0, 0.0, 200.0, 0.01, 1000.0); // this is causing an error

    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);

I get the following warning for the glFrustumf function: implicit declaration of function 'glFrustumf'. The warning doesn't make sense to me, since I believe the required header that contains the function should already be imported as part of the ES2Renderer class - the function should be part of gl.h, right?. When I comment out the line containing the glFrustumf function the code works just fine. Anyone have any idea what's going wrong here?
Quote this message in a reply
Posts: 713
Joined: 2002.04
Post: #2
I believe that should be glFrustum(), not glFrustumf() Wink

Edit: yeah, I'm: 1) wrong; 2) far too trusting of the documentation Annoyed

Mark Bishop
Student and freelance OS X & iOS developer
Quote this message in a reply
Posts: 3
Joined: 2010.07
Post: #3
I realize I've posted my question in the wrong subforum. Could some admin move this thread to the 2d / 3d graphics subforum?

Also, glFrustumf() should be correct, it's also color coded like any correct function is. It just seems to be missing somehow. I'm developing for the iPhone / iPad btw, perhaps my issue got something to do with this?

Edit: I think I figured out the issue. It seems glFrustumf() is a function that can only be used in OpenGL ES 1.x. I guess in OpenGL ES 2.0 I need shaders or some other method to achieve my goal, anyone got some suggestions?
Quote this message in a reply
Posts: 227
Joined: 2008.08
Post: #4
I believe all matrix related things in ES 2 were removed.
Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #5
Yes, you'll need to do all your own matrix math under ES2. This might help:
Quote this message in a reply
Posts: 3
Joined: 2010.07
Post: #6
(Jul 16, 2010 09:17 AM)ThemsAllTook Wrote:  Yes, you'll need to do all your own matrix math under ES2. This might help:

Thanks for the link, but after globally reading through the page I figured it might be a better idea to just start out with OpenGL ES 1.x before moving to OpenGL ES 2.0. It seems to me OpenGL ES 2.0 is quite a bit more complex, it doesn't seem a good introduction for a beginner.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Starting with OpenGL ES techy 2 4,001 Dec 21, 2009 12:10 PM
Last Post: techy
  Starting OpenGL ES DylanE 17 29,816 Jul 25, 2008 08:46 AM
Last Post: DylanE
  starting to work with openGL, need some help smartalco 1 3,654 Mar 26, 2007 08:21 PM
Last Post: arekkusu
  openGL questions before starting 3d engine code chopplebrains 16 12,123 Jan 15, 2003 01:42 PM
Last Post: henryj