Understanding colormode in OpenGL

Dec 2, 2008 at 11:21pm

Understanding colormode in OpenGL

Hi,

I’m trying to warp my head around colormodes and alpha channels in Jitter, esp. in the optimization of opengl patches. I’ve attached a patch from the examples folder that really did wonders on a patch I was working on. Upped my frame rate from about 15fps to 30fps. Copying and pasting is okay and I know it is an acceptable way to learn but I would really like to understand argb, rgba, uyvy, performance, color management and alpha channels and transparency in depth. I’ve been able to find some clues in the Jitter Tutorials and in the opengl examples but wonder if anyone can point me to more complete and indepth information, references and/or tutorials.

Thanks in advance.

Suzie

max v2;
#N vpatcher 457 44 1311 720;
#P origin 0 -17;
#P window setfont “Sans Serif” 9.;
#P window linecount 3;
#P comment 486 424 117 196617 open subpatcher to check out a few other variants of this shader;
#P window linecount 1;
#N vpatcher 20 74 603 294;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 326 119 126 196617 file cc.uyvy2rgba.lite.jxs;
#P window linecount 3;
#P comment 325 77 213 196617 for an even more lightweight conversion , we provide another shader which has no color correction parameters or chromasmoothing;
#P outlet 53 169 15 0;
#P window linecount 1;
#P message 53 119 127 196617 file cc.uyvy2rgba.exp.jxs;
#P flonum 191 96 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 191 119 96 196617 param exponent $1;
#P window linecount 4;
#P comment 52 35 259 196617 exponent is useful for getting gamma corrected like results with simple math in RGB colorspace , but can be more computationally expensive , so we provide another shader , with this extra parameter and calculation;
#P connect 3 0 4 0;
#P fasten 1 0 4 0 196 144 58 144;
#P fasten 6 0 4 0 331 159 58 159;
#P connect 2 0 1 0;
#P pop;
#P newobj 487 464 64 196617 p variations;
#P window linecount 2;
#P comment 515 291 96 196617 enable/disable chroma smoothing;
#P window linecount 1;
#P comment 203 387 206 196617 scale and bias controls in RGB colorspace;
#P window linecount 2;
#P comment 294 290 203 196617 brightness , contrast , saturation controls applied in the shader in the YUV colorspace;
#P button 149 250 15 0;
#P window linecount 1;
#P message 323 117 91 196617 read dvducks.mov;
#P toggle 515 318 15 0;
#P message 515 340 121 196617 param chromasmooth $1;
#P flonum 173 318 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 289 318 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 402 318 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 402 341 102 196617 param saturation $1;
#P message 289 341 94 196617 param contrast $1;
#P message 173 341 103 196617 param brightness $1;
#P flonum 380 411 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 418 438 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 380 438 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 340 438 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 292 464 125 196617 pak param bias 0. 0. 0. 0.;
#P flonum 236 411 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 274 438 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 236 438 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 196 438 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 148 464 130 196617 pak param scale 1. 1. 1. 1.;
#P newex 149 268 145 196617 mxj quickie cc.uyvy2rgba.jxs;
#P user gswitch2 132 170 39 32 0 0;
#P newex 643 227 169 196617 jit.gl.texture foo @colormode uyvy;
#P message 149 290 108 196617 file cc.uyvy2rgba.jxs;
#P newex 132 540 195 196617 jit.gl.videoplane foo @transform_reset 2;
#P message 224 117 28 196617 read;
#P message 289 117 27 196617 stop;
#P message 255 117 31 196617 start;
#P toggle 161 98 15 0;
#P newex 161 117 51 196617 metro 33;
#P newex 161 149 252 196617 jit.qt.movie @adapt 1 @colormode uyvy @autostart 0;
#P comment 177 98 149 196617 • read a movie and start metro.;
#P newex 132 499 253 196617 jit.gl.slab foo @file cc.uyvy2rgba.jxs @dimscale 2. 1.;
#P toggle 329 573 15 0;
#P message 329 591 45 196617 sync $1;
#P toggle 256 573 15 0;
#P newex 217 572 35 196617 sel 27;
#P message 256 591 68 196617 fullscreen $1;
#P newex 174 615 146 196617 jit.window foo @size 720 480;
#P newex 172 572 40 196617 key;
#P user jit.fpsgui 42 252 60 196617 0;
#P number 65 125 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 20 125 15 0;
#P newex 20 151 55 196617 qmetro 33;
#P newex 20 201 55 196617 t b b erase;
#P newex 20 538 82 196617 jit.gl.render foo;
#P window linecount 5;
#P comment 436 107 365 196617 note that jit.gl.slab’s dimscale attribute is set to handle the uyvy macro-pixel to full chroma rgba dimensions. we dont use uyvy color mode for either jit.gl.texture or jit.gl.slab as we send to the graphics card masqueraded as rgba data and perform the color conversion on the card in a custom shader. we also have a variety of useful controls for color processing in the same shader.;
#P window linecount 1;
#P comment 168 252 314 196617 click to edit shader (probably want to make a backup copy first);
#P connect 5 0 4 0;
#P connect 4 0 3 0;
#P fasten 3 2 2 0 69 234 25 234;
#P connect 3 0 2 0;
#P connect 3 1 7 0;
#P connect 6 0 4 1;
#P connect 26 0 15 0;
#P fasten 44 0 15 0 520 366 137 366;
#P fasten 33 0 15 0 297 488 137 488;
#P fasten 40 0 15 0 407 366 137 366;
#P fasten 39 0 15 0 294 366 137 366;
#P fasten 38 0 15 0 178 366 137 366;
#P fasten 28 0 15 0 153 488 137 488;
#P fasten 24 0 15 0 154 318 137 318;
#P fasten 51 0 15 0 492 495 137 495;
#P fasten 25 0 23 0 648 532 137 532;
#P connect 15 0 23 0;
#P connect 47 0 27 0;
#P connect 27 0 24 0;
#P connect 19 0 18 0;
#P fasten 18 0 17 0 166 143 166 143;
#P fasten 22 0 17 0 229 140 166 140;
#P fasten 21 0 17 0 294 140 166 140;
#P fasten 20 0 17 0 260 140 166 140;
#P fasten 46 0 17 0 328 140 166 140;
#P connect 17 0 26 1;
#P connect 43 0 38 0;
#P fasten 13 0 9 0 334 610 179 610;
#P fasten 10 0 9 0 261 610 179 610;
#P connect 32 0 29 0;
#P connect 29 0 28 2;
#P fasten 8 0 11 0 177 591 214 591 214 570 222 570;
#P connect 30 0 28 3;
#P connect 32 0 30 0;
#P connect 31 0 28 4;
#P fasten 11 0 12 0 222 590 253 590 253 570 261 570;
#P connect 12 0 10 0;
#P connect 32 0 31 0;
#P connect 42 0 39 0;
#P connect 14 0 13 0;
#P connect 34 0 33 2;
#P connect 37 0 34 0;
#P connect 35 0 33 3;
#P connect 37 0 35 0;
#P connect 36 0 33 4;
#P connect 41 0 40 0;
#P connect 37 0 36 0;
#P connect 45 0 44 0;
#P fasten 26 1 25 0 166 213 648 213;
#P pop;

#41157

You must be logged in to reply to this topic.