summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-10-01 13:05:13 -0600
committerBrian Paul <brianp@vmware.com>2009-10-01 13:14:49 -0600
commit336994e54cdc105f60ea37a541caed32da4615f1 (patch)
tree01ee35b0f822e113a9178744e6e415ae68e68adc /progs
parentca1bda552d1cd1a6ddc911e535681a10b9c2d846 (diff)
objview: check GL version/extension
Diffstat (limited to 'progs')
-rw-r--r--progs/objviewer/objview.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/progs/objviewer/objview.c b/progs/objviewer/objview.c
index a2b172b936..ad25e751a7 100644
--- a/progs/objviewer/objview.c
+++ b/progs/objviewer/objview.c
@@ -148,7 +148,7 @@ init_model(void)
glmFacetNormals(Model);
if (Model->numnormals == 0) {
GLfloat smoothing_angle = 90.0;
- printf("Generating normals.");
+ printf("Generating normals.\n");
glmVertexNormals(Model, smoothing_angle);
}
@@ -432,6 +432,32 @@ Motion(int x, int y)
}
+static void
+DoFeatureChecks(void)
+{
+ char *version = (char *) glGetString(GL_VERSION);
+ if (version[0] == '1') {
+ /* check for individual extensions */
+ if (!glutExtensionSupported("GL_ARB_texture_cube_map")) {
+ printf("Sorry, GL_ARB_texture_cube_map is required.\n");
+ exit(1);
+ }
+ if (!glutExtensionSupported("GL_ARB_vertex_shader")) {
+ printf("Sorry, GL_ARB_vertex_shader is required.\n");
+ exit(1);
+ }
+ if (!glutExtensionSupported("GL_ARB_fragment_shader")) {
+ printf("Sorry, GL_ARB_fragment_shader is required.\n");
+ exit(1);
+ }
+ if (!glutExtensionSupported("GL_ARB_vertex_buffer_object")) {
+ printf("Sorry, GL_ARB_vertex_buffer_object is required.\n");
+ exit(1);
+ }
+ }
+}
+
+
int
main(int argc, char** argv)
{
@@ -452,6 +478,8 @@ main(int argc, char** argv)
glewInit();
+ DoFeatureChecks();
+
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);