X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=vid_shared.c;h=0da502200ebb1ef04285ee38fec8e0a5595131e1;hb=3a12518a4f3897519c5578d154c597b8549b8dcf;hp=d1ee155e21c6e26aa54833e492828c2aac0d3217;hpb=5e897f6bbce35328f90dc7904dd23941ef1a67b5;p=xonotic%2Fdarkplaces.git diff --git a/vid_shared.c b/vid_shared.c index d1ee155e..0da50220 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -58,6 +58,8 @@ int gl_support_shading_language_100 = false; int gl_support_vertex_shader = false; // GL_ARB_fragment_shader int gl_support_fragment_shader = false; +//GL_ARB_vertex_buffer_object +int gl_support_arb_vertex_buffer_object; // LordHavoc: if window is hidden, don't update screen qboolean vid_hidden = true; @@ -83,6 +85,7 @@ cvar_t vid_stereobuffer = {CVAR_SAVE, "vid_stereobuffer", "0", "enables 'quad-bu cvar_t vid_vsync = {CVAR_SAVE, "vid_vsync", "0", "sync to vertical blank, prevents 'tearing' (seeing part of one frame and part of another on the screen at the same time), automatically disabled when doing timedemo benchmarks"}; cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1", "whether to use the mouse in windowed mode (fullscreen always does)"}; +cvar_t vid_grabkeyboard = {CVAR_SAVE, "vid_grabkeyboard", "1", "whether to grab the keyboard when mouse is active (prevents use of volume control keys, music player keys, etc on some keyboards)"}; cvar_t vid_minwidth = {0, "vid_minwidth", "0", "minimum vid_width that is acceptable (to be set in default.cfg in mods)"}; cvar_t vid_minheight = {0, "vid_minheight", "0", "minimum vid_height that is acceptable (to be set in default.cfg in mods)"}; cvar_t gl_combine = {0, "gl_combine", "1", "faster rendering by using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"}; @@ -347,6 +350,16 @@ GLint (GLAPIENTRY *qglGetAttribLocationARB)(GLhandleARB programObj, const GLchar //void (GLAPIENTRY *qglGetVertexAttribivARB)(GLuint index, GLenum pname, GLint *params); //void (GLAPIENTRY *qglGetVertexAttribPointervARB)(GLuint index, GLenum pname, GLvoid **pointer); +//GL_ARB_vertex_buffer_object +void (GLAPIENTRY *qglBindBufferARB) (GLenum target, GLuint buffer); +void (GLAPIENTRY *qglDeleteBuffersARB) (GLsizei n, const GLuint *buffers); +void (GLAPIENTRY *qglGenBuffersARB) (GLsizei n, GLuint *buffers); +GLboolean (GLAPIENTRY *qglIsBufferARB) (GLuint buffer); +GLvoid* (GLAPIENTRY *qglMapBufferARB) (GLenum target, GLenum access); +GLboolean (GLAPIENTRY *qglUnmapBufferARB) (GLenum target); +void (GLAPIENTRY *qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +void (GLAPIENTRY *qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); + int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *disableparm, int silent) { int failed = false; @@ -644,6 +657,18 @@ static dllfunction_t vertexshaderfuncs[] = {NULL, NULL} }; +static dllfunction_t vbofuncs[] = +{ + {"glBindBufferARB" , (void **) &qglBindBufferARB}, + {"glDeleteBuffersARB" , (void **) &qglDeleteBuffersARB}, + {"glGenBuffersARB" , (void **) &qglGenBuffersARB}, + {"glIsBufferARB" , (void **) &qglIsBufferARB}, + {"glMapBufferARB" , (void **) &qglMapBufferARB}, + {"glUnmapBufferARB" , (void **) &qglUnmapBufferARB}, + {"glBufferDataARB" , (void **) &qglBufferDataARB}, + {"glBufferSubDataARB" , (void **) &qglBufferSubDataARB}, + {NULL, NULL} +}; void VID_CheckExtensions(void) { @@ -672,6 +697,7 @@ void VID_CheckExtensions(void) gl_support_shading_language_100 = false; gl_support_vertex_shader = false; gl_support_fragment_shader = false; + gl_support_arb_vertex_buffer_object = false; if (!GL_CheckExtension("OpenGL 1.1.0", opengl110funcs, NULL, false)) Sys_Error("OpenGL 1.1.0 functions not found"); @@ -728,12 +754,15 @@ void VID_CheckExtensions(void) gl_support_ext_blend_minmax = GL_CheckExtension("GL_EXT_blend_minmax", blendequationfuncs, "-noblendminmax", false); gl_support_ext_blend_subtract = GL_CheckExtension("GL_EXT_blend_subtract", blendequationfuncs, "-noblendsubtract", false); -// COMMANDLINEOPTION: GL: -noseparatestencil disables use of OpenGL2.0 glStencilOpSeparate and GL_ATI_separate_stencil extensions (accelerates shadow rendering) +// COMMANDLINEOPTION: GL: -noseparatestencil disables use of OpenGL2.0 glStencilOpSeparate and GL_ATI_separate_stencil extensions (which accelerate shadow rendering) if (!(gl_support_separatestencil = GL_CheckExtension("glStencilOpSeparate", gl2separatestencilfuncs, "-noseparatestencil", false))) gl_support_separatestencil = GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "-noseparatestencil", false); -// COMMANDLINEOPTION: GL: -nostenciltwoside disables GL_EXT_stencil_two_side (accelerates shadow rendering) +// COMMANDLINEOPTION: GL: -nostenciltwoside disables GL_EXT_stencil_two_side (which accelerate shadow rendering) gl_support_stenciltwoside = GL_CheckExtension("GL_EXT_stencil_two_side", stenciltwosidefuncs, "-nostenciltwoside", false); +// COMMANDLINEOPTION: GL: -novbo disables GL_ARB_vertex_buffer_object (which accelerates rendering) + gl_support_arb_vertex_buffer_object = GL_CheckExtension("GL_ARB_vertex_buffer_object", vbofuncs, "-novbo", false); + // we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code if (qglDrawRangeElements == NULL) qglDrawRangeElements = qglDrawRangeElementsEXT; @@ -938,6 +967,7 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_stereobuffer); Cvar_RegisterVariable(&vid_vsync); Cvar_RegisterVariable(&vid_mouse); + Cvar_RegisterVariable(&vid_grabkeyboard); Cvar_RegisterVariable(&vid_minwidth); Cvar_RegisterVariable(&vid_minheight); Cvar_RegisterVariable(&gl_combine);