Text Dissappearing in Engine

Started by
0 comments, last by zedzeek 17 years, 11 months ago
Hiya! I have a simple game engine that controls itself via a master object that controls all of the sub-classes. When I go into my intro screen I press 'Enter' and the main game state takes over. When a player loses the game and it goes back to the intro state, the title text does not show up... yet my other text/objects are fine. I'm not sure why. Is there anything I should look for to help me figure the issue out? PS. I also am not sure whether or not to actually use the delete keyword when switching states, or simply set the pointer to NULL. With NULL, the destructor is not called correct? Is this an issue when switching back to the state after setting it to NULL however long ago? Here is some code for my controlling class:
/* Call graphics routines as needed
==========================================================*/
bool GameState::Render()
{
    // if 'Escape' has been pressed, end app
    if(keys[VK_ESCAPE])
        end = true;

    // if current state is the main game
    if (currentState == MAINGAME)
    {
        // if not already done so, create the main gamestate
        if(!main)
            main = new MainState(hDC);

        // step through frame
        main->Step(keys);

        // if game has ended
        if(main->end)
        {
            currentState = INTRO;
            //delete main;
            main = NULL;
        }
    }
    // if current state is the intro screen
    else if (currentState == INTRO)
    {
        // if not already done so, create the main gamestate
        if(!intro)
            intro = new IntroState(hDC);

        intro->Step(keys);

        // if game need to be started
        if(intro->end)
        {
            currentState = MAINGAME;    // current state becomes the main game
            //delete intro;
            intro = NULL;
        }
    }

    SwapBuffers(hDC);                   // swap buffers (double buffering)
}
Advertisement
youre most likely leaving something on and forgetting to turn it off (or visaversa)
perhaps use glPushAttrib( GL_ALL_ATTRIB_BITS );
glPopAttrib() to track down the problem or use glintercept

This topic is closed to new replies.

Advertisement