Thanks for helping.
Here is the window creation code:
BOOL InitEditor (HWND hWindow, HWND theNotRealWindow, DWORD nWidth,
DWORD nHeight, BYTE nBitsPerPixel, DWORD nFrequency)
{
PIXELFORMATDESCRIPTOR pfd;
DEVMODE newDM;
RECT rect;
HWND hWindowPos;
HDC hDC;
DWORD nMode;
DWORD nWindowStyle;
INT nPixelFormat;
ShowWindow( hWindow, SW_HIDE );
nWindowStyle = WS_CHILD;
hWindowPos = HWND_NOTOPMOST;
hDC = GetDC( hWindow );
if ( !hDC )
{
return FALSE;
}
memset( &pfd, 0, sizeof( PIXELFORMATDESCRIPTOR ) );
pfd.nSize = sizeof( PIXELFORMATDESCRIPTOR );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cDepthBits = 32;
pfd.cColorBits = 32;
pfd.iLayerType = PFD_MAIN_PLANE;
pfd.cStencilBits = 8;
nPixelFormat = ChoosePixelFormat( hDC, &pfd );
if ( !nPixelFormat )
{
ReleaseDC( hWindow, hDC );
return FALSE;
}
if ( !SetPixelFormat( hDC, nPixelFormat, &pfd ) )
{
ReleaseDC( hWindow, hDC );
return FALSE;
}
DescribePixelFormat( hDC, nPixelFormat, sizeof( PIXELFORMATDESCRIPTOR ), &pfd );
if(( pfd.dwFlags & PFD_NEED_PALETTE ) != 0)
{
sprintf(strError,"Pallettes unsupported, please choose 16 bit color or higher");
return FALSE;
}
m_hGLRC = wglCreateContext( hDC );
if ( !m_hGLRC )
{
ReleaseDC( hWindow, hDC );
return FALSE;
}
if ( !wglMakeCurrent( hDC, m_hGLRC ) )
{
wglDeleteContext( m_hGLRC );
ReleaseDC( hWindow, hDC );
return FALSE;
}
ReleaseDC( hWindow, hDC );
rect.left = 0;
rect.right = nWidth;
rect.top = 0;
rect.bottom = nHeight;
AdjustWindowRect( &rect, nWindowStyle, FALSE );
SetWindowLong( hWindow, GWL_STYLE, nWindowStyle );
SetWindowPos( hWindow, hWindowPos, 0, 0, rect.right - rect.left,
rect.bottom - rect.top, SWP_FRAMECHANGED | SWP_NOCOPYBITS );
SetWindowPos( hWindow, HWND_TOP, 0, 0, nWidth, nHeight,
SWP_FRAMECHANGED | SWP_NOCOPYBITS );
SendMessage( hWindow, WM_SIZE, SIZE_RESTORED, MAKELPARAM( nWidth, nHeight ) );
ShowWindow( hWindow, SW_NORMAL );
return TRUE;
}
as for the other stuff:
The only real thing that is using the buffers is swapbuffers,
there are some tests set:
glDepthFunc(GL_LEQUAL);
// Alpha test
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, alphatest);