16:9 pseudolook in outview of an opengl render?

Mar 30, 2006 at 4:30pm

16:9 pseudolook in outview of an opengl render?

hi,

i want to put a black rectancle on the top and bottom of a 4:3 opengl rendering outputwindow to have a (fake)look closer to 16:9 and a wider looking viewpoint… i don’t want to lose the performanceadvantage of opengl rendering so i’m looking for a method at which i haven’t switch to matrixoutput…

attention i have an moving camera…

greets
peter

#25152
Mar 30, 2006 at 5:08pm

Hi,

I’m doing a similar thing for the ‘rotor’ performance. To get such a letterbox 16:9 view you can render 2 balck rectangles on top of your output. To do this you need to set all your geometry creating gl objects to ‘automatic 0′, and bang the jit.gl.sketch or whatever object you want to use for the black bars after the other openGL objects. I’ve added a small patch demonstrating the principle.

max v2;
#N vpatcher 447 180 1377 854;
#P window setfont “Sans Serif” 9.;
#P flonum 290 95 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 253 95 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 217 95 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 117 120 85 196617 camera 0. 0. 2.;
#P newex 204 118 97 196617 pak camera 0. 0. 0.;
#P message 356 111 355 196617 color 0. 0. 0. , moveto 0 0.65 0. , plane 2 0.2 , moveto 0 -0.65 0. , plane 2 0.2;
#P toggle 14 54 15 0;
#P message 530 127 83 196617 reset , torus 0.5;
#P comment 530 170 100 196617 the ‘content’;
#P newex 530 149 173 196617 jit.gl.sketch letterbox @automatic 0;
#P newex 14 170 103 196617 jit.window letterbox;
#P newex 356 149 173 196617 jit.gl.sketch letterbox @automatic 0;
#P newex 14 95 85 196617 t b b b b b erase;
#P newex 14 73 57 196617 qmetro 20;
#P newex 14 150 110 196617 jit.gl.render letterbox;
#P comment 356 170 100 196617 the bars;
#P comment 115 102 100 196617 this stays;
#P comment 218 78 100 196617 change these;
#P connect 11 0 4 0;
#P connect 4 0 5 0;
#P fasten 14 0 3 0 122 145 19 145;
#P fasten 13 0 3 0 209 147 19 147;
#P fasten 5 5 3 0 94 131 19 131;
#P connect 5 0 3 0;
#P fasten 5 2 14 0 49 116 122 116;
#P fasten 5 4 13 0 79 116 209 116;
#P fasten 15 0 13 1 222 114 238 114;
#P fasten 16 0 13 2 258 114 267 114;
#P fasten 17 0 13 3 295 114 296 114;
#P fasten 5 1 6 0 34 143 361 143;
#P connect 12 0 6 0;
#P fasten 5 3 8 0 64 145 535 145;
#P connect 10 0 8 0;
#P pop;

#73725
Mar 30, 2006 at 6:17pm

Here is a version that works with jit.gl.handle.

I was going to put it up as a tutorial, but its pretty well commented
and its pretty easy to plug stuff into :)

max v2;
#N vpatcher 306 142 1241 836;
#P origin 0 -63;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 673 37 126 196617 http://abstrakt.vade.info;
#P window setfont “Sans Serif” 20.;
#P comment 720 2 79 196628 RWM//;
#P comment 1 22 85 196628 OpenGL;
#B color 1;
#P window setfont “Sans Serif” 9.;
#P comment 1 3 46 196617 vade //;
#B color 1;
#P user panel 1 1 800 50;
#X brgb 200 0 0;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 107 473 150 196617 our render context and window;
#P window linecount 5;
#P comment 442 492 355 196617 notice our jit.gl.handle isnt
explicitely connected to any gl object. instead we set up value and
rotation , and store those in variables we bang when we need them.
attach the leftmost outlet of jit.gl.handle to prepend set , and
then to a message box. jit.gl.handle simply sends position//rotation
messages. jit.gl.handle does *not* support @automatic 0. – this does
it for us.;
#P window linecount 4;
#P comment 35 381 377 196617 now we reset our camera to default ,
draw our 2 planes to make our ‘letterboxing’. next we draw the whole
scene. Notice however , that our 2 planes *do not* have depth enable
on. This is so that any object ‘closer’ to the camera than the planes
will be drawn *over*. Try turning on depth enable to see what I mean…;
#P window linecount 1;
#P comment 181 347 377 196617 next we draw our shapes. notice we have
automatic 0 on , and depth_enable here..;
#P newex 452 438 83 196617 prepend position;
#P newex 386 180 34 196617 v pos;
#P newex 347 180 33 196617 v rot;
#P newex 538 438 33 196617 v rot;
#P newex 452 463 34 196617 v pos;
#P newex 452 413 72 196617 route position;
#P user jit.fpsgui 23 474 60 196617 0;
#P message 452 369 34 196617 reset;
#P window linecount 2;
#P newex 197 297 349 196617 jit.gl.plato letter_box_finished
@automatic 0 @position 0. 1. 0. @color 1. 0. 0. 0.5 @poly_mode 1 1
@lighting_enable 1 @depth_enable 1 @antialias 1;
#P window linecount 1;
#N vpatcher 255 332 789 588;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 105 131 376 196617 and send to the jit.gl.render instance
, now draw our two planes for letterboxing..;
#P window linecount 0;
#P newex 51 70 40 196617 t b b b;
#P window linecount 2;
#P newex 66 153 342 196617 jit.gl.gridshape letter_box_finished
@automatic 0 @shape plane @position 0. -1.4 0. @color 0. 0. 0. 1.
@scale 1.333 1. 1. @depth_enable 0;
#P newex 51 185 342 196617 jit.gl.gridshape letter_box_finished
@automatic 0 @shape plane @position 0. 1.4 0. @color 0. 0. 0. 1.
@scale 1.333 1. 1. @depth_enable 0;
#P window linecount 1;
#P message 81 99 234 196617 lookat 0. 0. 0. , position 0. 0. 0. ,
rotate 0. 0. 0. 1.;
#P outlet 81 131 15 0;
#P inlet 51 49 15 0;
#P window linecount 0;
#P comment 137 82 143 196617 reset our camera to default…;
#P connect 1 0 6 0;
#P connect 6 0 4 0;
#P connect 6 1 5 0;
#P connect 6 2 3 0;
#P connect 3 0 2 0;
#P pop;
#P newobj 35 344 133 196617 p reset_cam_letter_boxing;
#P newex 452 389 330 196617 jit.gl.handle letter_box_finished
@inherit_transform 0 @auto_rotate 1;
#P newex 296 241 77 196617 prepend shape;
#P user ubumenu 281 221 77 196617 0 1 1 0;
#X add tetrahedron;
#X add hexahedron;
#X add octahedron;
#X add dodecahedron;
#X add icosahedron;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P window linecount 2;
#P newex 272 262 291 196617 jit.gl.plato letter_box_finished
@automatic 0 @lighting_enable 1 @depth_enable 1 @antialias 1
@smooth_shading 1;
#P window linecount 1;
#P newex 47 159 313 196617 t b b b b b;
#P toggle 23 62 15 0;
#P newex 23 81 51 196617 qmetro 2;
#P newex 23 104 58 196617 t b b erase;
#P newex 107 490 225 196617 jit.window letter_box_finished
@depthbuffer 1;
#P window linecount 2;
#P newex 23 439 222 196617 jit.gl.render letter_box_finished
@erase_color 0. 0. 0.3 1. @depth_enable 1 @antialias 1;
#P window linecount 3;
#P comment 84 106 280 196617 strictly control our render chain. erase
first , send our bang for our render objects to draw (were using
automatic 0..) , and then bang jit.gl.render to actually *draw*
everything.;
#P comment 425 167 348 196617 v pos and v rot store our rotation and
position from jit.gl.handle. We bang them to set our camera positions
from handle *at the very beginning of the render chain* so as to put
things where the rotation this frame should be.;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P fasten 12 0 2 0 40 371 28 371;
#P fasten 20 0 2 0 391 210 28 210;
#P fasten 19 0 2 0 352 210 28 210;
#P connect 4 0 2 0;
#P fasten 4 2 2 0 76 154 28 154;
#P connect 2 0 15 0;
#P fasten 7 1 12 0 127 316 40 316;
#P connect 4 1 7 0;
#P connect 7 2 13 0;
#P fasten 10 0 8 0 301 260 277 260;
#P connect 7 3 8 0;
#P fasten 9 1 10 0 319 239 301 239;
#P fasten 7 4 19 0 352 178 352 178;
#P fasten 7 4 20 0 352 178 391 178;
#P connect 14 0 11 0;
#P connect 11 0 16 0;
#P connect 16 0 21 0;
#P connect 21 0 17 0;
#P fasten 16 1 18 0 519 434 543 434;
#P pop;

v a d e //

http://www.vade.info
abstrakt.vade.info

I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I LIVE! I
LIVE! I LIVE! I LIVE! I LIVE!

You will not be saved by the Holy Ghost. You will not be saved by the
God Plutonium.

In fact, YOU WILL NOT BE SAVED!

#73726

You must be logged in to reply to this topic.