there are no threads, just the main ocx thread.
The wglMakeCurrent returns true.
the hardware is an ATI card Rage Fury with 5.13.1.3279 driver version.(I will check it on another computer to make sure it’s not a driver problem)
though, I am using double buffering, that is two dc…
the complete code is:
OnCreate of the ocx:
//get the hdc of this control
HWND hWnd = GetSafeHwnd();
HDC hDC = ::GetDC(hWnd);
//create the pixel format
if(!createPixelFormat(hDC))
return -1;
//create the opengl view render context
m_hGLContext = wglCreateContext(hDC);
if(m_hGLContext==NULL)
return -1;
wglMakeCurrent(hDC,m_hGLContext);::ReleaseDC(hWnd, hDC);
//init the opengl scene.
CRect rect;
GetClientRect(&rect);
m_renderingCanvas->initScene(rect);
OnPaint:
CPaintDC dc(this); // device context for painting
HWND hWnd = GetSafeHwnd();
HDC hDC = ::GetDC(hWnd);
if(m_iNumberOf3DObjects > 0)
BOOL p = glIsList(m_pArrDisplayListsNumbers[0]);
BOOL l = wglMakeCurrent(hDC,m_hGLContext);
if(numberOf3DObjects > 0)
BOOL ret = ::glIsList(pArrDisplayListsNumbers[0]);
glClear (GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glLoadIdentity (); /* clear the matrix */
// viewing transformation
gluLookAt (m_eyeX, m_eyeY, m_eyeZ, m_centerX, m_centerY, m_centerZ, m_upX, m_upY, m_upZ);
setLightPosition();
::glPushMatrix();
if(m_bMulSceneByMatrix)
::glMultMatrixf(m_MultMatrix);
//translate the object on the y axis.
::glTranslatef(0.0f, m_fYTranslationDelta, 0.0f);
//translate the object on the x axis.
::glTranslatef(m_fXTranslationDelta, 0.0f, 0.0f);
//do a uniform scale on the object
::glScalef(m_fScaleFactor, m_fScaleFactor, m_fScaleFactor);
//rotate the object
::glRotatef(m_fYAxisRotationAngle, 0.0f, 1.0f, 0.0f);
::glRotatef(m_fXAxisRotationAngle, 1.0f, 0.0f, 0.0f);
//call all the 3d controller display lists
for(int i =0 ; i < numberOf3DObjects ; i++)
{
if(::glIsList(pArrDisplayListsNumbers[i]) == GL_TRUE)
{
::glCallList(pArrDisplayListsNumbers[i]);
}
}
::glPopMatrix();//swap the buffers and flush.
SwapBuffers(dc.m_ps.hdc);
glFlush();
::ReleaseDC(hWnd,hDC);