Jump to content

Recommended Posts

Posted

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..

Posted

you probably forgot

 

sky->SetParent(camera);

 

wich makes the skybox always follow camera pos and orientation.

everything is suppose to go in app:start() since you parent the plane to the camera

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Posted

I set in the parent in the App:Start() method. But since I want to move I have have to adjust the skybox position every frame, so I movev those three calls to Update().

Posted

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...

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.

×
×
  • Create New...