diff options
-rw-r--r-- | glpong3d.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -71,7 +71,6 @@ int main(int argc, char * argv[]) { static int GLPong_Init(GLPong_t * GLPong) { - SDL_Surface * Surface = NULL; SDL_Surface * temp = NULL; GLuint texture; @@ -111,7 +110,10 @@ GLPong_Init(GLPong_t * GLPong) { } atexit(SDLNet_Quit); - Surface = SDL_SetVideoMode(GLPONG_WIDTH, GLPONG_HEIGHT, 32, SDL_OPENGL); + if (SDL_SetVideoMode(GLPONG_WIDTH, GLPONG_HEIGHT, 32, SDL_OPENGL) == NULL) { + fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); + return -1; + } glViewport(0, 0, GLPONG_WIDTH, GLPONG_HEIGHT); glMatrixMode(GL_PROJECTION); @@ -124,14 +126,14 @@ GLPong_Init(GLPong_t * GLPong) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glShadeModel(GL_SMOOTH); glEnable(GL_BLEND); -/* glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ /* disabled since it causes drawing corruption, but necessary to enable transparency */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); - printf("OpenGL Vendor: %s\n", glGetString(GL_VENDOR)); - printf("OpenGL Renderer: %s\n", glGetString(GL_RENDERER)); - printf("OpenGL Version: %s\n", glGetString(GL_VERSION)); - printf("OpenGL Extensions: %s\n", glGetString(GL_EXTENSIONS)); + printf("OpenGL Vendor: %s\n", (char *)glGetString(GL_VENDOR)); + printf("OpenGL Renderer: %s\n", (char *)glGetString(GL_RENDERER)); + printf("OpenGL Version: %s\n", (char *)glGetString(GL_VERSION)); + printf("OpenGL Extensions: %s\n", (char *)glGetString(GL_EXTENSIONS)); /*temp = IMG_Load("ball.png");*/ /* disabled since it's already loaded for the icon */ texture = SDL_GL_SurfaceToTexture(temp); |