Browse Source

Merge pull request #33 from dougbinks/timing

Support for cases where the gl header does not include GL_ARB_TIMER_QUERY
shared-context
Mikko Mononen 11 years ago
parent
commit
31f8f6075c
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      example/example_gl3.c

+ 15
- 0
example/example_gl3.c View File

@@ -31,6 +31,14 @@
#include "nanovg_gl3buf.h" #include "nanovg_gl3buf.h"
#include "demo.h" #include "demo.h"



// timer query support
#ifndef GL_ARB_timer_query
#define GL_TIME_ELAPSED 0x88BF
typedef void (APIENTRY *pfnGLGETQUERYOBJECTUI64V)(GLuint id, GLenum pname, GLuint64* params);
pfnGLGETQUERYOBJECTUI64V glGetQueryObjectui64v = 0;
#endif

void errorcb(int error, const char* desc) void errorcb(int error, const char* desc)
{ {
printf("GLFW error %d: %s\n", error, desc); printf("GLFW error %d: %s\n", error, desc);
@@ -117,6 +125,13 @@ int main()


timerquery = glfwExtensionSupported("GL_ARB_timer_query"); timerquery = glfwExtensionSupported("GL_ARB_timer_query");
if( timerquery ) { if( timerquery ) {
#ifndef GL_ARB_timer_query
glGetQueryObjectui64v = (pfnGLGETQUERYOBJECTUI64V)glfwGetProcAddress("glGetQueryObjectui64v");
if( !glGetQueryObjectui64v )
{
timerquery = GL_FALSE;
}
#endif
glGenQueries(NUM_QUERIES, timerqueryid); glGenQueries(NUM_QUERIES, timerqueryid);
} }




Loading…
Cancel
Save