3333import com .sun .jna .Pointer ;
3434import com .sun .jna .ptr .PointerByReference ;
3535import java .nio .FloatBuffer ;
36+ import java .nio .IntBuffer ;
3637import java .util .logging .Logger ;
3738
3839/**
@@ -78,6 +79,7 @@ public class OSVR implements VRAPI {
7879 */
7980 public static byte [] OpenGLString = { 'O' , 'p' , 'e' , 'n' , 'G' , 'L' , (byte )0 };
8081
82+ private final IntBuffer lastError = IntBuffer .allocate (2 );
8183 private final Matrix4f [] eyeMatrix = new Matrix4f [2 ];
8284
8385 private PointerByReference grabRM ;
@@ -180,7 +182,7 @@ public boolean initialize() {
180182 */
181183 public void grabGLFWContext () {
182184 // get current context
183- wglGLFW = org .lwjgl .opengl .WGL .wglGetCurrentContext ();
185+ wglGLFW = org .lwjgl .opengl .WGL .wglGetCurrentContext (lastError );
184186 glfwContext = org .lwjgl .glfw .GLFW .glfwGetCurrentContext ();
185187 }
186188
@@ -189,7 +191,7 @@ public void grabGLFWContext() {
189191 * @return <code>true</code> if the context is successfully shared and <code>false</code> otherwise.
190192 */
191193 public boolean shareContext () {
192- if ( org .lwjgl .opengl .WGL .wglShareLists (wglRM , wglGLFW )) {
194+ if ( org .lwjgl .opengl .WGL .wglShareLists (lastError , wglRM , wglGLFW )) {
193195 System .out .println ("Context sharing success!" );
194196 return true ;
195197 } else {
@@ -216,7 +218,7 @@ public boolean initVRCompositor(boolean allowed) {
216218 openResults .setAutoSynch (false );
217219 retval = OsvrRenderManagerOpenGLLibrary .osvrRenderManagerOpenDisplayOpenGL (renderManager , openResults );
218220 if ( retval == 0 ) {
219- wglRM = org .lwjgl .opengl .WGL .wglGetCurrentContext ();
221+ wglRM = org .lwjgl .opengl .WGL .wglGetCurrentContext (lastError );
220222 renderManagerContext = org .lwjgl .glfw .GLFW .glfwGetCurrentContext ();
221223 shareContext ();
222224 OsvrClientKitLibrary .osvrClientUpdate (context );
@@ -298,7 +300,6 @@ public void reset() {
298300 // may need to take current position and negate it from future values
299301 }
300302
301- @ Override
302303 public void getRenderSize (Vector2f store ) {
303304 if ( eyeLeftInfo == null || eyeLeftInfo .viewport .width == 0.0 ) {
304305 store .x = 1280f ; store .y = 720f ;
@@ -345,7 +346,6 @@ public Vector3f getPosition() {
345346 return storePos ;
346347 }
347348
348- @ Override
349349 public void getPositionAndOrientation (Vector3f storePos , Quaternion storeRot ) {
350350 storePos .x = (float )-hmdPose .translation .data [0 ];
351351 storePos .y = (float )hmdPose .translation .data [1 ];
0 commit comments