Forums > Jitter

glpopmatrix / pushmatrix over and underflow

March 30, 2014 | 12:52 pm

I tried around a bit to solve a problem with blending jit.gl.sketch and jit.gl.text3d in between and noticed a problem I need some help to understand.The following JS is just drawing two planes with the same texture. To reset the matrix I use pushmatrix and popmatrix. I did that a lot before without any problems in automatic 1 mode. Now with automatic = 0 I get the problem of stack overflow. It seems there are some pushmatrix calls I am not aware of. If I add a popmatrix() at the beginning after sketch.reset() the error messages disappear – leaving me with one more call of popmatrix than pushmatrix (should be an underflow).

I tried alread to add a "modelview" before every matrixcall to ensure the modelview matrix is called – without any help.

Any help? Thanks

I am using Max 6.1.6 / OS X 10.8.5 on a MacBookPro 13" Early 2011

 

//begin JS_TextGL.js

var renderContext = "rcx";

var myWindow = new JitterObject("jit.window", renderContext);
myWindow.depthbuffer = 1;
myWindow.size = [400, 200];

var myRender = new JitterObject("jit.gl.render", renderContext);
myRender.blend_enable = 1;
myRender.depth_enable = 1;
myRender.erase_color = [0., 0., 0., 1.];
myRender.automatic = 0;

var mySketch = new JitterObject("jit.gl.sketch", renderContext);
mySketch.blend_enable = 1;
mySketch.depth_enable = 1;
mySketch.automatic = 0;
mySketch.lightning_enable = 0;

var myTexture = new JitterObject("jit.gl.texture",renderContext);
myTexture.name = "Punkt";
myTexture.read("Punkt.png");
myTexture.adapt = 1;

function bang()
{
myRender.erase();

mySketch.reset();

//    mySketch.glpopmatrix();

mySketch.glbindtexture("Punkt");
mySketch.glpushmatrix();
mySketch.gltranslate(0.,0.,0.1);
mySketch.plane(1.,1.,1.,1.);
mySketch.draw();
mySketch.glpopmatrix();

mySketch.glbindtexture("Punkt");
mySketch.glpushmatrix();
mySketch.gltranslate(0.5,0.,0.2);
mySketch.plane(1,1,1,1);
mySketch.draw();
mySketch.glpopmatrix();

myRender.drawclients();
myRender.swap();
}

//end JS_TextGL.js

Attachments:
  1. JS_Test.maxpat

April 2, 2014 | 9:42 am

i can reproduce and will take a look, however your best bet for now is to stick with the extra popmatrix.

thanks for the report.


Viewing 2 posts - 1 through 2 (of 2 total)