Thread: Help my program wont open.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    2

    Exclamation Help my program wont open.

    Code:
    #include "SDL.h"
    #include "SDL_opengl.h"
    #include <iostream>
    #include <string>
    int main(int argc, char* args[])
    {
        SDL_Init(SDL_INIT_EVERYTHING);
        //Opengl memory usage
        SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8);
        SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32);
        SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
        SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,1);
    
    
        SDL_WM_SetCaption( "My first game", NULL );
    
    
        SDL_SetVideoMode(600,400,32, SDL_OPENGL );
    
    
        glClearColor(1,1,1,1);
        glViewport(0,0,600,400);
        //Use this model
        glShadeModel(GL_SMOOTH);
        //glprojection=2D
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        //not 3d
        glDisable(GL_DEPTH_TEST);
    
    
        std::cout << "OpenGL is running\n";
        std::cout << "Main loop has started\n";
    
    
        bool isRunning = true;
    
    
        SDL_Event event;
    
    
        while ( isRunning )
        {
            while ( SDL_PollEvent(&event) )
            {
                if ( event.type == SDL_QUIT )
                {
                    isRunning = false;
                }
            }
    
    
    
    
        }
    
    
    
    
    
    
        std::cin.ignore();
        std::cin.get();
    
    
        SDL_Quit();
    
    
        return 0;
    }

    It is suppose to open as a window but when i run it nothing happens. I see it in task manager as a open process but not window or command prompt open. SDL_Delay and cin.get dont work. Can anyone see my problem? This is my first program in c++. Im usung code blocks with mingw compiler
    Last edited by L337; 07-03-2013 at 11:43 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help, my program wont run!
    By Avocado4Life in forum C Programming
    Replies: 6
    Last Post: 02-09-2011, 05:55 PM
  2. sob.. until now my program wont run...
    By lesrhac03 in forum C Programming
    Replies: 4
    Last Post: 03-31-2008, 11:38 AM
  3. App wont open
    By h_howee in forum Windows Programming
    Replies: 5
    Last Post: 09-06-2006, 04:40 PM
  4. program wont run, always aborts
    By stormfront in forum C Programming
    Replies: 31
    Last Post: 10-31-2005, 05:55 PM
  5. Window Wont Stay Open
    By Wes in forum C++ Programming
    Replies: 4
    Last Post: 08-26-2004, 12:50 AM