> Date:         Thu, 20 Mar 2003 09:36:52 +0700
> From: =?ISO-8859-1?Q?=E1=CD=B9=B4=C3=D9=C7=EC_=E0=B4=C7=D4=CA=D1=B9_=28Andr?= 
> =?ISO-8859-1?Q?ew_Davison=29?= <[EMAIL PROTECTED]>
>
> The StereoGraphics Web site (http://www.stereographics.com/) is
> a great resource for information about stereo 3D.
>
> On their online support materials page
> (http://www.stereographics.com/support/body_support.html)
> there are several diagnostic tools for testing the stereo
> capabilities of your graphics card with OpenGL on Win 9x. The
> "diagnose" tool works with all versions of Windows, not just
> NT. The tools come with source code, which shows how the
> stereo API of OpenGL can be used.
>
> The advantage of using these tools is that they allow you to
> check your display card independent of Java 3D.

Thanks for the pointer.  I downloaded the diagnose tool and verified that
they're doing essentially the same OpenGL tests for stereo availability that
Java 3D does in the native OpenGL layer.  We don't call

  glGetBooleanv(GL_STEREO, &ucTest);

but we do call

  DescribePixelFormat(hdc, iPixelFormat, sizeof (PIXELFORMATDESCRIPTOR), &pfd);

and check if (pfd.dwFlags & PFD_STEREO) evaluates to non-zero.

So this tool should be pretty reliable for independently testing Java 3D stereo
compatibility.  For the curious, I've attached the relevent part from
redblue.cpp in diagnose.zip.

-- Mark Hood

============================================================================
============================================================================

BOOL CMainWindow::EnableStereoWindow (void)
// This routine attempts to set the attributes of "this" window such that it
//      will support stereo buffering. If activating the window's stereo
//      buffering proves successful, this routine returns TRUE; otherwise it
//      returns FALSE.
// Note that the Windows OpenGL implementation provides a method for querying
//      stereo support availability without actually attempting to switch to
//      a stereo-available window pixel mode; unfortunately the results of
//      such a query are unreliable with some graphics cards.
{
    hdc = ::GetDC (this->m_hWnd);

    PIXELFORMATDESCRIPTOR pfd;
        memset (&pfd, 0, sizeof (PIXELFORMATDESCRIPTOR)); // zero out all fields
        pfd.nSize = sizeof (PIXELFORMATDESCRIPTOR);
        pfd.nVersion = 1;
        pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL |
                PFD_DOUBLEBUFFER | PFD_STEREO;

    int iPixelFormat = ChoosePixelFormat(hdc, &pfd);
    BOOL bSuccess = SetPixelFormat(hdc, iPixelFormat, &pfd);
    hGLRC = wglCreateContext (hdc);
    bSuccess = wglMakeCurrent (hdc, hGLRC);

        // glGetBooleanv(GL_STEREO, ...) is supposed to be the way to query for
        //    stereo support availability, but unfortunately, the results of
        //    this query are not reliable with some graphics boards...
    unsigned char ucTest;
    glGetBooleanv (GL_STEREO, &ucTest);
#ifdef LOTS_OF_MESSAGE_BOXES
        if (ucTest)
        AfxMessageBox (_T
           ("GL_STEREO flag set to TRUE, indicating that stereo should be supported")
           );
        else
        AfxMessageBox (_T
           ("GL_STEREO flag set to FALSE, indicating that stereo should not be 
supported")
           );
#endif

        // ...thus, we recommend the following approach for checking whether
        //    the attempted switch to stereo actually worked
    iPixelFormat = GetPixelFormat (hdc);
    DescribePixelFormat (hdc, iPixelFormat, sizeof (PIXELFORMATDESCRIPTOR),
                &pfd);
    if ((pfd.dwFlags & PFD_STEREO) == 0)  { // stereo mode was not accepted
        return FALSE;
        }
    else  {                                 // yes, we're now in stereo mode
                SetTimer (1, 5000, NULL);  // launch a 5-second timer;
                                           //    see OnTimer() comments below
        return TRUE;
        }
}

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to