View Full Version : Calling glGenLists() from the heap in C++
Sorry if this is an old question, I couldn't see it any of the other posts.
The problem is this; when I call glGenLists from dynamic memory 0 is returned, from static memory the call succeeds. I'm using C++ and programming a 32-bit win32 API compiler, using new and delete only.
if anyone can shed any light, cheers
09-10-2003, 01:11 PM
Why don't you show us code so we can see exactly what you are doing wrong. From OpenGL's perspective (as with any library) it makes absolutely no difference how the memory is allocated, so long as it IS allocated.
Yeah, sorry. Basically, in the constructor function of an object I make a call to glGenLists(). The object is allocated using 'new' and all the other intializations within the constructor work. From my main method a simmilar call is made, this succeeds.
Hope this helps, again, if anyone can help, cheers.
09-10-2003, 03:12 PM
Make sure your constructor gets called after creating the OpenGL context and making it current.
You shouldn't have static allocated objects that make OpenGL calls in the constructor, because this will happen upon loading, which is too early.
09-11-2003, 05:33 AM
Like zeckensack said, you are probably calling your OpenGL calls too soon. Until you have a valid context created with wglCreateContext and made current with wglMakeCurrent, none of your OpenGL calls will work.
Cheers chaps, you where right. Thanks again.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.