How to turn off IR emitter
Hi

I wrote 3D stereo application, and everything works nice
wglCreateContext() blinks the entire screen
wglMakeCurrent() turns on IR emitter
Except one issue.
I need to turn off stereo (and IR emitter) in some cases, but I don't know, how to do it.

wglMakeCurrent(NULL, NULL) and wglDeleteContext() do nothing.
Only when the program terminates, the screen blinks again and IR emitter turns off

Here is the code:

//START STEREO

PIXELFORMATDESCRIPTOR pfd;
memset( &pfd, 0, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_STEREO;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
int iPixelFormat = ChoosePixelFormat( dcMap.m_hDC, &pfd );
SetPixelFormat( dcMap.m_hDC, iPixelFormat, &pfd );
DescribePixelFormat( dcMap.m_hDC, iPixelFormat, sizeof( pfd ), &pfd ); //ask, if stereo supported
if ( pfd.dwFlags & PFD_STEREO )
m_hGLRC = wglCreateContext( dcMap.m_hDC ); //AT THIS POINT THE ENTIRE SCREEN FLICKS
if ( m_hGLRC )
wglMakeCurrent( dcMap.m_hDC, m_hGLRC ); //AT THIS POINT THE IR EMITTER GOES TO LIGHT GREEN


//PREPARE AND SWAP BUFFERS

for ( int ii = 0; ii < 2; ii++ )
{
glDrawBuffer( ii == 0 ? GL_BACK_LEFT : GL_BACK_RIGHT );
glRasterPos2f( -1, -1 );
glDrawPixels( rect.Width(), rect.Height(), GL_BGRA_EXT, GL_UNSIGNED_BYTE, aip.GetBits() );
}
SwapBuffers( dcMap.m_hDC );


//STOP STEREO

wglMakeCurrent( NULL, NULL );
wglDeleteContext( m_hGLRC );
m_hGLRC = NULL;
Hi



I wrote 3D stereo application, and everything works nice

wglCreateContext() blinks the entire screen

wglMakeCurrent() turns on IR emitter

Except one issue.

I need to turn off stereo (and IR emitter) in some cases, but I don't know, how to do it.



wglMakeCurrent(NULL, NULL) and wglDeleteContext() do nothing.

Only when the program terminates, the screen blinks again and IR emitter turns off



Here is the code:



//START STEREO



PIXELFORMATDESCRIPTOR pfd;

memset( &pfd, 0, sizeof( pfd ) );

pfd.nSize = sizeof( pfd );

pfd.nVersion = 1;

pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_STEREO;

pfd.iPixelType = PFD_TYPE_RGBA;

pfd.cColorBits = 32;

int iPixelFormat = ChoosePixelFormat( dcMap.m_hDC, &pfd );

SetPixelFormat( dcMap.m_hDC, iPixelFormat, &pfd );

DescribePixelFormat( dcMap.m_hDC, iPixelFormat, sizeof( pfd ), &pfd ); //ask, if stereo supported

if ( pfd.dwFlags & PFD_STEREO )

m_hGLRC = wglCreateContext( dcMap.m_hDC ); //AT THIS POINT THE ENTIRE SCREEN FLICKS

if ( m_hGLRC )

wglMakeCurrent( dcMap.m_hDC, m_hGLRC ); //AT THIS POINT THE IR EMITTER GOES TO LIGHT GREEN





//PREPARE AND SWAP BUFFERS



for ( int ii = 0; ii < 2; ii++ )

{

glDrawBuffer( ii == 0 ? GL_BACK_LEFT : GL_BACK_RIGHT );

glRasterPos2f( -1, -1 );

glDrawPixels( rect.Width(), rect.Height(), GL_BGRA_EXT, GL_UNSIGNED_BYTE, aip.GetBits() );

}

SwapBuffers( dcMap.m_hDC );





//STOP STEREO



wglMakeCurrent( NULL, NULL );

wglDeleteContext( m_hGLRC );

m_hGLRC = NULL;

#1
Posted 08/31/2011 06:07 PM   
Nobody knows?
Nobody knows?

#2
Posted 09/04/2011 09:00 PM   
What's wrong here?
Why 0 views?
What's wrong here?

Why 0 views?

#3
Posted 09/26/2011 11:29 PM   
Scroll To Top