Powerino
09-16-2003, 11:50 PM
i have big problem to find pixelformat where depth buffer works correctly.
my code is:
memset(&m_pfd,0,sizeof(m_pfd));
m_pfd.nSize = sizeof(m_pfd);
m_pfd.nVersion = 1;
m_pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_GENERIC_ACCELERATED;
m_pfd.iPixelType = PFD_TYPE_RGBA;
m_pfd.cColorBits = 32;
m_pfd.cDepthBits = 32;
m_pfd.cStencilBits = 8;
m_pfd.iLayerType = PFD_MAIN_PLANE;
//
// Get the pixelformat of this setup.
//
int pf;
PIXELFORMATDESCRIPTOR pfdCheck;
if (!(pf = ::ChoosePixelFormat(m_hDC,&m_pfd)))
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"ChoosePixelFormat() failed!");
return false;
}
//
// Get a description of the pixelformat chosen
///
if (!(DescribePixelFormat(m_hDC,pf,sizeof(PIXELFORMAT DESCRIPTOR),&pfdCheck)))
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"GLView: ChoosePixelFormat() The OpenGL Pixeldescription couldn't be retrieved!");
return false;
}
//
// Is hardware accelerated ?
//
if (((pfdCheck.dwFlags & PFD_GENERIC_ACCELERATED) == 0) && ((pfdCheck.dwFlags & PFD_GENERIC_FORMAT) > 0))
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"The OpenGL driver that's currently active doesn't support hardware acceleration or there is no decent OpenGL driver installed.");
if (SetPixelFormat(m_hDC,pf,&pfdCheck)!=TRUE)
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"SetPixelFormat() failed!");
return false;
}
if ((m_hRC = wglCreateContext(m_hDC)) == NULL)
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"Cannot create rendering context");
return false;
}
if (!wglMakeCurrent(m_hDC,m_hRC))
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"wglMakeCurrent() failed");;
return false;
}
but in windowed mode with G400 depth buffers doesn't work......anyone knows why!?!!?
my code is:
memset(&m_pfd,0,sizeof(m_pfd));
m_pfd.nSize = sizeof(m_pfd);
m_pfd.nVersion = 1;
m_pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_GENERIC_ACCELERATED;
m_pfd.iPixelType = PFD_TYPE_RGBA;
m_pfd.cColorBits = 32;
m_pfd.cDepthBits = 32;
m_pfd.cStencilBits = 8;
m_pfd.iLayerType = PFD_MAIN_PLANE;
//
// Get the pixelformat of this setup.
//
int pf;
PIXELFORMATDESCRIPTOR pfdCheck;
if (!(pf = ::ChoosePixelFormat(m_hDC,&m_pfd)))
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"ChoosePixelFormat() failed!");
return false;
}
//
// Get a description of the pixelformat chosen
///
if (!(DescribePixelFormat(m_hDC,pf,sizeof(PIXELFORMAT DESCRIPTOR),&pfdCheck)))
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"GLView: ChoosePixelFormat() The OpenGL Pixeldescription couldn't be retrieved!");
return false;
}
//
// Is hardware accelerated ?
//
if (((pfdCheck.dwFlags & PFD_GENERIC_ACCELERATED) == 0) && ((pfdCheck.dwFlags & PFD_GENERIC_FORMAT) > 0))
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"The OpenGL driver that's currently active doesn't support hardware acceleration or there is no decent OpenGL driver installed.");
if (SetPixelFormat(m_hDC,pf,&pfdCheck)!=TRUE)
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"SetPixelFormat() failed!");
return false;
}
if ((m_hRC = wglCreateContext(m_hDC)) == NULL)
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"Cannot create rendering context");
return false;
}
if (!wglMakeCurrent(m_hDC,m_hRC))
{
GiottoPrintf(GIOTTO_MSG_INITIALIZATION,"wglMakeCurrent() failed");;
return false;
}
but in windowed mode with G400 depth buffers doesn't work......anyone knows why!?!!?