Camera2d does not render

So I've been having issues getting the camera2d struct to work right. Anything I render within the *2dMode() calls just... doesn't. I've included the code I used to try to figure it out below.

I don't understand what I'm doing wrong here, the code seems similar to the camera_2d example, but apparently not. How do I fix this code?


  • Hi FateAce! It seems camera.rotation and camera.zoom are not properly initialized, camera.zoom should be 1.0.
  • I can't believe I didn't realize this sooner. Thank you for your help, it's working properly now!

    As long as I'm here though, I noticed that the camera offset causes the camera to move up and left with positive numbers, when most engines would make it move down and right. Is there any specific reason for this?
  • yes, because OpenGL is a 3d library where y-axis us positive up and, despite simulating 2d, camera works same as 3d.
  • That makes sense. Thank you for your help.
  • Raysan, thanks for the solution, I had read a similar question and had no idea what the problem was. regards
Sign In or Register to comment.