typedef double GLdouble;
// double precision float in [0,1]
typedef double GLclampd;
+// int whose size is the same as a pointer (?)
+typedef size_t GLintptrARB;
+// int whose size is the same as a pointer (?)
+typedef size_t GLsizeiptrARB;
#define GL_MODELVIEW 0x1700
#define GL_PROJECTION 0x1701
//GL_ARB_texture_non_power_of_two
extern int gl_support_arb_texture_non_power_of_two;
+//GL_ARB_vertex_buffer_object
+extern int gl_support_arb_vertex_buffer_object;
+#ifndef GL_ARRAY_BUFFER_ARB
+#define GL_ARRAY_BUFFER_ARB 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
+#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
+#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
+#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
+#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
+#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
+#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
+#define GL_STREAM_DRAW_ARB 0x88E0
+#define GL_STREAM_READ_ARB 0x88E1
+#define GL_STREAM_COPY_ARB 0x88E2
+#define GL_STATIC_DRAW_ARB 0x88E4
+#define GL_STATIC_READ_ARB 0x88E5
+#define GL_STATIC_COPY_ARB 0x88E6
+#define GL_DYNAMIC_DRAW_ARB 0x88E8
+#define GL_DYNAMIC_READ_ARB 0x88E9
+#define GL_DYNAMIC_COPY_ARB 0x88EA
+#define GL_READ_ONLY_ARB 0x88B8
+#define GL_WRITE_ONLY_ARB 0x88B9
+#define GL_READ_WRITE_ARB 0x88BA
+#define GL_BUFFER_SIZE_ARB 0x8764
+#define GL_BUFFER_USAGE_ARB 0x8765
+#define GL_BUFFER_ACCESS_ARB 0x88BB
+#define GL_BUFFER_MAPPED_ARB 0x88BC
+#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
+#endif
+extern void (GLAPIENTRY *qglBindBufferARB) (GLenum target, GLuint buffer);
+extern void (GLAPIENTRY *qglDeleteBuffersARB) (GLsizei n, const GLuint *buffers);
+extern void (GLAPIENTRY *qglGenBuffersARB) (GLsizei n, GLuint *buffers);
+extern GLboolean (GLAPIENTRY *qglIsBufferARB) (GLuint buffer);
+extern GLvoid* (GLAPIENTRY *qglMapBufferARB) (GLenum target, GLenum access);
+extern GLboolean (GLAPIENTRY *qglUnmapBufferARB) (GLenum target);
+extern void (GLAPIENTRY *qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
+extern void (GLAPIENTRY *qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
+
extern void (GLAPIENTRY *qglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
extern void (GLAPIENTRY *qglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
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;
//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;
{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)
{
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");
// 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;