Jump to content
  • Advertisement
Sign in to follow this  
SuperVGA

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.

If you intended to correct an error in the post then please contact us.

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.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!