Sign in to follow this  
ill

OpenGL SDL + OpenGL creating console window, how to remove...

Recommended Posts

So when I launch my program it launches a console window as well as the main application window. I can close the console window and my app keeps running fine so it doesn't appear to be tied in with it or anything. Also when I close my app the console window closes with it. It's kinda like when you execute a batch file or any dos program and once it's done it closes the console window. So it seems like when I launch my program it opens it in a console first. Is there some way to remove this since it's kinda annoying? I remeber running a tutorial program I downloaded and it did the same thing. In case anyone needs to see it, this is the initialization code in my app so far. It's just crappy stuff to test my image drawing functions right now and not an actual engine code.
using namespace std;

#include "main.h"
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <IL/il.h>
#include "Image.h"

/*
 * The main entrypoint into the application
 */
int main(int argc, char* argv[])
{
    SDL_Event event;
    unsigned short i;
    bool appRunning = true;

    //INIT
    if(SDL_Init(SDL_INIT_VIDEO) == -1)
    {
        exit(EXIT_FAILURE);
    }

    if(SDL_SetVideoMode(640, 480, 32, SDL_OPENGL) == NULL)
    {
        return false;
    }

    //set clear color
    glClearColor(0, 0, 0, 0);

    //set orthographic projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 640, 480, 0, -100, 100);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    //glEnable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    //enable flat shading for sprite drawing
    //glShadeModel(GL_FLAT);

    if(glGetError() != GL_NO_ERROR)
    {
        return false;
    }

    SDL_WM_SetCaption("illEngine", NULL);

    ilInit();

    //application stuff goes here

    return(EXIT_SUCCESS);
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this