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.

DarkBASIC Professional Discussion / Resizing Camera Image

Author
Message
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Dec 2013 19:14 Edited at: 18th Dec 2013 19:14
I'm creating a viewport which can be scaled by the user and I can't figure out how to resize the camera image.

The quickest way I thought would be to just delete the camera image and reset with a new size. But I noticed that if you delete the camera image, the camera doesn't account for this and is stuck with the last image and dimensions even if the image doesn't exist. Is there any way to reset this?

I imagine doing this with a new camera would be simple, since when you reset it you just delete it and create a new one reset the cameras image and whatever get stuck making it draw to a image. But I'm wondering if you can reset the camera without deleting it. This way I could use camera 0.

"Get in the Van!" - Van B
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 18th Dec 2013 19:17
Just call set camera to image again with the same image ID and the new size. It will delete the image if it exists and recreate it with the provided dimensions and format.


"Why do programmers get Halloween and Christmas mixed up?"
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 18th Dec 2013 19:17
There is Camera View command!

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Dec 2013 19:30 Edited at: 18th Dec 2013 19:34
Quote: "Just call set camera to image again with the same image ID and the new size. It will delete the image if it exists and recreate it with the provided dimensions and format."


set camera to image doesn't reset it. The camera image is stuck with whatever dimensions it was set with!

Quote: "There is Camera View command!"

I need the camera in a image

"Get in the Van!" - Van B
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 18th Dec 2013 20:00 Edited at: 18th Dec 2013 20:04
Recreate both camera and Image seem to be the best..

Or use a screen quad, and Camera View

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Dec 2013 20:14 Edited at: 18th Dec 2013 20:43
Quote: "Recreate both camera and Image seem to be the best.."

So far that's the best method for this:



Edit: Well it's working for sure... (DBP seems to only display 360p but it's higher on YouTube)


"Get in the Van!" - Van B
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 18th Dec 2013 20:33 Edited at: 18th Dec 2013 20:40
Dont forget the sync mask for the object..
I dont see the point of rendering this viewport
to an image, except if a shader is used of course..

Havenot done the test but the screen quad should be better than the paste image function..

Edit: have just seen the video = cool!!!
Edit2: Make An image with the biggest sizable dims
And retry if camera view works inside (Not sure if this works, but i cannot test now..)

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Dec 2013 20:40 Edited at: 18th Dec 2013 20:42
Quote: "Edit: have just seen the video = cool!!!"


Cheers, the actual gui won't be in windows, it'll be in frames like the image below. But I'm having some issues with how to rescale a frame and have it's neighbouring frames compress or expand to fit the container. I talk about the problem here: Scale to Fit



I guess you understand why I needed it as an image now, reason being is the viewport needs to sit on top of 2d but also 2d needs to overlap it, hence why I'm using an image.

EDIT: It actually make sense to have a new camera per viewport really

"Get in the Van!" - Van B
Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 18th Dec 2013 20:59
Great work...
I ll try the "camera view in image" as soon as I can..

Le Verdier
14
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 19th Dec 2013 10:47 Edited at: 19th Dec 2013 10:49
I tried the "Camera View In Image" and It works OK:



One thing left, the whole image is drawn.
This can be solved with using advanced2d:




!!!

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 19th Dec 2013 11:24 Edited at: 19th Dec 2013 11:25
Wow that's awesome! I never knew Set Camera View would alter where it appears on the image Thanks so much Le Verdier, this also has the benefit that the image doesn't get wiped waiting for the new camera to initialize rendering in the method I used. Definitely be using this instead, cheers for sticking with it

This an one other thing were the only things back halting development of the editor now I can finally start adding everything to it.

"Get in the Van!" - Van B

Login to post a reply

Server time is: 2026-07-06 07:51:46
Your offset time is: 2026-07-06 07:51:46