Advertisement

OpenGL MFC problem

Started by March 15, 2000 04:21 AM
0 comments, last by Mr_Black 24 years, 11 months ago
Hi I''ve been trying to solve this problem for the last week and I''m still having problems. The problem is when trying to use an MFC MDI with OpenGL, I''ve been using some of NeHe''s tutorial code, to write to the child window. Everything works except when I try to resize the child window the image that is displayed in the window (a white triangle) vanishes. I''m at my wits end, if any one can help I would be most apreciative. I''ve included the contence of my OnSize function, the variable m_hrc is a HGLRC, and is defined as private in the view class. The display functions, OnPaint and OnSize are both members of the view class. //OnSize Function CClientDC clientDC(this); wglMakeCurrent( clientDC.m_hDC, m_hrc); if(cy == 0) { cy = 1; } glViewport(0, 0, cx, cy); glMatrixMode(GL_PROJECTION); gluPerspective(45.0f, cx / cy, 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); wglMakeCurrent(NULL, NULL); //End of Function Thanks in advance.
Umm, it might be that you have no current OpenGL context at the end of the function, but since you''re programming in MDI that''s most likely not the problem.
Ahhh!! you do not load the identity into the perspective matrix before setting it!!
It will add it to the current matrix.. that might be it
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.

This topic is closed to new replies.

Advertisement