Aug 17, 2009 at 11:22pm
Is it possible to group/cluster videoplanes together, e.g. spaceship and thrust in one group, background in another, and then have them both appear in the same window? Am I using the wrong tools here?
Thanks for any pointers.
Aug 18, 2009 at 12:41am
OK, got the math, and am now turning on/off rendering until I know the adjustments have been calculated, so no more sudden background shifts. If there is a more elegant solution, I certainly wouldn’t mind hearing about it, tho.
Aug 18, 2009 at 9:55am
In this case, sending position and rotation data to render will work as most of your objects move at the same time. Generally I prefer to keep the ‘world’ in the same spot and just move the objects around, it’s easier for my brain to understand.
There are ways of rendering things in groups. One is to use ‘push’ and ‘pop’ using [jit.gl.sketch], but you need to get into openGL a little bit more for that. It basically involves objects to be drawn in a tree like structure, where you can jump back to the previous node.
You could also do it manually, by just specifying a position for the group (spaceship + thrust), where the two elements in the group have their own relative position to the group position. You just add using [vexpr] and you’re good to go. I’d try this first.
Turning rendering off and on just to calculate a position makes me wonder what kind of calculation this is. Are you calculating the path of the Hubble telescope until the year 2046 by any chance? Seriously, this shouldn’t take too much time…
Aug 18, 2009 at 5:19pm
Thanks for the advice!
So far my method above is working. It isn’t the number of calculations wrt this problem that might cause a delay, but in combination with a bunch of other things happening at the same time…AND the hubble path…actually to 2076 Just trying to find a way that ensures all calculations are made before the next rendering bang is processed.
Aug 18, 2009 at 6:04pm
here’s an old patch jkc posted regarding using the matrix stack with gl.sketch to do complex transformations.
might give you some ideas.
#P window setfont “Sans Serif” 9.;
Jul 31, 2012 at 11:50am
How do you inject anything like color or a texture into the gl in this example? I’ve tried
glmatrixmode modelview, glpushmatrix, glloadidentity, gltranslate 0 0 -4, glenable texture, glbindtexture texturename,
in the top subpatch but on the first bang of the uzi I get “jit.gl.texture: error enabling transform: GL Error: Stack overflow”. Strangely the error only occurs once for each rendered item and the texture does get applied.
You must be logged in to reply to this topic.