diff --git a/src/bindings.cc b/src/bindings.cc index f4f983f..4de2220 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -17,6 +17,7 @@ void init(Handle target) atexit(webgl::AtExit); NODE_SET_METHOD(target, "CreateContext", webgl::CreateContext); + NODE_SET_METHOD(target, "CreateContextExt", webgl::CreateContextExt); NODE_SET_METHOD(target, "DestroyContext", webgl::DestroyContext); NODE_SET_METHOD(target, "MakeCurrent", webgl::MakeCurrent); diff --git a/src/webgl.cc b/src/webgl.cc index b173978..420ed1b 100644 --- a/src/webgl.cc +++ b/src/webgl.cc @@ -112,6 +112,27 @@ NAN_METHOD(CreateContext) { NanReturnValue(JS_INT((intptr_t)context)); } +NAN_METHOD(CreateContextExt) { + NanScope(); + + GLenum format = args[0]->Int32Value(); + GLint depthBits = args[1]->Int32Value(); + GLint stencilBits = args[2]->Int32Value(); + GLint accumBits = args[3]->Int32Value(); + + OSMesaContext context; + if(args[4]->IsNull()) { + context = OSMesaCreateContextExt(format, depthBits, stencilBits, accumBits, NULL); + } else { + OSMesaContext shareList = getOSMesaContext(args[4]); + context = OSMesaCreateContextExt(format, depthBits, stencilBits, accumBits, shareList); + } + + std::cout << "CreateContextExt: " << context << std::endl; + + NanReturnValue(JS_INT((intptr_t)context)); +} + NAN_METHOD(DestroyContext) { NanScope(); diff --git a/src/webgl.h b/src/webgl.h index 8c09d23..a696aea 100644 --- a/src/webgl.h +++ b/src/webgl.h @@ -17,6 +17,7 @@ namespace webgl { void AtExit(); NAN_METHOD(CreateContext); +NAN_METHOD(CreateContextExt); NAN_METHOD(DestroyContext); NAN_METHOD(MakeCurrent);