Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: wglDeleteContext acting weird

  1. #1
    Intern Contributor
    Join Date
    Mar 2001
    Location
    Romania
    Posts
    50

    wglDeleteContext acting weird

    I've searched the forums on strange behaviour of the DeleteContext, but i couldn't find a good answer or idea on it. So, in the finishing part of the app, when window is destroyed, i call the usual functions to deinit gl (makecurrent(null, null) and wgldeletecontext(hrc) and the others). The strange part is that this method works very well on most of the cases, but in some of them (usually huge maps with many textures) deletecontext simply crush - i test if the makecurrent succeed or hrc is valid, i also call glfinish. Another thing is that everything is ok if i use a console app that creates the gl window, but the crushes appear in a mfc app that cand preview some scenes.

    Sorry if this seems stupid, but i haven't got a clue.

  2. #2
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: wglDeleteContext acting weird

    In which overridden method of CWnd are you calling wglDeleteContext?
    Knackered

  3. #3
    Intern Contributor
    Join Date
    Mar 2001
    Location
    Romania
    Posts
    50

    Re: wglDeleteContext acting weird

    The closing method is called when a "stop" flag is set. This is modified when WM_DESTROY, WM_QUIT are received or ESC is pressed.

  4. #4
    Member Regular Contributor
    Join Date
    Jul 2002
    Location
    Austria
    Posts
    280

    Re: wglDeleteContext acting weird

    Try not to set a stop flag when your app receives a WM_DESTROY, but to immediately destroy the context there. Your window, and therefore also the associated device context, is probably already destroyed when you call wglDeleteContext and that probably causes the crash. Hard to tell really without being able to debug your code though.
    XEngine - The Platform- and API-Independent 3D Engine
    with Programmable Pipeline Support: [URL=http://xengine.sourceforge.net
    My]http://xengine.sourceforge.net

  5. #5
    Intern Contributor
    Join Date
    Mar 2001
    Location
    Romania
    Posts
    50

    Re: wglDeleteContext acting weird

    I take care of WM_DESTROY. It's not from there.

  6. #6
    Junior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    205

    Re: wglDeleteContext acting weird

    You said it happens on big maps with lots of textures? Do you delete all of the textures before deleting the context? I'm not sure that it matters, but I would try it just to be safe...

  7. #7
    Intern Contributor
    Join Date
    Mar 2001
    Location
    Romania
    Posts
    50

    Re: wglDeleteContext acting weird

    In fact was from the texturing: i was deleting the textures, but some of them were "corrupted" - with more tests i solved it. Anyway, thanks for your answers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •