_SIO2window->scl filled incorrectly

View previous topic View next topic Go down

_SIO2window->scl filled incorrectly

Post  Faikus on Mon Jun 08, 2009 8:47 am


I think _SIO2window->scl is supposed to contain the width and height of the viewport. However, the way it is filled in sio2WindowUpdateViewport is only correct if the viewport is at 0,0:


   _SIO2window->scl->x = ( float )( _SIO2window->mat_viewport[ 2 ] - _SIO2window->mat_viewport[ 0 ] );
   _SIO2window->scl->y = ( float )( _SIO2window->mat_viewport[ 3 ] - _SIO2window->mat_viewport[ 1 ] );

This code assumes that mat_viewport[2] is the right x coordinate and mat_viewport[3] the upper y coordinate of the viewport, but it really is the width and height, respectively. I am trying to render a second, smaller viewport on top of my main full-screen one, and this bug leads to a messed up aspect.

I replaced the two lines with

   _SIO2window->scl->x = ( float ) _SIO2window->mat_viewport[ 2 ];
   _SIO2window->scl->y = ( float ) _SIO2window->mat_viewport[ 3 ];
although I think simply

   _SIO2window->scl->x = _w;
   _SIO2window->scl->y = _h;
would work as well.
The aspect looks okay now. However, seeing how _SIO2window->scl is used in sio2, it seems it is sometimes used as width and height (e.g. in sio2CameraSetPerspective) and sometimes as the upper right viewport coordinates (e.g. sio2WindowEnter2D, since glOrthof expects the upper right coordinates).

I saw that you have used a viewport in your pretty cool freestyle engine demo, so you must have come across these issues already. Did you solve them in 1.3.6? Do you have an up-to-date list of changes for 1.3.6? This would save time, as tracking down such things can be quite lengthy.


Posts : 23
Join date : 2009-05-26
Location : Berlin

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum