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
hello,
i think you should also move the camera position.
if you use this :
dimen 400 300 perspect 0 400 0 300 1 20
then you should also use somthing like this : view 200 150 1000
moving the camera far from the point you look at should reduce distortion.
cyrille
altern a écrit :
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
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
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
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@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;
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.
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.
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;
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;
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
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
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
chris clepper a écrit :
You are wondering why a 1:1 perspective works for a 4:3 window?
yes.
cyrille
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
Setting a 1:1 perspective tells GL to make x=y in units even though the ratio is 1.33:1 in the display. By not doing this rectangle 1 1 would be drawn to match the 4:3 ratio of the window (although the default in GEM is x=y so you have to change it to something other than 1:1 to have this happen).
The test2 patch resets some of the ratios to 1:1 so the perspective corrects that back to fit the window, otherwise the square is taller than it is wide.
Hopefully I didn't make this more confusing.
On 5/13/07, cyrille henry cyrille.henry@la-kitchen.fr wrote:
chris clepper a écrit :
You are wondering why a 1:1 perspective works for a 4:3 window?
yes.
cyrille
ok. so the patch test3 is more logic than the test2, and it work everywhere.
thanks Cyrille
chris clepper a écrit :
Setting a 1:1 perspective tells GL to make x=y in units even though the ratio is 1.33:1 in the display. By not doing this rectangle 1 1 would be drawn to match the 4:3 ratio of the window (although the default in GEM is x=y so you have to change it to something other than 1:1 to have this happen).
The test2 patch resets some of the ratios to 1:1 so the perspective corrects that back to fit the window, otherwise the square is taller than it is wide.
Hopefully I didn't make this more confusing.
On 5/13/07, cyrille henry cyrille.henry@la-kitchen.fr wrote:
chris clepper a écrit :
You are wondering why a 1:1 perspective works for a 4:3 window?
yes.
cyrille
hello,
the size rectangle 1 1 is 2 2. in fact, it goes from -1 to 1. you can see that in the simple attached patch.
about the rectangle 10 10 that is not a square : this is exactly what i've got when i don't send the reset after the windows creation. on this point Gem does not react exactly the same way on linux than on windows.
i think it's strange to send this reset message. when i don't send it, it look like Gem apply the windows shape correction to the perspect message. i explain : if the windows size is 4/3,1, then sending a perspec 0 300 0 300 999 1001 will set the perspective with 0 400 0 300 999 1001 i don't know why.
so, let's try the test3 patch that is (surprisly) working here.
cyrille
altern a écrit :
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;
#N canvas 0 0 581 314 10; #X obj 178 163 rectangle 1 1; #X obj 177 234 rectangle 1 1; #X obj 185 204 translateXYZ 2 1 0; #X obj 183 129 gemhead; #X obj 49 170 gemwin; #X msg 51 99 create , 1; #X msg 84 129 0 , destroy; #X connect 0 0 2 0; #X connect 2 0 1 0; #X connect 3 0 0 0; #X connect 5 0 4 0; #X connect 6 0 4 0;
#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 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 msg 9 48 perspec 0 300 0 300 999 1001; #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 13 1; #X connect 7 0 13 2; #X connect 8 0 13 0; #X connect 9 0 0 0; #X connect 10 0 0 0; #X connect 11 0 12 0; #X connect 12 0 14 0; #X connect 12 1 10 0; #X connect 12 3 2 0; #X connect 12 4 9 0; #X connect 14 0 0 0;
the size rectangle 1 1 is 2 2. in fact, it goes from -1 to 1. you can see that in the simple attached patch.
about the rectangle 10 10 that is not a square : this is exactly what i've got when i don't send the reset after the windows creation. on this point Gem does not react exactly the same way on linux than on windows.
ah!... now i see ... so [rectangle 1 1] is equivalent to
glBegin(GL_QUADS)
glVertex3f(-1.0, 1.0, 0.0)
glVertex3f(1.0, 1.0, 0.0)
glVertex3f(1.0, -1.0, 0.0)
glVertex3f(-1.0, -1.0, 0.0)
glEnd()
so the final width and height is actually 2 units ... this is a bit confusing in the documentation help patch, i mean i know some opengl but still when i read width height words i thought about the width and height of a rectangle in normal geometry and not opengl postion of the vertex location from the current position.
but i think all is clear now.
many thanks for the help !!!
enrike
On 5/13/07, altern altern2@gmail.com wrote:
ah!... now i see ... so [rectangle 1 1] is equivalent to
glBegin(GL_QUADS) glVertex3f(-1.0, 1.0, 0.0) glVertex3f(1.0, 1.0, 0.0) glVertex3f(1.0, -1.0, 0.0) glVertex3f(-1.0, -1.0, 0.0) glEnd()
so the final width and height is actually 2 units ... this is a bit confusing in the documentation help patch, i mean i know some opengl but still when i read width height words i thought about the width and height of a rectangle in normal geometry and not opengl postion of the vertex location from the current position.
You are correct that the size of the rectangle is the dimensions from the center of the object. Arguments can be made for treating size this way or making the size the actual final dimensions in GL units, but both are valid as long as the use is consistent.
hi
just tested it under linux and it does work, so this seems to be either a windows issue or my laptop graphics card. any ideas?
enrike
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.
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.
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;
altern a écrit :
hi
just tested it under linux and it does work,
test2 or test3 work?
cyrille
so this seems to be either a windows issue or my laptop graphics card. any ideas?
enrike
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.
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.
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