Sign in to follow this  

OpenGL Vectors of pointers rather than objects

Recommended Posts

Hi Everyone,

Sorry about this post, it's going to be very vague and I just hope that a few of you have an at least as vague idea about what's happening here.
Alright, I have several classes in a hierarchy, most contain vectors with objects instantiated from lesser-ordered classes.

As such (for the time being):
voxel_octree_node features a render function, and all of the above (aside from the render class) have a such, as they inherit from the virtual geometry class.

My experience is that, when I construct an object I'd like to resize the vector of the contained objects, i.e; the voxel_block needs multiple geometry_octree_controllers, so i resize a vector< geometry_octree_controllers > to 64. It happens that the order in which the underlying constructors are executed is unpredictable, and this goes for many of the vectors.
I prefer to not using pointers, but having a vector of those, and then run an initialize() function on every "new" object in the vector appears to be completely predictable.

Sorry again about the vagueness, it's so difficult to explain, and besides the fact that the render() invocation results in a white quad filling the viewport, after switching from the pointer solution to the contained object solution, it's not really OpenGL-related neither... -i think... :-/

Have any of you run into this sort of issue? I shouldn't think the order of construction should really matter here neither, my objects should be independent for all i know.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this