Author Topic: Screen size/shape & view area?  (Read 1041 times)

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Screen size/shape & view area?
« on: August 15, 2015, 08:45:17 pm »
Just wanted to know does the size of a screen affect the area the Camera sees?

For example , if i have world which contains multiple objects will a large screen running the same code as a device with a smaller screen simply show me a larger image?
or would a larger screen show everything exactly the same but larger?


I ask because im working on Some UI elements which exist in the world space(instead of being added to the framebuffer) and i wanted to know how difficult it would be to keep them im roughly similar positions accross devices.
« Last Edit: August 16, 2015, 06:54:35 pm by lawless_c »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: Screen size/shape & view area?
« Reply #1 on: August 17, 2015, 08:37:42 am »
For blitting, you are using absolute coordinates and so a change in device resolution causes a change in change in blitting positions relative to the screen. If you don't want that, define yourself a reference coordinate system and scale everything based on that. For example, "blit" as if your screen would be 800*480 and rescale the values accordingly before doing the actual blit operation to match your device's resolution. Keep in mind that different aspect ratios exist as well.

For 3D models, it shows the same as long as the aspect ratio remains the same. If not, it will adjust vertically by default. In other words: The horizontal field of view will always be the same, the vertical will be adjusted to prevent the rendering from distorting.
You can modify this behaviour, but this is how it's by default and that should actually be what one wants in most cases.

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Re: Screen size/shape & view area?
« Reply #2 on: August 17, 2015, 06:19:50 pm »
Is there a way to extract the coordinates of the image plane in world space? , I think if i have this it will all become very easy.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: Screen size/shape & view area?
« Reply #3 on: August 17, 2015, 09:04:53 pm »
What for? I don't really understand the purpose... ???

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Re: Screen size/shape & view area?
« Reply #4 on: August 17, 2015, 09:38:38 pm »
If i can get that along with the field of views i can extrapolate where the edge of the screen is at any distance.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: Screen size/shape & view area?
« Reply #5 on: August 17, 2015, 11:29:14 pm »
The methods in Interact2D should help for that: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html

Offline lawless_c

  • int
  • **
  • Posts: 91
    • View Profile
Re: Screen size/shape & view area?
« Reply #6 on: August 17, 2015, 11:51:21 pm »
Ah that's perfect.