Prgram crashes with nvoglnt.dll

Hey guys,

I’m trying out ogl with vc++ 6.0 and i’m reating a MFC application with multiple viewports. Everything seemed to work properly until i worked on with picking. Thr program crashes with saying abt invalid reference in memory. I debugged my code and I couldnt really find out where it crashes because it crashes at different places at different times and it refered to nvoglnt.dll. It sometimes crashes when redrawing the model. I keep the models in a linked list and everytime i draw the scene, i just draw the models one by one in the list. And it crashes at glVetex3f() or sometimes at glLoadMatrix().

Can anyone tell me what I can do fix this problem?

The thing i noticed is that, without the selection routines the code works well. But I dont see any fault in the routines.

Below I’m pasting the main portions of selection that I’m doing…I’ve taken it from http://www.lighthouse3d.com/opengl/picking/

BOOL COpenGLView::StartPicking(CPoint CurrentPoint)
{
GLint Viewport[4] ;

::glSelectBuffer(m_PickBufferSize , m_pPickBuffer) ;
::glGetIntegerv(GL_VIEWPORT , Viewport) ;

::glRenderMode(GL_SELECT) ;
::glMatrixMode(GL_PROJECTION) ;
::glPushMatrix() ;
::glLoadIdentity() ;

::gluPickMatrix(CurrentPoint.x , Viewport[3] - CurrentPoint.y , 5 , 5 , Viewport) ;
::gluPerspective(45.0f , ((Viewport[2] + 0.0) / Viewport[3]) , 0.1f , 1000.0f) ;
::glMatrixMode(GL_MODELVIEW) ;
::glInitNames() ;

return TRUE ;

}

BOOL COpenGLView::StopPicking()
{
::glMatrixMode(GL_PROJECTION) ;
::glPopMatrix() ;
::glMatrixMode(GL_MODELVIEW) ;
::glFlush() ;

m_nHits =::glRenderMode(GL_RENDER) ;
if(-1 != m_nHits)
	Proces****s(m_nHits , m_pPickBuffer) ;

// if(0 == m_nHits || -1 == m_nHits)
// GetDocument()->m_pCurrentObjModel = NULL ;

m_iMode = RENDER_MODE ; 
m_nHits = -1 ;
m_pPickBuffer = NULL ;

return TRUE ;

}

void CPerspective::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here

MakeCurrentRC() ;
::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;

::glLoadIdentity() ;

::glTranslatef(0.0f , 0.0f , 1.0f) ;
::glRotatef(-10 , 1.0f , 0.0f , 0.0f) ;

//The whole scene is gonna get effected in the steps below.
::glPushMatrix() ;

::glTranslatef(m_xPos , -m_yPos , -m_Zoom) ;

::glPushMatrix() ;
::glDisable(GL_LIGHTING) ;
::glMultMatrixf(Transform.M) ;
DrawGrid(m_lGridListIndex) ;
::glEnable(GL_LIGHTING) ;
::glPopMatrix() ;

::glPushMatrix() ;
::glMultMatrixf(Transform.M) ;
::glTranslatef(0.0f , 1.0f , 0.0f) ;

if(m_iMode == SELECT_MODE)
{
	CPoint aPoint = GetCurrentCursorPos() ;
	StartPicking(aPoint) ;
}

RenderScene() ;

::glPopMatrix() ;



::glPopMatrix() ;

// ::glFinish() ;
if(m_iMode == SELECT_MODE)
StopPicking() ;
else
SwapBuffers() ;
}

And the mode for selection is set when is depress the Left mouse button down and the rendering mode is set when the mouse button is released.

Hope you guys can help me out.

does lighthouse demo work for you?