View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0028628||Runner||Functions||Public||2018-01-05 12:02||2018-01-08 13:45|
|Reporter||Stewart Bishop||Assigned To||Mike Dailly|
|Priority||Low||Severity||C - General||Reproducibility||100%|
|Fixed in Version|
|Summary||0028628: Functions: matrix_view is corrupted after calling surface_reset_target|
|Description||In GMS2 the surface_set_target function sets matrix_view to surface's local coordinates so if I call draw_point(0, 0) it will be drawn in the top-left corner of the surface and it doesn't matter what the current view coordinates are but it's possible to save the matrix_view in the beginning of Draw Event, and set it after the surface_set_target then call draw_point(0,0) and it will set a point it the top-left corner of the current view on the selected surface which seems to be fine.|
However surface_reset_target corrupts the view matrix and all the other draw_* calls in Draw Events of any object are incorrect, all the elements are drawn in wrong places. I guess, surface_reset_target function should just reset the view matrix to the state before surface_set_target was called.
|Steps To Reproduce||1) Run the attached sample|
2) Press + or - to rotate
3) See that your sprites rotate in different directions even though you're only rotating the camera
4) Within the Draw event uncomment the line specified
5) Run it again and rotate
6) See that this has fixed it
|1.4 Found In|
|2.x Runtime Found In||184.108.40.206|
|2.x Runtime Verified In||220.127.116.11|
view-surface-bug.yyz (24,201 bytes)
This is by design. Setting a surface sets the model, view and project matrix, and when popping will restore the current camera one.
We do not store what was "there" as this could easily lead to errors if the camera has changed in anyway. The camera must be restored. This is also true for pushing multiple surfaces, we need to restore the last one to keep consistency.
If you use a custom matrix you will need to reset this yourself after popping off a surface from the stack.