OpenGL Widget/Custom Shaders

Has anyone experimented with loading custom fragment shaders?

I’m somewhat familiar with OpenGL, but am less familiar at working with it within the context that gets exposed inside a VCV module. (It seems that nanoVG is the source of the framebuffer, instantiating the NVGLUframebuffer object)

I’m quite familiar at working with vertex/pixel/compute shaders in TouchDesigner and Three, but am somewhat newer to the context that VCV provides.

The only other module I’ve found so far implementing something along these lines is the really cool ModularForecast GitHub - emurray2/auraaudio-vcv-rack by @emurray49

Some very cool work, I compiled it and played around a bit but the main interest I have is manually accessing frame buffers, and passing uniforms to vertex/pixel shaders (similar to a game engine) and then rendering that buffer to the module. (I realize this may just be something VCV isn’t designed to do)

My main confusion is on where I can create my shader programs, and link them to either the existing framebuffer or create a new one that passes the data back to the VCV created FBO. (Inside of a module context)

Curious to know if anyone else is experimenting with anything like this, or may have any helpful tips!

I am working on a module, look here for more information

1 Like

Cool! I remember Milkdrop from back in the day, probably part of what inspired me to get into writing shaders.

Have you investigated a way of hooking into the dependencies already built into Rack for achieving this?

I’m not really interested in having external DLLs to create the rendering context. Rack is OpenGL, and NanoVG seems to reference GLEW as a dependency already built into Rack.

I’m really just trying to figure out the best way of creating a new framebuffer or modifying the existing Module framebuffer that’s generated by the Widget function. Not sure if this is possible, digging through the codebase some more this weekend.

(For my purposes I mainly just want to get a buffer, vertex, frag pipeline running, preferably native inside Rack)

I am not at my computer but if you look at the code in rack for the framebufferwidget I think it shows what you want. I did Gl that way and it worked, actually that is also how LFM is working.

1 Like

Sorry, as I was not at my computer I pointed you in the wrong direction. I meant you should look at the OpenGlWidget.

See here: Visual Particle System in an OpenGlWidget - #5 by Vortico

Yeah, saw that.

Still unclear as to how to replace the FBO with my own, or write to the FBO that’s already instantiated. Seem to be able to create and bind my own VBO, FBO, vertex and frag, but can’t do any gl calls inside the drawFramebuffer override without getting errors that there’s apparently no context.

It’s a lot easier to write GLFW from the ground up it seems.

Am I correct in that you’re rendering the ProjectM framebuffer to a texture that you then pass to NVG to render using the existing widget/context in VCV?

Still trying to grok all the moving parts/structs that are going on here

Yes that is completely correct. Actually for the embedded version there is a hidden window running in the background.

1 Like