Jump to content
  • Advertisement
Sign in to follow this  
ill

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

This topic is 3327 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

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
Advertisement
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!