Simple QCPlugin Starter

toneburst's picture

Hiya,

does anyone happen to have a really simple example QC plugin project that I could look at, and pick apart?

What I basically want to do is create a really simple plugin that generates a 2D image output by using a GLSL shader. So, it would have controls for the size of the required output image, and some controls for the shader itself, of course. I'm primarily interested in how to get a shader setup though, and render the results in a format that can be piped into QC as a flat image.

Cheers,

a|x

cwright's picture
simple != helpful

what's you're attempting to do is way beyond the scope of simple plugin (the developer examples like GL Square are really simple and straightforward).

Setting up and rendering a GLSL shader to an image requires creating and managing your own openGL context, managing a shader program. Then you'll need a readPixels or one of the faster asynchronous methods to get the pixel data. Or, you can set it up to render to a texture, and then pass along the texture to QC (qc can use gl textures as image sources, which is really fast and slick, but somewhat difficult to do if you're not a gl guru -- I haven't even done this, because I largely suck at opengl still, but I've used the feature for other things where the gl texture rendering is done by other code).

is the shader dynamic? if so, you're going to be doubly in pain -- the Super GLSL Grid patch handles this, but it's quite a bit of code to handle the shader stuff.

toneburst's picture
Ah, naive me...

I thought that was a relatively simple thing to do... apparently not.

This is all basically because I can't get my simple Perlin noise GLSL shader to render properly in a RII patch (you may have seen my post on the QCDev list). I thought if I could knock up a simple plugin to do the same thing (render a 2D Perlin noise field, with adjustable offset and scale), I'd be able to tell if the problem was with the the RII patch- and I'd obviously have a useful little noise-generating patch at the same time.

I may ask vade. I know he's done this a before with his plugins. I seem to remember him telling me he renders to a texture. He's definitely used GLSL shaders in QC plugins, too.

Back to the drawing board, anyway :(

a|x