Page 1 of 1

Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Mon Jan 25, 2021 8:44 am
by sq4
Need some advice...

I am busy with a third attempt to create "Pixys".
Pixys is a visualisation tool running as a VST-plugin in a DAW.
(see http://www.raxntrax.com/pixys_beta)

It is an ongoing experiment. I have started with pure GDI, then going to GDI+/canvasgadget and then to OpenWindowedScreen+Sprites.
The performance is now OK.
I can color/zoom/move/rotate* sprites with the automation data coming from the DAW.

So far, so good.

But now I am stuck.
Rotation is done with RotateSprite, which is in fact a Z-rotation.
I want to be able to do X and Y-rotation as well.
I can use TransformSprite for that and use Demivec workaround for OpenGL but it's not 100% what I am looking for.
(viewtopic.php?f=12&t=72377&hilit=Transformsprite)

Considering that I am looking for the highest possible performance and the fact that Pixys is a VST-plugin that should be as lightweight as possible, I am in doubt whether i should switch to OpenGL with the OpenGLGadget.

I can simulate sprites with textures in the OpenGLGadget but I am not sure if "OpenGL/Textures" is as fast as the "native sprite library" from purebasic.
Furthermore : switching to OpenGLGadget excludes DirectX which still is a bit faster than OpenGL (at least in this context -> Windows->VST-Plugin/DAW)

I have been searching the forums for ways to interfere directly with the sprite library, but I can't seem to find any answers.
For example: a command like opengl->glviewport() is working fine with openwindowedscreen, but i also need to be able to access the sprites with opengl.
(StartDrawing -> SpriteOutput is not an option).
(I am willing to give up on DirectX and go the OpenGL route.)

It would be great not to switch to OpenGLGadget and to be able to use glRotatef() commands on sprites created by the native sprite library....
(Or to have a TransformSprite that works exactly like glRotatef() including perspective when rotating around X and Y-axis and is very fast)

Re: Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Mon Jan 25, 2021 3:29 pm
by infratec
Hm .... I'm not a graphic guru, but maybe you can find a solution here:

viewtopic.php?p=564787#p564787

press numpad 2 and 8.

Re: Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Tue Jan 26, 2021 7:58 pm
by Mijikai
OpenGL is really fast even if you just use the legacy functions.
With legacy OpenGL i was able to get 60 fps rendering 10k sprites.
You can also use modern OpenGL and increase the perfomance dramatically.

Anyhow you need to write your own sprite functions then.

My suggestion however would be to use GLSL and do all effects in a shader.
Its the best, fastest and most modern way to do very complex 2D (or even 3D effects).
Very powerful.

Re: Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Wed Jan 27, 2021 1:00 pm
by sq4
Mijikai wrote: My suggestion however would be to use GLSL and do all effects in a shader.
Its the best, fastest and most modern way to do very complex 2D (or even 3D effects).
Very powerful.
Indeed!

ATM my "Pixys project" is hybrid.
I am still using the Sprite library for textured based stuff, but I was able to incorporate GLSL for background effects.
Next step will be to get rid of the sprite library, and use GLSL only.
AFAIK GLSL allows textures like the sprite library, so this could result in even more performance gain...
(The automation data/audio data coming from the DAW as well as timing info will then be passed to GLSL through UNIFORMS.)

What I am looking for now is people (musicians?) who use a DAW and want to participate in this adventure.

You can find more info at https://www.raxntrax.com/pixys_beta

P.s.
I do not attempt to make a "ZGameEditor Visualizer" clone that is a part of the FLStudio package.
I just want to explore what is technically possible with PureBasic, because, well mmh, I just love this language!!
And now, with that Thread-save bug fixed in 5.72 it's the only language I use for all my projects.
viewtopic.php?f=4&t=71264
Thanks again to Fred!

Re: Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Wed Jan 27, 2021 6:17 pm
by Mijikai
Nice and interesting project :)
One of my current projects is a GLSL shader viewer that compiles shaders
on the fly and displays them in a host window.
Basically something like http://www.shadertoy.com or
https://github.com/Gargaj/Bonzomatic.

I also experimented with 'software shaders' written entirely in PB.
Its slow but it would totally work if you would go for a retro (pixel) style
with limited resolution (and then upscale to the output).
My experimental lib: viewtopic.php?f=27&t=76553
I sadly dont have a DAW to experiment with :(

Btw. what about PB v. 5.73?

Is FL-Studio good?
How much bloat is there?

Re: Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Wed Jan 27, 2021 6:29 pm
by sq4
My experimental lib: viewtopic.php?f=27&t=76553
Indeed, I've tried it a couple of days ago.
Nice job you did with equally distributing thread loads.
Btw. what about PB v. 5.73?
Yes, I still must update from 5.72.
OTOH, nothing in there that I need, and like they say : never change a winning team ;-)

...and ofcourse, FLStudio is great, just like most DAWs nowadays.
You can get some even for free like WaveForm 11 and Bandlabs Cakewalk. Super pro DAWs!

Re: Switching from OpenWindowedScreen to OpenGLGadget?

Posted: Wed Jan 27, 2021 6:57 pm
by Mijikai
sq4 wrote:...and ofcourse, FLStudio is great, just like most DAWs nowadays.
You can get some even for free like WaveForm 11 and Bandlabs Cakewalk. Super pro DAWs!
Thank you, i will have a look :D