You are wondering why a 1:1 perspective works for a 4:3 window?&nbsp; <br><br><div><span class="gmail_quote">On 5/13/07, <b class="gmail_sendername">cyrille henry</b> &lt;<a href="mailto:cyrille.henry@la-kitchen.fr">cyrille.henry@la-kitchen.fr
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">could you also try the test3 patch i just send?<br><br>thanks<br>Cyrille
<br><br><br>chris clepper a écrit :<br>&gt; Your example patch works exactly as it should on OSX.<br>&gt;<br>&gt; On 5/13/07, altern &lt;<a href="mailto:altern2@gmail.com">altern2@gmail.com</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; cyrille henry(e)k dio:
<br>&gt;&gt; &gt; hello,<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; altern a écrit :<br>&gt;&gt; &gt;&gt; hi<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; do you mean something like the example attached?<br>&gt;&gt; &gt; yes, exactly.
<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;&gt; This doesnt work ok for me, the shape should be 10x10 px and is not,<br>&gt;&gt; &gt; a [rectangle 10 10] should be 20 pixel.<br>&gt;&gt;<br>&gt;&gt; i understand from the rectangle help that [rectangle 10 10] should be a
<br>&gt;&gt; 10 units width by 10 units height square. I get a rectangle which is<br>&gt;&gt; irregular, check the attached screnshot gif<br>&gt;&gt;<br>&gt;&gt; &gt;&gt; also x and y pos are dont match with window size. Translating to 400,
<br>&gt;&gt; &gt;&gt; 300 should place the rect in top right corner but I get that with only<br>&gt;&gt; &gt;&gt; 320, 190,&nbsp;&nbsp;so the units are not mapped to pixels<br>&gt;&gt; &gt; translating to 400 300 should move the center of the rectangle in the
<br>&gt;&gt; &gt; top right corner.<br>&gt;&gt; &gt; if your rectangle is 100 100, then you just have to move it 300 200 in<br>&gt;&gt; &gt; order to have the corner of the rectangle in the corner of the gem<br>&gt;&gt; window.
<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; your patch work that way here.<br>&gt;&gt;<br>&gt;&gt; check the attachment again, the rect is 10x10 and it is located at<br>&gt;&gt; X=307, Y=167. This should be far from 400, 300 which should be the
<br>&gt;&gt; top,right location. So the coordinate system is distorted, specially on<br>&gt;&gt; the y axis<br>&gt;&gt;<br>&gt;&gt; I also tried with<br>&gt;&gt; dimen 400 400<br>&gt;&gt; perspec 0 400 0 400 999 1001<br>&gt;&gt; If draw a 1 by 1 rect and i get it to the right top corner by
<br>&gt;&gt; translating it 320, 320. So pixels are dont match gl units and moreover<br>&gt;&gt; in the previous example when the gem window is not a square the<br>&gt;&gt; distortion affects differently the X and the Y axis
<br>&gt;&gt;<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; but maybe i am missing something from what you describe?<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; In opengl to achieve this 2D like-pixels to units effect i would<br>
&gt;&gt; &gt;&gt; set the perspective to be orthographical with glOrtho command, is<br>&gt;&gt; &gt;&gt; something like this possible in Gem?<br>&gt;&gt; &gt; yes, insert an [ortho] after the gemhead<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; cyrille<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; thanks!!<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; enrike<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; cyrille henry(e)k dio:<br>&gt;&gt; &gt;&gt;&gt; hello,
<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt; i tried with :<br>&gt;&gt; &gt;&gt;&gt; dimen 400 300<br>&gt;&gt; &gt;&gt;&gt; view 0 0 1000 // 1000 is in order to put the camera far from the view<br>&gt;&gt; &gt;&gt;&gt; point, to reduce space distortion
<br>&gt;&gt; &gt;&gt;&gt; perspec 0 400 0 300 999 1001 // 999 and 1001 limit the render to<br>&gt;&gt; &gt;&gt;&gt; primitive position is between -1 and 1 (because camera is at 1000)<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;
<br>&gt;&gt; &gt;&gt;&gt; and everything is working as expected.<br>&gt;&gt; &gt;&gt;&gt; i just have 1 strange thing : i need to set the [dimen&lt;, [create&lt;&nbsp;&nbsp;,<br>&gt;&gt; &gt;&gt;&gt; then [reset&lt; and last [view&lt; and [perspec&lt; if i did not do a reset, a
<br>&gt;&gt; &gt;&gt;&gt; square is not rendered as a square but a rectangle.<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt; anyway, it&#39;s working.<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt; cyrille<br>&gt;&gt; &gt;&gt;&gt;
<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt; altern a écrit :<br>&gt;&gt; &gt;&gt;&gt;&gt; i tried to pass different view values to gemwin. I can see that in<br>&gt;&gt; &gt;&gt;&gt;&gt; order to be able to specify location or with with pixels i should
<br>&gt;&gt; &gt;&gt;&gt;&gt; set view to<br>&gt;&gt; &gt;&gt;&gt;&gt; view 0 0 2<br>&gt;&gt; &gt;&gt;&gt;&gt; but as soon as i set that the shape is not there any more. This is<br>&gt;&gt; &gt;&gt;&gt;&gt; an example i am using to test. If i ser view to
<br>&gt;&gt; &gt;&gt;&gt;&gt; view 0 0 2.01<br>&gt;&gt; &gt;&gt;&gt;&gt; it is almost there but if i set it to 0 0 2 it is not there any<br>&gt;&gt; &gt;&gt;&gt;&gt; more. I guess it might be because it is either beyond the back limit
<br>&gt;&gt; &gt;&gt;&gt;&gt; y or behind the camera?<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt; thanks<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt; enrike<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;
<br>&gt;&gt; &gt;&gt;&gt;&gt; altern(e)k dio:<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; hi<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; I am trying to map GEM units to pixels so that i can position some<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; videos in the GEM window using pixels values. For this I understand
<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; that<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; i must match the projection values with the window size. So i am<br>&gt;&gt; doing<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; dimen 400 300
<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; perspect 0 400 0 300 1 20<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; and i render all objects at z position 1<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; translateXYZ 100 100 1
<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; However I am getting a weird result, the units are far smaller that<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; pixels, so to move a video 100px in the x i need to change it x
<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; position<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; by 300 units or something like this. So I am not sure about what i<br>&gt;&gt; am<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; doing wrong, I am familiar with OpenGL but i never played too much
<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; with<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; GEM before so I am still getting into it.<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; Another small issue is that I would also like to reverse the Y so
<br>&gt;&gt; that<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; upper left is 0,0 and bottom left would be 0,200 for example, not<br>&gt;&gt; sure<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; about how to change this. I guess it is to do with the gemwin
<br>&gt;&gt; settings<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; but i dont get it right.<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; thanks<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt; enrike
<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt; &gt;&gt;&gt;&gt; 
<a href="mailto:PD-list@iem.at">PD-list@iem.at</a> mailing list<br>&gt;&gt; &gt;&gt;&gt;&gt; UNSUBSCRIBE and account-management -&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt; <a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list
</a><br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; ------------------------------------------------------------------------
<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;&gt; #N canvas 393 156 429 320 10;<br>&gt;&gt; &gt;&gt; #X obj 84 210 gemwin;<br>&gt;&gt; &gt;&gt; #X obj 245 163 gemhead;<br>&gt;&gt; &gt;&gt; #X msg 173 82 create \, 1;<br>&gt;&gt; &gt;&gt; #X msg 293 106 0 \, destroy;
<br>&gt;&gt; &gt;&gt; #X floatatom 309 164 5 0 0 0 - - -;<br>&gt;&gt; &gt;&gt; #X floatatom 347 164 5 0 0 0 - - -;<br>&gt;&gt; &gt;&gt; #X floatatom 288 215 5 0 0 0 - - -;<br>&gt;&gt; &gt;&gt; #X floatatom 332 215 5 0 0 0 - - -;
<br>&gt;&gt; &gt;&gt; #X obj 245 190 translateXYZ 10 10 1;<br>&gt;&gt; &gt;&gt; #X msg 215 50 dimen 400 300;<br>&gt;&gt; &gt;&gt; #X msg 48 73 view 0 0 1000;<br>&gt;&gt; &gt;&gt; #X msg 9 48 perspec 0 400 0 300 999 1001;<br>
&gt;&gt; &gt;&gt; #X msg 110 99 reset;<br>&gt;&gt; &gt;&gt; #X obj 50 -8 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 -1<br>&gt;&gt; &gt;&gt; -1;<br>&gt;&gt; &gt;&gt; #X obj 50 13 t b b b b b;<br>&gt;&gt; &gt;&gt; #X obj 245 234 rectangle 10 10;
<br>&gt;&gt; &gt;&gt; #X connect 1 0 8 0;<br>&gt;&gt; &gt;&gt; #X connect 2 0 0 0;<br>&gt;&gt; &gt;&gt; #X connect 3 0 0 0;<br>&gt;&gt; &gt;&gt; #X connect 4 0 8 1;<br>&gt;&gt; &gt;&gt; #X connect 5 0 8 2;<br>&gt;&gt; &gt;&gt; #X connect 6 0 15 1;
<br>&gt;&gt; &gt;&gt; #X connect 7 0 15 2;<br>&gt;&gt; &gt;&gt; #X connect 8 0 15 0;<br>&gt;&gt; &gt;&gt; #X connect 9 0 0 0;<br>&gt;&gt; &gt;&gt; #X connect 10 0 0 0;<br>&gt;&gt; &gt;&gt; #X connect 11 0 0 0;<br>&gt;&gt; &gt;&gt; #X connect 12 0 0 0;
<br>&gt;&gt; &gt;&gt; #X connect 13 0 14 0;<br>&gt;&gt; &gt;&gt; #X connect 14 0 11 0;<br>&gt;&gt; &gt;&gt; #X connect 14 1 10 0;<br>&gt;&gt; &gt;&gt; #X connect 14 2 12 0;<br>&gt;&gt; &gt;&gt; #X connect 14 3 2 0;<br>&gt;&gt; &gt;&gt; #X connect 14 4 9 0;
<br>&gt;&gt; &gt;&gt;<br>&gt;&gt; &gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; <a href="mailto:PD-list@iem.at">PD-list@iem.at</a> mailing list<br>&gt;&gt; UNSUBSCRIBE and account-management -&gt;
<br>&gt;&gt; <a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br></blockquote></div><br>