PDA

View Full Version : wglMakeCurrent yields GetLastError 3221684230



JoshB
02-15-2011, 11:35 AM
Hello everyone,

I have scoured the web for an answer to this but have come up empty handed...

Direct Problem:
I am experiencing a situation where I am calling wglMakeCurrent() with an HDC and HGLRC that have been previously verified as being constructed without error and am receiving false as the wglMakeCurrent() return value. Upon immediately calling GetLastError() in response to receiving false from wglMakeCurrent() I am receiving the error code of 3221684230. Searching on the web for this error code has led me to forum posts that state this error code will sometimes come from SetPixelFormat() however I am verifying that I am successfully making earlier calls to SetPixelFormat() that return without error. Thus, I am coming up empty handed as to what this error code means exactly and why this error is occurring in the context of calling wglMakeCurrent()

Problem Background:
This is occurring in a video playback class that makes use of large textures and the pixel buffer extension. This video playback class is used in many places, one of which is in plugins to existing applications where the instantiation and destruction of the objects of this class are at the mercy of the host application. It is not an extreme case to have certain host applications instantiate and destroy large numbers of instances of this video playback class during a single app session. On my dev machine, the issue described above only arises after instantiating and destroying roughly 50 instances of the class. It should be noted that in test sessions objects instantiated with identical parameters will be completely successful up until a certain point where they will then no longer be able to get passed calls to wglMakeCurrent( ). Incidentally, the wglMakeCurrent() call that fails is the first call to wglMakeCurrent() that a failing object will make. To me this obviously points to memory problems somewhere, but I have been pretty vigilant with regard to memory management and I believe that any such memory leakage is not coming from my layer. Yeah, right?

I will search again for memory leaks coming from the player class itself, but in the meantime - has anyone experienced an error code of 3221684230 in the context of either wglMakeCurrent() or in a situation similar to what I described where memory issues are suspected? If so, any ideas?

Thanks in advance,
Josh


=====================
Edit
=====================

I have revisited the code and still come up with the notion that there are no memory leaks stemming from my layer, and so am now guessing that the behavior might be coming from the OpenGL implementation, itself. All my dev machines have nvidia GPUs installed, and the bad behavior described above occurs on all these machines. On a hunch I tested on a machine that has an ATI GPU installed and, sure enough, the bad behavior did *not* exist when running on the machine with the ATI GPU. I am not the most well versed on the underpinnings of OpenGL, but per what I have described in this overall post, should I be considering that perhaps this behavior is related to a GPU (driver) bug?

Leith Bade
02-18-2011, 03:54 AM
Maybe you are somehow running out of VRAM? The driver might not be deleting all the buffers properly (or fast enough)...

kyle_
02-19-2011, 06:19 AM
I to have ran into similar cases, where failures in wgl would generate garbage GetLastError (that was with wglSareLists though) - looks like error handling in wgl isnt very reliable. Incidently behavior i observed was also on NV.