diff options
Diffstat (limited to 'src/render.c')
-rw-r--r-- | src/render.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/render.c b/src/render.c index d64f2cf..1ef1880 100644 --- a/src/render.c +++ b/src/render.c @@ -133,7 +133,7 @@ static void render_delete_shaders(RenderContext *r) { i++; /* OpenGL initial setup */ -RenderContext *render_setup(int width, int height) { +RenderContext *render_setup(int width, int height, int disable_vbos, int disable_fbos, int disable_shaders) { RenderContext *r; @@ -142,27 +142,50 @@ RenderContext *render_setup(int width, int height) { glewInit(); - if ( GLEW_VERSION_1_5 || GLEW_ARB_vertex_buffer_object ) { - r->vbos = 1; + if ( disable_vbos == 0 ) { + if ( GLEW_VERSION_1_5 || GLEW_ARB_vertex_buffer_object ) { + r->vbos = 1; + } else { + r->vbos = 0; + fprintf(stderr, "Vertex buffer objects are not supported by your graphics card (or maybe just by its driver).\n"); + fprintf(stderr, " -> Geometry performance may be less than optimal.\n"); + } } else { + printf("The use of vertex buffer objects has been disabled at your request.\n"); r->vbos = 0; - fprintf(stderr, "Vertex buffer objects are not supported by your graphics card (or maybe just by its driver).\n"); + } + if ( r->vbos == 0 ) { fprintf(stderr, " -> Geometry performance may be less than optimal.\n"); } - if ( GLEW_EXT_framebuffer_object ) { - r->fbos = 1; + if ( disable_fbos == 0 ) { + if ( GLEW_EXT_framebuffer_object ) { + r->fbos = 1; + } else { + r->fbos = 0; + fprintf(stderr, "Framebuffer objects are not supported by your graphics card (or maybe just by its driver).\n"); + } } else { + printf("The use of framebuffer objects has been disabled at your request.\n"); r->fbos = 0; - fprintf(stderr, "Framebuffer objects are not supported by your graphics card (or maybe just by its driver).\n"); + } + if ( r->fbos == 0 ) { fprintf(stderr, " -> Reflections and GPU dynamic textures disabled.\n"); } - if ( ( GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100 ) || GLEW_VERSION_2_0 ) { - r->shaders = 1; + if ( disable_shaders == 0 ) { + if ( ( GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GLEW_ARB_shader_objects && GLEW_ARB_shading_language_100 ) + || GLEW_VERSION_2_0 ) { + r->shaders = 1; + } else { + r->shaders = 0; + fprintf(stderr, "Shaders are not supported by your graphics card (or maybe just by its driver).\n"); + } } else { + printf("The use of shaders has been disabled at your request.\n"); r->shaders = 0; - fprintf(stderr, "Shaders are not supported by your graphics card (or maybe just by its driver).\n"); + } + if ( r->shaders == 0 ) { fprintf(stderr, " -> Per-fragment lighting and GPU dynamic textures disabled.\n"); } |