[NOOB] jit.gl.sketch coordinates range

Nov 19, 2011 at 9:55pm

[NOOB] jit.gl.sketch coordinates range

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.

[1]: http://www.cycling74.com/docs/max5/vignettes/js/jsuiintro.html

– Pasted Max Patch, click to expand. –
#60117
Nov 21, 2011 at 12:58am

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.

#216440

You must be logged in to reply to this topic.