Drawing shapes with open gl or 2d lib

Charly Beck's icon

Hi,

i never did this, can someone point me to the objects needed to draw circles and triangles in 2d?

It is import that i have a deterministic screen position because i wanna overlay with 2d image map. (And i'm too stupid to calculate a proper transformation/camera matrix in 3d to have it accurate positioned :p )

(i know in 3d there are several matrixes, one that is for perspective... this transformation needs to be skipped)

So if this is possible just in 2d or a "neutral" perspective matrix which allows to set a 2d window size within the content is displayed....

Thanks!

Rob Ramirez's icon

The 4 places I'd start:

  • jit.mgraphics

  • JSUI via mgraphics

  • JSUI via Sketch (OpenGL)

  • jit.gl.sketch

Charly Beck's icon

great! thank you rob! that was exactly what i've been looking for.

i'll try some nice animations with this :)

Roman Thilenius's icon


https://cycling74.com/forums/jit-gl-2d-gui-elements

i didnt had much fun with it yet, because geometric figures tend to jump around and dont draw at the exact same position when you draw again. i´ve also not found a rule how big a circle has to be to stay within -1 1, (but maybe i am just too dumb for it)

anyway, watch out with this jit.gl stuff, you cant count that any GPU does the same ;(

Charly Beck's icon

that doesn't sound too trustworthy XD

But i will check... Thanks for the advice.... Maybe it won't work at all. All the graphic devices just output strange stuff on my pc that looks differently from what the reference pictures say...

I have my data put to matrices, i still can decide which guilib i wanna use... So what's your propsal? How can i draw overlay graphics. For example i have a png displayed with circles and connectors and i wanna draw a half transparent circle to visualize the selection. Not very sophisticated, just basic shapes and transparency.

Charly Beck's icon

ok i think the 2d vectorgraphics is the right choice.

how can i make the pwindow transparent and only appear the shapes i draw on it so that the background shines throug?

Roman Thilenius's icon


i guess mgraphics would be a good compromise between lcd and GL?

lcd is out of the game if you want transparency for bitmaps, it can only do that with any possible configuration with drawing commands.

jsui is expensive, but look at its nice examples, maybe it turns you on.

Charly Beck's icon

i don't know lcd. but gl is 3d where mgraphics is 2d . but it works well and the commands are consistent and handy.

i think the most pro against gl is that you don't have problems with different gfx environment etc. it seems reliable. and 2d is enough for what i wanna display. nevertheless, shadows and spheric circles would be nice ;)

Roman Thilenius's icon


i´ve made interfaces where 2-3 different things (for example jit.lcd and a still image) have been made each into a matrix - then these matrixes could be mixed with different copymodes or triggered individually.

otherwise i am mostly a photohop guy. you can do a lot with picturecontrol. :)

Charly Beck's icon

hehe cool... yes there can be done a lot... now the animation runs and i'm suprised how smooth it is... even when the graph gets bigger...

https://www.youtube.com/watch?v=XS3hUtB95Tw

temp account's icon

wow that looks great --did you use jsui for this?

Charly Beck's icon

no, i used jit.mgraphics