*/
#include <SDL.h>
+#include <stdio.h>
#include "glext.h"
return 0;
}
+int glext_assert(const char *ext)
+{
+ if (!glext_check(ext))
+ {
+ fprintf(stderr, "Missing required OpenGL extension (%s)\n", ext);
+ return 0;
+ }
+ return 1;
+}
+
/*---------------------------------------------------------------------------*/
-#define SDL_GL_GFPA(fun, str) do { \
- ptr = SDL_GL_GetProcAddress(str); \
+#define SDL_GL_GFPA(fun, str) do { \
+ ptr = SDL_GL_GetProcAddress(str); \
memcpy(&fun, &ptr, sizeof (void *)); \
} while(0)
/*---------------------------------------------------------------------------*/
-void glext_init(void)
+int glext_init(void)
{
#if !ENABLE_OPENGLES
void *ptr;
- if (glext_check("ARB_multitexture"))
+ if (glext_assert("ARB_multitexture"))
{
SDL_GL_GFPA(glClientActiveTexture_, "glClientActiveTextureARB");
SDL_GL_GFPA(glActiveTexture_, "glActiveTextureARB");
}
+ else
+ return 0;
- if (glext_check("ARB_vertex_buffer_object"))
+ if (glext_assert("ARB_vertex_buffer_object"))
{
SDL_GL_GFPA(glGenBuffers_, "glGenBuffersARB");
SDL_GL_GFPA(glBindBuffer_, "glBindBufferARB");
SDL_GL_GFPA(glDeleteBuffers_, "glDeleteBuffersARB");
SDL_GL_GFPA(glIsBuffer_, "glIsBufferARB");
}
+ else
+ return 0;
- if (glext_check("ARB_point_parameters"))
+ if (glext_assert("ARB_point_parameters"))
SDL_GL_GFPA(glPointParameterfv_, "glPointParameterfvARB");
+ else
+ return 0;
+
+ return 1;
+
+#else
+
+ return 1;
#endif
}
if (SDL_SetVideoMode(w, h, 0, SDL_OPENGL | (f ? SDL_FULLSCREEN : 0)))
{
- glext_init();
-
config_set_d(CONFIG_FULLSCREEN, f);
config_set_d(CONFIG_WIDTH, w);
config_set_d(CONFIG_HEIGHT, h);
+ if (!glext_init())
+ return 0;
+
glViewport(0, 0, w, h);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);