[NOOB] jit.gl.sketch coordinates range

larme's icon

Attached patch is modified based on jitter tutorial 40. I never use OpenGL before so am confused by the coordinate system. The jsui document[1] says that:

However, our default mapping is that Y coordinates are in the range -1. to 1 from bottom to top, and X coordinates are in the range -aspect to aspect from left to right, where aspect is equal to the ratio of width/height

So in the attached patch, the y range should be [-1. 1.] and the x range should be [-1.3333... 1.3333...]. However when I try to draw a circle with radius equal to 1, it exceeds y's range. Only when I draw a circle with radius equal to 0.825, the circle is completely inside the window. Any idea? I'm using Max 5.1.9.

Max Patch
Copy patch and select New From Clipboard in Max.
Rob Ramirez's icon

hi larme.
in order to make these position numbers work like you expect, you should set @ortho 2 on your gl.render (orthgraphic projection - no lens angle).

otherwise you have to take camera postion, orientation, and lens angle into effect.