Jump to content

Me and the render loop


Rastar
 Share

Recommended Posts

wub.png Noob alert... I still haven't grasped how to work with the render loop. As an example, I have integrated shadmar's skybox from http://www.leadwerks.com/werkspace/topic/7452-skybox-in-30-a-simple-example-with-shader/ into my C++ code. I put all that code in App::Start(), and everything works. Fine.

 

Now, I would like to move the skybox with the camera. But when I move the lines

 

   sky->SetPosition(camera->GetPosition());
   sky->Move(0,0,camera->GetRange().y-50);
   sky->SetScale(camera->GetRange().y*10);

 

into the App::Update() method, the skybox isn't displayed, no matter if it's before or after world->Update() and world->Render(). Why is that? Is it because the buffer is cleared before the render loop? Why doesn't that affect stuff done in Start()? Do I have to use the DrawHook() to get the skybox into the render loop? If so, how can I affect the drawing order (or shouldn't I)? Sigh..

Link to comment
Share on other sites

In shadmar's code the skybox is created with coordinates (-0.5, 0.5, 0) etc., the camera has range 1000 so the box should be half of the camera range.

 

wub.png I forgot about the parenting, so i don't actually have to do that. And my code means the skybox is scaled again every frame - no wonder i can't see it...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...