OpenGL Vertex and Fragment Shaders

I was wondering if anyone in the community has done any shader programming with OpenGL in Xojo?

And if so… if they perhaps have a basic example they could please share on how to load GLSL shaders with OpenGL.

Thank you in advance.

I’ve done some GLSL but via Core Image, not OpenGL directly. Sorry.

Yes, see EZProgram and EZShader in frameworks > ezgl framework > ezgl objects > shader in project
http://trochoid.weebly.com/uploads/6/2/6/4/62644133/ezgl_1k3.zip 38MB

There’s only 1 working demo I can find in there: ShaderTest2. It’s buried in head > drop > shader dev. But there’s so many windows it’ll be hard to find in the App.DefaultWindow list. Instead set the DefaultWindow to None and add App.Open with code dim w As new ShaderTest2. Click the compile button to see it do anything. Hopefully by tracing what it does should be self explanatory, there’s no real notes I don’t think.

Shaders require declares for some things so it’s Mac only. I’m guessing Windows versions of the declares could be added.

Not tested on 64bit.

Great stuff, thank you Will. I’ll have a look at it.

Wow, very awesome project Will. I especially love the Splitter control. Would you mind if I use the Splitter in my commercial projects?

After having a look at your shader example, and if I understand things correctly… it isn’t going to be as simple as just declaring the functions on Windows. It seems the OpenGL32.dll is stuck on version 1.4, and shaders is part of OpenGL v2.0+.

Arrghhh!

Sorry I missed this before. Yes, you can use it along with anything else in the project, but be aware the Splitter is missing an important feature: it doesn’t limit the drag between controls so you can easily lose it off-window or behind controls.

Also, setVH is confusing. I’ve since made it private and added descriptive methods.

[code]Sub setDragHorizontal()
setVH(true)
End Sub

Sub setDragVertical()
setVH(false)
End Sub
[/code]

Even that seems redundant and the drag direction could be implicitly set from whether addTop/Bottom or addLeft/Right are used.

Great stuff. Thanks Will.