You are wondering why a 1:1 perspective works for a 4:3 window? 

On 5/13/07, cyrille henry <cyrille.henry@la-kitchen.fr > wrote:
could you also try the test3 patch i just send?

thanks
Cyrille


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