Jump to content
  • Advertisement
Sign in to follow this  
Steve Gee

OpenGL Splash Screen Issues with GLUT & OpenGL

This topic is 1991 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all,

 

I'm trying to create a splash / welcome screen for a game I'm working on.  I had a look online and found some good info but I'm still unable to get it to work.

 

Ideally I'd like my main to run a function that would initially display the splash screen, after input it would then display the main menu and from there each screen as appropriate, high scores, levels of game etc.

 

I've tried that and then I've tried an uglier approach but I can't get the right results.  I'm pretty new to OpenGL & GLUT and not fantastic when it comes to C++.

 

Any help would be hugely appreciated.

 

Below is code that I'm using / trying to use. stripped of unnecessary 'stuff'

 

At the moment there's no response when pressing space.  I've tried mouse butting, glut special keys etc but still no joy.

 

If there's also a more efficient way of doing this then please shout! :D

 

{

glutInit(&argc, argv);

createGenericWindow();

/////

screenSequence();   

 

glutMainLoop();

}

 

 

void screenSequence(){

 

    glutDisplayFunc(displaySplashScreen);


    glutIdleFunc(idleSplashScreen);

 

}


 


void displaySplashScreen(){


    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


    glLoadIdentity();


    splashScreen::drawSplashScreen();


    glMatrixMode(GL_MODELVIEW);


    glutSwapBuffers();


    glFlush(); 


}

 

 

void idleSplashScreen() {

 

    int button = 0;


    //if space is pressed...


    if ( button == 32) {


        std::cout<<"FEFEFEFEF"<<std::endl;


        glutDisplayFunc(displayMainGame);


        glutIdleFunc(idleMainGame);

    }


    glutPostRedisplay();

}

 

 

Share this post


Link to post
Share on other sites
Advertisement

Just as a quick question, when you talk about splash screens, do you mean those that come up as a program is loading ( see everything from the latest games to MS Office for examples of this, although my personal favourite are the Adobe ones. ), or do you mean a Title screen, such as that would likely say "Press start to continue"? For the first, I'd use a simple native window which just loads and displays an image and/or some text. This shouldn't be too hard, and you can probably find some decent code for this with a quick Google search. For the title screen, then you should probably treat it like any other "screen" in your game, and use the GLUT methods for reading from the keyboard. If you're having troubles with this part, then let us know. I don't really have a great deal of experience with GLUT myself, but I'm sure someone can give you a hand

 

Well, that will teach me to read a post properly. I'm not sure why the code isn't working, unless it has to do with you setting button to 0, then checking if it is equal to 32 (I'm assuming you have GLUT code in there to retrieve the key values, but obviously I'm not sure). Other than that, I haven't seen anything in the documentation to suggest that you need to do things differently to how you already are. Unfortunately, that's about as far as my usefulness extends. Best of luck in finding the solution to this problem, and I hope you'll leave a post detailing how you did it if you do.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!