Rendering on a invisible context

pascal's icon

I'm not able to render on jit.window when its @visible attribute is set to 0 . >> " couldn't make OpenGl on window xxx"
Was working in Max 4.x

Bests

Pascal

Guillaume Evrard's icon

yes i can confirm that...

g

2008/4/24, pascal :
>
>
> I'm not able to render on jit.window when its @visible attribute is set to
> 0 . >> " couldn't make OpenGl on window xxx"
> Was working in Max 4.x
>
> Bests
>
> Pascal
>
>
>

Joshua Kit Clayton's icon

On Apr 24, 2008, at 3:34 AM, pascal wrote:
>
> I'm not able to render on jit.window when its @visible attribute is
> set to 0 . >> " couldn't make OpenGl on window xxx"
> Was working in Max 4.x

Thanks for the report. Known issue. We're looking into it.

-Joshua

Wesley Smith's icon

If I may ask, what are you all using this feature for? Perhaps
there's a better way or at least a workaround.
wes

On Thu, Apr 24, 2008 at 10:19 AM, Joshua Kit Clayton wrote:
>
> On Apr 24, 2008, at 3:34 AM, pascal wrote:
>
> >
> > I'm not able to render on jit.window when its @visible attribute is set to
> 0 . >> " couldn't make OpenGl on window xxx"
> > Was working in Max 4.x
> >
>
> Thanks for the report. Known issue. We're looking into it.
>
> -Joshua
>
>
>

EW

pascal's icon

Well ...I had a patch with multiple rendering context ( one of them used as the main rendering context ..so with a jit.window visible ) .I used invisible contexts ( with usetexture , to_texture messages ) to capture the content of those invisble contexts ..Another way to achieve that ?

Cheers

Pascal

Wesley Smith's icon

Yes,
You can render to texture. jit.gl.texture @capture. Most likely this
will be more efficient as you won't have the overhead of multiple
windows/contexts and it will draw directly to the texture instead of
having to copy the framebuffer of the window to the texture. Search
the forums for render to texture. There are tons of threads on this
subject.

best,
wes

On Fri, Apr 25, 2008 at 2:31 AM, pascal wrote:
>
> Well ...I had a patch with multiple rendering context ( one of them used as the main rendering context ..so with a jit.window visible ) .I used invisible contexts ( with usetexture , to_texture messages ) to capture the content of those invisble contexts ..Another way to achieve that ?
>
> Cheers
>
> Pascal
>
>
>

crhenry's icon

Hi,
I've been using oscillators in jit.gl.gridshape to modify the shape,
color and position of a sequence of shaped spheres. The patch below
leaves a 2D trail of the instancing history. I want to be able to
leave a 3D trail of shapes so I can move the camera and be able to
view the 3D trail/cluster while it is forming.

I noticed that the jit.gl.multiple help patch creates a 3D cluster of
elements which can be viewed from many directions.

In the patch below, you can see that inputs to the xyz of the camera
control its position with respect to the sphere that is being made but
the trail seems to be locked to the camera (in 2D) and is not locked
to the world space.

How can I build the instancing history in 3D so I can view it from the
camera that moves around in the world space?

Should I use jit.gl.multiple to build the instancing history? If so,
How can I do it? I couldn't find any examples that show how to
instance single elements with jit.gl.multiple.

Any help will be greatly appreciated ... I've been on this for quite a
while with limited success.
Cheers, Chuck Henry

Max Patch
Copy patch and select New From Clipboard in Max.

pelado's icon

this is a n answer to the instancing gridshapes question above.
please check that you respond to the correct thread or start a new thread if your topic is new.

Chuck, you're doing a number of things inappropriately in your patch. FIrst, I'd change the method you use with the oscillators. If you want to use audio signals check out jit.poke~ and how to write to msp buffers~. For example, you can write your x,y,and z position values to a buffer called 'scale' and then access these values from a matrix with the same name by banging the matrix and using jit.iter. I think Andrew Benson gave a good example of doing this in one of his jitter recipes (which are available on the cycling site).

A number of your messages are incorrectly formatted. erase_color is followed by 4 values; lighting_enable takes one value (0 or 1). if you want to alter the values you could use the $1 argument (and $2 $3 $4 etc) in your messages.

One of the reasons you can't move about in the space is because you are only ever drawing one gridshape and not erasing the buffer before rendering the next frame. To get the trace you are after you will need to draw more than one object each frame, and jit.gl.multiple may help you here - have a look at it's help file and you'll see that you can view the objects from different angles which you are not able to do with your example.

I'd also suggest looking into the doublebuffer setting for your window.

pelado

Rob Ramirez's icon

> The patch below
> leaves a 2D trail of the instancing history. I want to be able to
> leave a 3D trail of shapes so I can move the camera and be able to
> view the 3D trail/cluster while it is forming.

well, not quite. it's not leaving an "instancing history" if i understand your term correctly. it's just leaving trails of what was previously drawn to the buffer, because your erase_color alpha is 0. your correct that this is just in 2d. it's just pixels, not 3d geometry.

you will have to come up with something of your own in order to do what you want. gl.multiple might be a good place to start, but it's not necessary. a gl.gridshape object encapsulated in a poly~ might also be a good place to start.

crhenry's icon

Hi Robert Ramirez and Pelado,

I'm still working on this ... but the first step is to make an
oscillator that has a sine wave that does not go negative on the
Y-Axis of the scope.
The patcher below needs some help to achieve this property. I tried to
do it with abs with no success ... I hope someone can direct me to the
solution.
This output will go into poke scale then into the gridshape sphere. I
need the oscillator positive so the sphere doesn't go to 0 dim and
then turn inside out. There must be a way to reverse the polarity
and/or bias the Y-Axis to keep it above 0 by a certain amount.
Since the oscillator frequency and amplitude will be changing, the
biasing has to be a function of the input.

Any help on this will be greatly appreciated.

Cheers Chuck Henry

{
    "patcher" :     {
        "fileversion" : 1,
        "rect" : [ 31.0, 46.0, 686.0, 313.0 ],
        "bgcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
        "bglocked" : 0,
        "defrect" : [ 31.0, 46.0, 686.0, 313.0 ],
        "openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
        "openinpresentation" : 0,
        "default_fontsize" : 10.0,
        "default_fontface" : 0,
        "default_fontname" : "Arial",
        "gridonopen" : 0,
        "gridsize" : [ 15.0, 15.0 ],
        "gridsnaponopen" : 0,
        "toolbarvisible" : 1,
        "boxanimatetime" : 200,
        "imprint" : 1,
        "metadata" : [ ],
        "boxes" : [             {
                "box" :
{
                    "maxclass" : "scope~",
                    "trigger" : 0,
                    "drawstyle" : 0,
                    "patching_rect" : [ 343.0,
156.0, 130.0, 130.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "gridcolor" : [ 0.33, 0.33,
0.33, 1.0 ],
                    "numoutlets" : 0,
                    "background" : 0,
                    "bordercolor" : [ 0.2, 0.2,
0.2, 1.0 ],
                    "triglevel" : 0.0,
                    "rounded" : 8,
                    "fgcolor" : [ 0.4, 1.0, 0.2,
1.0 ],
                    "range" : [ -1.0, 1.0 ],
                    "bgcolor" : [ 0.53, 0.53,
0.53, 1.0 ],
                    "ignoreclick" : 0,
                    "bufsize" : 128,
                    "id" : "obj-5",
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "calccount" : 256,
                    "delay" : 0.0
                }

            }
,             {
                "box" :
{
                    "maxclass" : "number~",
                    "patching_rect" : [ 209.0,
209.0, 51.0, 17.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numdecimalplaces" : 0,
                    "numoutlets" : 2,
                    "background" : 0,
                    "bordercolor" : [ 0.5, 0.5,
0.5, 1.0 ],
                    "hbgcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "signal",
"float" ],
                    "ft1" : 0.0,
                    "monitormode" : 1,
                    "bgcolor" : [ 0.866667,
0.866667, 0.866667, 1.0 ],
                    "ignoreclick" : 0,
                    "htextcolor" : [ 0.870588,
0.870588, 0.870588, 1.0 ],
                    "minimum" : "",
                    "sig" : 0.0,
                    "id" : "obj-170",
                    "sigoutmode" : 1,
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "maximum" : "",
                    "interval" : 250.0,
                    "fontface" : 0,
                    "fontsize" : 9.0,
                    "mode" : 2
                }

            }
,             {
                "box" :
{
                    "maxclass" : "gain~",
                    "inc" : 1.071519,
                    "patching_rect" : [ 59.0,
187.0, 28.0, 58.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numoutlets" : 2,
                    "background" : 0,
                    "orientation" : 2,
                    "bordercolor" : [ 0.33334,
0.33334, 0.33334, 1.0 ],
                    "size" : 158,
                    "stripecolor" : [ 0.86, 0.9,
0.68, 0.7 ],
                    "interp" : 10.0,
                    "outlettype" : [ "signal",
"int" ],
                    "bgcolor" : [ 0.66667,
0.66667, 0.66667, 1.0 ],
                    "knobcolor" : [ 0.86667,
0.86667, 0.86667, 1.0 ],
                    "ignoreclick" : 0,
                    "id" : "obj-2",
                    "scale" : 7.94321,
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "relative" : 0
                }

            }
,             {
                "box" :
{
                    "maxclass" : "flonum",
                    "triscale" : 0.9,
                    "patching_rect" : [ 281.0,
78.0, 67.0, 20.0 ],
                    "numinlets" : 1,
                    "presentation" : 0,
                    "outputonclick" : 0,
                    "numdecimalplaces" : 0,
                    "numoutlets" : 2,
                    "background" : 0,
                    "bordercolor" : [ 0.5, 0.5,
0.5, 1.0 ],
                    "mouseup" : 0,
                    "hbgcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "float",
"bang" ],
                    "bgcolor" : [ 0.866667,
0.866667, 0.866667, 1.0 ],
                    "ignoreclick" : 0,
                    "htextcolor" : [ 0.870588,
0.870588, 0.870588, 1.0 ],
                    "minimum" : "",
                    "id" : "obj-28",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "maximum" : "",
                    "cantchange" : 0,
                    "fontface" : 0,
                    "triangle" : 1,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "flonum",
                    "triscale" : 0.9,
                    "patching_rect" : [ 163.0,
56.0, 67.0, 20.0 ],
                    "numinlets" : 1,
                    "presentation" : 0,
                    "outputonclick" : 0,
                    "numdecimalplaces" : 0,
                    "numoutlets" : 2,
                    "background" : 0,
                    "bordercolor" : [ 0.5, 0.5,
0.5, 1.0 ],
                    "mouseup" : 0,
                    "hbgcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "float",
"bang" ],
                    "bgcolor" : [ 0.866667,
0.866667, 0.866667, 1.0 ],
                    "ignoreclick" : 0,
                    "htextcolor" : [ 0.870588,
0.870588, 0.870588, 1.0 ],
                    "minimum" : "",
                    "id" : "obj-29",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "maximum" : "",
                    "cantchange" : 0,
                    "fontface" : 0,
                    "triangle" : 1,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "flonum",
                    "triscale" : 0.9,
                    "patching_rect" : [ 58.0,
62.0, 67.0, 20.0 ],
                    "numinlets" : 1,
                    "presentation" : 0,
                    "outputonclick" : 0,
                    "numdecimalplaces" : 0,
                    "numoutlets" : 2,
                    "background" : 0,
                    "bordercolor" : [ 0.5, 0.5,
0.5, 1.0 ],
                    "mouseup" : 0,
                    "hbgcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "float",
"bang" ],
                    "bgcolor" : [ 0.866667,
0.866667, 0.866667, 1.0 ],
                    "ignoreclick" : 0,
                    "htextcolor" : [ 0.870588,
0.870588, 0.870588, 1.0 ],
                    "minimum" : "",
                    "id" : "obj-30",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "maximum" : "",
                    "cantchange" : 0,
                    "fontface" : 0,
                    "triangle" : 1,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "newobj",
                    "text" : "*~",
                    "patching_rect" : [ 163.0,
113.0, 32.5, 20.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numoutlets" : 1,
                    "background" : 0,
                    "color" : [ 0.8, 0.84, 0.71,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "signal" ],
                    "bgcolor" : [ 1.0, 1.0, 1.0,
1.0 ],
                    "ignoreclick" : 0,
                    "id" : "obj-31",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "fontface" : 0,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "newobj",
                    "text" : "cycle~",
                    "patching_rect" : [ 60.0,
103.0, 44.0, 20.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numoutlets" : 1,
                    "background" : 0,
                    "color" : [ 0.8, 0.84, 0.71,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "signal" ],
                    "bgcolor" : [ 1.0, 1.0, 1.0,
1.0 ],
                    "ignoreclick" : 0,
                    "id" : "obj-32",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "fontface" : 0,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "newobj",
                    "text" : "cycle~",
                    "patching_rect" : [ 163.0,
83.0, 44.0, 20.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numoutlets" : 1,
                    "background" : 0,
                    "color" : [ 0.8, 0.84, 0.71,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "signal" ],
                    "bgcolor" : [ 1.0, 1.0, 1.0,
1.0 ],
                    "ignoreclick" : 0,
                    "id" : "obj-33",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "fontface" : 0,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "newobj",
                    "text" : "*~",
                    "patching_rect" : [ 60.0,
130.0, 32.5, 20.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numoutlets" : 1,
                    "background" : 0,
                    "color" : [ 0.8, 0.84, 0.71,
1.0 ],
                    "fontname" : "Arial",
                    "outlettype" : [ "signal" ],
                    "bgcolor" : [ 1.0, 1.0, 1.0,
1.0 ],
                    "ignoreclick" : 0,
                    "id" : "obj-34",
                    "textcolor" : [ 0.0, 0.0, 0.0,
1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0,
                    "fontface" : 0,
                    "fontsize" : 11.595187
                }

            }
,             {
                "box" :
{
                    "maxclass" : "ezdac~",
                    "local" : 108,
                    "patching_rect" : [ 60.0,
252.0, 33.0, 33.0 ],
                    "numinlets" : 2,
                    "presentation" : 0,
                    "numoutlets" : 0,
                    "background" : 0,
                    "offgradcolor1" : [ 0.87,
0.87, 0.87, 1.0 ],
                    "ongradcolor1" : [ 0.75, 0.79,
0.93, 1.0 ],
                    "bgcolor" : [ 0.51, 0.51,
0.51, 1.0 ],
                    "ignoreclick" : 0,
                    "ongradcolor2" : [ 0.66, 0.66,
0.72, 1.0 ],
                    "id" : "obj-35",
                    "offgradcolor2" : [ 0.7, 0.7,
0.73, 1.0 ],
                    "presentation_rect" : [ 0.0,
0.0, 0.0, 0.0 ],
                    "hidden" : 0
                }

            }
],
        "lines" : [             {
                "patchline" :
{
                    "source" : [ "obj-34", 0 ],
                    "destination" : [ "obj-5", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-34", 0 ],
                    "destination" : [ "obj-170", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-30", 0 ],
                    "destination" : [ "obj-32", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-32", 0 ],
                    "destination" : [ "obj-34", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-34", 0 ],
                    "destination" : [ "obj-2", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-2", 0 ],
                    "destination" : [ "obj-35", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-2", 0 ],
                    "destination" : [ "obj-35", 1
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-29", 0 ],
                    "destination" : [ "obj-33", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-33", 0 ],
                    "destination" : [ "obj-31", 0
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-31", 0 ],
                    "destination" : [ "obj-34", 1
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
,             {
                "patchline" :
{
                    "source" : [ "obj-28", 0 ],
                    "destination" : [ "obj-31", 1
],
                    "hidden" : 0,
                    "color" : [ 0.0, 0.0, 0.0, 1.0
],
                    "midpoints" : [ ]
                }

            }
]
    }

}