View Full Version : glList inside a procedure of an object..
03-26-2002, 08:19 AM
Imagine I´ve designed a Sphere class which sometimes I want to draw on my screen. for that purpose I´ve made a draw() procedure. I want to know If I can make a compiled list inside an object and draw It directly. I say so because sometimes when I call procedures from the window class located within the other objects they seem not to work properly with the OpenGL context (specially working with OGL matrices).
Thaks a lot
03-26-2002, 06:32 PM
Sure, just make sure you instantiate the object after you initialize opengl and make the rendering context current
03-27-2002, 09:54 AM
Thanks, I´m not sure but I think you gave me the answer.
I´m initializing my GL context inside the object which makes calls to other objects. It becomes initialized In the constructor. Imagine my visualization class is called viewerOGL (original isn´t it :-)) so:
camera->set(); <-- Problem,matrix not updated
Should initialization be done outside that object?. If so I don´t know how to make a proper class design for my 3D engine :-(.
03-27-2002, 10:31 AM
Back to basics. With OpenGL gl Calls don't work until OpenGL is initialised (i.e. you've gotten a valid rendering context). So when you are initialising your objects make sure you don't make any OpenGL calls until after OpenGL initialisation. This gives you 2 options...
1) You don't create/initialise objects until after OpenGL is initialised.
2) Initialise objects in two parts. The first part contains no OpenGL calls and can be done anytime. The second part contains all the OpenGL calls and does not get called until OpenGL is initialised.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.