Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 1 of 1

Thread: Issue with scene graph

  1. #1
    Newbie Newbie
    Join Date
    Jan 2019

    Question Issue with scene graph

    Hello everyone,

    I've been trying to fix this one issue for a long time now, but I always resorted to workarounds. However I'm at a dead end now. That's why I am asking you for help.
    I am currently trying to "simulate" our solar system in OpenGL + GLEW + SDL + ImGUI + Windows. I've created my very own framework to work with.
    The scene graph contains a root element of the type "Node". Every object of the class "Node" has a pointer to a parent and a vector of the type "Node", which are supposed to be the children. Actually everything is working. I am recursively iterating though the scene graph and my planets do what they are supposed to do. However I need the world transform matrix of each planet for ImGui and my Camera Class. But the matrices are not being returned correctly. I even know where the issue is, so the picture below is going to show my function that recursively iterates through my scene graph

    Click image for larger version. 

Name:	600dd3e2403caf3d0784cb189b43e594.jpg 
Views:	16 
Size:	11.9 KB 
ID:	2942

    In line 97 I am only making a copy when iterating in the for loop. Instead it should be "(Node& itChild : it.getChildrenList())". This makes it impossible to get the correct world transform matrices since I am not actually using the children but a copy. However if I change it to reference, the sun will spin like crazy and all the other planets are not visible. It seems like the transforms are not being applied to the planets correctly anymore. I want to create a little window where you can press on a button labeled with the planet's name and then the camera is supposed to follow the planet around the solarsystem. Kind of like a third person camera.
    If possible I want you to look at my node.hpp and node.cpp file and tell me what I have to change. I'm going to add the files to this post's attachments!
    Any help is highly appreciated!
    Attached Files Attached Files
    Last edited by N30___; 01-09-2019 at 08:59 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts