Results 1 to 4 of 4

Thread: wglDeleteContext causing problems

  1. #1
    Senior Member Regular Contributor
    Join Date
    Oct 2000
    Location
    USA
    Posts
    302

    wglDeleteContext causing problems

    I've traced the source of an error message to my call to wglDeleteContext(). Anyone know what sort of thing would cause this call to fail to disastrously?

    I'm running Win2k (havn't had a chance to try it on anything else yet), and the exact error message (when compiled in debug mode) is:
    Unhandled exception in <app name> (NTDLL.DLL): 0xC0000005: Access Violation.

    The order of my calls is:

    wglMakeCurrent(NULL,NULL)
    wglDeleteContext(hRC)
    ReleaseDC(hWnd,hDC)

    Any ideas?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: wglDeleteContext causing problems

    If it returned false, you can call GetLastError right afterwards to see what the error was.

    If the context has been made current in a different thread, this function will fail.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Oct 2000
    Location
    USA
    Posts
    302

    Re: wglDeleteContext causing problems

    Actually, it's not returning false because it's not returning anything. It causes the program to crash *when it is called*. It does not have a chance to return anything.

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    15
    I am recording an answer to this here for posterity. I had the same issue (crash when calling wglDeleteContext, but only when using a texture) eventually found that the error was holding on to GL objects (textures, buffers etc) at the point wglDeleteContext() was called. When I updated my code to free the textures, delete buffers & VAOs prior to calling wglDeleteContext (), I got a clean run.

    So I believe this is a case of OpenGL implementations, or the microsoft library that wraps them, complaining about deleting a context with active objects in it. Cleaning everytjing up solves the problem.

Similar Threads

  1. Replies: 4
    Last Post: 02-12-2015, 01:38 AM
  2. OpenGL causing problems
    By cow_trix in forum OpenGL: User Software
    Replies: 3
    Last Post: 05-11-2011, 06:22 AM
  3. glVertexAttribPointer causing problems
    By tamato in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 05-06-2011, 04:52 PM
  4. Replies: 2
    Last Post: 08-13-2010, 04:09 AM
  5. glutIdleFunc causing problems on XP
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-11-2002, 03:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean