iDevGames Forums
opengl es and functions - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Design (/forum-5.html)
+--- Thread: opengl es and functions (/thread-307.html)



opengl es and functions - burrows111 - Feb 23, 2010 04:15 PM

Hi all, please help,

am currently in the starting process of coding an opengl es "bowling" game,

i have small but goodish experience in opengl so ES shouldn't prove so hard to get to grips with, and i know 'C' abit but sadly i am not picking up objective c as well as hoped.

simply i am using the template that the SDK provides for an openGLes app, and yes runs fine, but am planning to implement game states . such as paused, main menu , etc.

I am having huge issues trying to get to grips with functions and their calls.

the template runs immediately a bouncing box, so what i am currently trying to do is edit this so that i am switching the state of the game and run a render function accordingly.

Code:
-(void) RenderPerState

{
    switch (gameState) {
        case 1:            //paused
            //do this while paused
            break;
        case 2:            //playing
            //do this while playing
            break;
        case 3:            //main menu
            -(void) render;
            break;
        case 4:            //splash screen
            //do this at splashscreen
            break;
        default:

            break;
    }
    
}

the case 3 statement all i want to do is run a function that was working but I just simply not calling it right..

suppose all i need ask is, how do i use correct syntax to run the render function

Code:
- (void) render
{
         // do my required opengl rendering.                
}

somebody please point this noob in the right direction.

thanks Smile


opengl es and functions - ThemsAllTook - Feb 23, 2010 07:28 PM

Code:
[self render];

http://developer.apple.com/iphone/library/referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/index.html