Login  Register

Re: New tutorial on AWT/SWT/Swing/GLJPanel/GLCanvas

Posted by Sven Gothel on Feb 11, 2011; 10:02am
URL: https://forum.jogamp.org/New-tutorial-on-AWT-SWT-Swing-GLJPanel-GLCanvas-tp2363921p2472425.html

On Thursday, February 10, 2011 16:24:21 Wade Walker [via jogamp] wrote:
>
> gouessej wrote:
> >
> > What do you mean by "older 32-bit Windows systems"?
> >
>
> It seems to be systems that don't have WGL_ARB_create_context, and that are
> Open GL 2.x. I'm still debugging to try to find the exact cause of the
> problems.

http://jogamp.org/git/?p=jogl.git;a=commit;h=bf75331124d6d0c53b74d5235ec03f5fcbc55cba

Win,GDI,SWT: Fix pfd to caps conversion. Added thorough debug code.

Debug code added for use case: WinXP-32bit, GDI, SWT,
where WGL.wglGetCurrentDC() returns a non null value which is invalid.
Using the value (hdc) on eg GDI.GetObjectType(hdc) return 0 instead of
3 (OBJ_DC) and GDI.GetPixelFormat(hdc) returns 0 with last error 2000.

+++

http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java;h=845460c58fa29cbee6ae9a47b143619363ab9dd5;hb=bf75331124d6d0c53b74d5235ec03f5fcbc55cba#l89

This is the odd call on WinXP 32bit with SWT,
the follow up test on OBJ_DC (3) will fail (it's 0).

  89     long hdc = WGL.wglGetCurrentDC();
  90     if (0 == hdc) {
  91       throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError());
  92     }
  93     int hdcType = GDI.GetObjectType(hdc);
  94     if( GDI.OBJ_DC != hdcType ) {
  95         // FIXME: Turns out in above use case (WinXP-32bit, GDI, SWT) the returned DC (not 0) is invalid!
  96         throw new GLException("Error: current WGL DC ("+toHexString(hdc)+") is not a DC but: "+hdcType+", werr " + GDI.GetLastError());
  97     }
  98

the hdc is not null .. but invalid, ie the

  99     int pfdID = GDI.GetPixelFormat(hdc);

returns 0.

~Sven