Pswin
09-25-2009, 04:08 AM
hi
i'm working with OpenGL 3.2 and i cant doing depth test
i have enable depth testing:
glEnable(GL_DEPTH_TEST);
and my routine in creating context:
#if DENGINE_PLATFORM == DENGINE_PLATFORM_WIN32
m_hdc = (HDC)(win_handle);
HGLRC m_hrc;
m_hrc = wglCreateContext(m_hdc);
wglMakeCurrent(m_hdc, m_hrc);
//return m_hrc;
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddre ss("wglCreateContextAttribsARB");
if(!wglCreateContextAttribsARB)
{
return m_hrc ;
}
else
{
GLint major,minor;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
int attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, major,
WGL_CONTEXT_MINOR_VERSION_ARB, minor,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
HGLRC gl3Ctx = wglCreateContextAttribsARB(m_hdc, 0, attribs);
if(gl3Ctx)
{
wglDeleteContext(m_hrc);
m_hrc =gl3Ctx;
wglMakeCurrent(m_hdc,m_hrc);
DLogger.Log("OpenGL 3.x context created",io::ELML_SYS_MESSAGE);
}
else
{
DLogger.Log("can not initialize OpenGL 3.x context",io::ELML_WARNING) ;
}
}
return m_hrc;
#elif DENGINE_PLATFORM == DENGINE_PLATFORM_LINUX
#endif
return NULL;
i'm working with OpenGL 3.2 and i cant doing depth test
i have enable depth testing:
glEnable(GL_DEPTH_TEST);
and my routine in creating context:
#if DENGINE_PLATFORM == DENGINE_PLATFORM_WIN32
m_hdc = (HDC)(win_handle);
HGLRC m_hrc;
m_hrc = wglCreateContext(m_hdc);
wglMakeCurrent(m_hdc, m_hrc);
//return m_hrc;
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddre ss("wglCreateContextAttribsARB");
if(!wglCreateContextAttribsARB)
{
return m_hrc ;
}
else
{
GLint major,minor;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
int attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, major,
WGL_CONTEXT_MINOR_VERSION_ARB, minor,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
0
};
HGLRC gl3Ctx = wglCreateContextAttribsARB(m_hdc, 0, attribs);
if(gl3Ctx)
{
wglDeleteContext(m_hrc);
m_hrc =gl3Ctx;
wglMakeCurrent(m_hdc,m_hrc);
DLogger.Log("OpenGL 3.x context created",io::ELML_SYS_MESSAGE);
}
else
{
DLogger.Log("can not initialize OpenGL 3.x context",io::ELML_WARNING) ;
}
}
return m_hrc;
#elif DENGINE_PLATFORM == DENGINE_PLATFORM_LINUX
#endif
return NULL;