britzl / defold-orthographic

Orthographic camera functionality for the Defold game engine
MIT License
164 stars 18 forks source link

Viewport position controls cause errors and crash build #44

Closed brettmjohnson closed 3 years ago

brettmjohnson commented 3 years ago

In the included example project, I set the Viewport Left to 10, and when I run, I get the error below and the build immediately crashes (the editor is fine).

I'm running Defold 1.2.183 on MacOS 11.4.

ERROR:SCRIPT: /example/assets/objects/crosshair.script:12: argument #3 contains one or more values which are not numbers: vmath.vector3(nan, inf, nan)
stack traceback:
  [C]:-1: in function lerp
  /example/assets/objects/crosshair.script:12: in function </example/assets/objects/crosshair.script:10>

ERROR:GRAPHICS: OpenGLSetViewport(1887): gl error 1281: invalid value

Assertion failed: (0), function OpenGLSetViewport, file ../src/opengl/graphics_opengl.cpp, line 1887.
INFO:CRASH: Successfully wrote Crashdump to file: /Users/brettjohnson/Library/Application Support/Defold/_crash
ERROR:CRASH: CALL STACK:

# 0 pc     0x30bd7d libxpc.dylib _sigtramp+29
britzl commented 3 years ago

Ah, it's because if any of the values are != 0 then it is assumed that all values are specified. If you only changed viewport left. then that is treated as having viewport left = 10 and a viewport right = 0.

Hmm, maybe I should change so that viewport top or right == 0 means window width and height? Yes, that makes more sense I think!