1. Still having OpenGL problems
- Posted by 1evan at sbcglobal.net May 27, 2003
- 400 views
I have two code snippets here, the first in Euphoria the second in C++. The Euphoria code fails to unregister the window class, the C++ works. Can anybody spot my error in the Euphoria code? --Euphoria procedure-- procedure KillGLWindow() if fullscreen then if c_func(ChangeDisplaySettingsA,{NULL,0}) then end if if c_func(ShowCursor,{TRUE}) then end if end if if hRC then if c_func(wglMakeCurrent,{NULL,NULL}) then end if if c_func(wglDeleteContext,{hRC}) then end if hRC = NULL end if if hRC and not c_func(ReleaseDC,{hWnd,hDC}) then hDC = NULL end if if hWnd and not c_func(DestroyWindow,{hWnd}) then hWnd = NULL end if if not c_func(UnregisterClassA,{ClassName,hInstance}) then hInstance = NULL end if end procedure //C++ function GLvoid KillGLWindow(GLvoid) { if (fullscreen) { ChangeDisplaySettings(NULL,0); ShowCursor(TRUE); } if (hRC) { if (wglMakeCurrent(NULL,NULL)) if (wglDeleteContext(hRC)) hRC = NULL; } if (hDC && !ReleaseDC(hWnd,hDC)) hDC = NULL; if (hWnd && !DestroyWindow(hWnd)) hWnd = NULL; if (!UnregisterClass("OpenGL",hInstance)) hInstance = NULL; }
2. Re: Still having OpenGL problems
- Posted by xerox_irs at lvcm.com May 27, 2003
- 396 views
I made an opengl demo for win32lib, go look at it, it might help. Daniel Kluss ----- Original Message ----- From: <1evan at sbcglobal.net> To: "EUforum" <EUforum at topica.com> Subject: Still having OpenGL problems > > > I have two code snippets here, the first in Euphoria the second in C++. The Euphoria code fails to unregister the window class, the C++ works. Can anybody spot my error in the Euphoria code? > > --Euphoria procedure-- > procedure KillGLWindow() > > if fullscreen then > if c_func(ChangeDisplaySettingsA,{NULL,0}) then end if > if c_func(ShowCursor,{TRUE}) then end if > end if > > if hRC then > if c_func(wglMakeCurrent,{NULL,NULL}) then end if > if c_func(wglDeleteContext,{hRC}) then end if > hRC = NULL > end if > > if hRC and not c_func(ReleaseDC,{hWnd,hDC}) then > hDC = NULL > end if > > if hWnd and not c_func(DestroyWindow,{hWnd}) then > hWnd = NULL > end if > > if not c_func(UnregisterClassA,{ClassName,hInstance}) then > hInstance = NULL > end if > > end procedure > > //C++ function > GLvoid KillGLWindow(GLvoid) > { > if (fullscreen) > { > ChangeDisplaySettings(NULL,0); > ShowCursor(TRUE); > } > > if (hRC) > { > if (wglMakeCurrent(NULL,NULL)) > if (wglDeleteContext(hRC)) > hRC = NULL; > } > > if (hDC && !ReleaseDC(hWnd,hDC)) > hDC = NULL; > > if (hWnd && !DestroyWindow(hWnd)) > hWnd = NULL; > > if (!UnregisterClass("OpenGL",hInstance)) > hInstance = NULL; > } > > > > TOPICA - Start your own email discussion group. FREE! > >
3. Re: Still having OpenGL problems
- Posted by 1evan at sbcglobal.net May 27, 2003
- 406 views
Eureka! I was linking to the wrong function for DestroyWindow. I had GetDC in there. xerox_irs at lvcm.com wrote: > > >I made an opengl demo for win32lib, go look at it, it might help. > >Daniel Kluss >----- Original Message ----- >From: <1evan at sbcglobal.net> >To: "EUforum" <EUforum at topica.com> >Sent: Tuesday, May 27, 2003 6:17 AM >Subject: Still having OpenGL problems > > >>I have two code snippets here, the first in Euphoria the second in C++. >> >> >The Euphoria code fails to unregister the window class, the C++ works. Can >anybody spot my error in the Euphoria code? > > >>--Euphoria procedure-- >>procedure KillGLWindow() >> >> if fullscreen then >> if c_func(ChangeDisplaySettingsA,{NULL,0}) then end if >> if c_func(ShowCursor,{TRUE}) then end if >> end if >> >> if hRC then >> if c_func(wglMakeCurrent,{NULL,NULL}) then end if >> if c_func(wglDeleteContext,{hRC}) then end if >> hRC = NULL >> end if >> >> if hRC and not c_func(ReleaseDC,{hWnd,hDC}) then >> hDC = NULL >> end if >> >> if hWnd and not c_func(DestroyWindow,{hWnd}) then >> hWnd = NULL >> end if >> >> if not c_func(UnregisterClassA,{ClassName,hInstance}) then >> hInstance = NULL >> end if >> >>end procedure >> >>//C++ function >>GLvoid KillGLWindow(GLvoid) >>{ >>if (fullscreen) >>{ >>ChangeDisplaySettings(NULL,0); >>ShowCursor(TRUE); >>} >> >>if (hRC) >>{ >>if (wglMakeCurrent(NULL,NULL)) >>if (wglDeleteContext(hRC)) >>hRC = NULL; >>} >> >>if (hDC && !ReleaseDC(hWnd,hDC)) >> hDC = NULL; >> >>if (hWnd && !DestroyWindow(hWnd)) >> hWnd = NULL; >> >>if (!UnregisterClass("OpenGL",hInstance)) >> hInstance = NULL; >>} >> >> >>TOPICA - Start your own email discussion group. FREE! >> >> > > >TOPICA - Start your own email discussion group. FREE! > > -- |\ _,,,---,,_ /,`.-'`' -. ;-;;,_ |,4- ) )-,_..;\ ( `'-' '---''(_/--' `-'\_)`-'\_)
4. Re: Still having OpenGL problems
- Posted by stabmaster_ at hotmail.com May 27, 2003
- 399 views
Though you don't really need UnregisterClass: "All window classes that an application registers are unregistered when it terminates. "