Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Is there something like SetCameraScissor()?

Author
Message
Scraggle
Moderator
15
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 11th Nov 2018 12:32 Edited at: 11th Nov 2018 12:34
Hey,

I'm trying to restrict the 3D rendering to a section of the screen but don't know if it's possible.
It looks like a combination of SetCameraBounds() and SetCameraOffCenter() might be what I need but the help files don't really explain the commands very well.

Is it possible?
Bengismo
1
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 11th Nov 2018 14:53 Edited at: 11th Nov 2018 15:38
SetCameraBounds and SetCameraOffCentre are indeed what you need and you can then render the 3d to any square area of the screen if wanted or render multiple views etc...

I did an example a while ago and posted it on here but not sure if I can find the thread.

EDIT:
https://forum.thegamecreators.com/thread/222064

Can be done using SetScissor() and the above commands
smallg
Valued Member
13
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 11th Nov 2018 17:02
you could also render to an image and then scissor that? just an option if you don't get the above working.
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
Scraggle
Moderator
15
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 12th Nov 2018 12:46
Thanks,
I've had a look at it and it seems like it will do what I want - not sure about the calculations though
I need to scissor the 3D render to the full screen width and the lower 90% of the screen. Something to think about when I've had more coffee ....
Bengismo
1
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 12th Nov 2018 13:44
You might just be over thinking this:

SetScissor(0,0.1*GetDeviceHeight(),GetDeviceWidth(),GetDeviceHeight())

That will render the 3d only to the bottom 90% of the screen but using full screen width. You only need to use SetCameraBounds if you want to centre the 3d view in the lower 90% - Doubt you need this as its barely noticeable when your using 90% of the screen anyway.

The maths for projection matrices are...hmm....fun!
Scraggle
Moderator
15
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 12th Nov 2018 13:58 Edited at: 12th Nov 2018 14:01
Hey,

You're right, I was overthinking it!!!
What I needed to do is render the 2D to the full screen and have the 3D rendered over the top of it.
Simple enough with a reorder of the render commands.
The problem I had was the HUD elements would then appear beneath the 3D and since they occupy only the top 10% of the screen (I'm using percentage mode) then scissoring is all I needed.

Here's my working code should anyone stumble across this while looking for something similar:


Thanks Bengismo

Login to post a reply

Server time is: 2019-04-23 19:59:45
Your offset time is: 2019-04-23 19:59:45