[PD] GEM mapping units to pixels

altern altern2 at gmail.com
Sat May 12 12:38:59 CEST 2007


hi

do you mean something like the example attached?
This doesnt work ok for me, the shape should be 10x10 px and is not, 
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

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?

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 at iem.at mailing list
>> UNSUBSCRIBE and account-management -> 
>> http://lists.puredata.info/listinfo/pd-list
>>
>>
> 


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test2.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070512/7121c45e/attachment.asc>


More information about the Pd-list mailing list