# OpenGL Vectors of pointers rather than objects

This topic is 2566 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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):
 +render |-+voxel_block |-+geometry_octree_controller |-+geometry_octree_node |-+voxel_octree_controller |-+voxel_octree_node 
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.

1. 1
Rutin
23
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 16
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002151
×