GLSL Tesselation shader question

Recently I’ve been diving into GLSL and I came across this:

Would it be possible to create something like this for the BGE? I mean, can BGE actually use the tesselation control and evalutaion shaders?

I’m pretty sure bge can handle pretty much anything you throw at it. The only hitches are trying to figure out how to make it, and how fast it will run.

I was asking because shader.setSource only take 2 args and 1 boolean, with the args apparently always being 1st = vertex shader and 2nd = fragment shader…

this wont work, these GL functions have not been wrapped into the BGL module, its still currently using OpenGL 2 i believe.

if you want OpenGL 4 you will have to modify the blender source and wrap the new functions.

i’m surprised why there isn’t newer OpenGL support already.

EDIT: after looking closer at the code im now not quite sure, many of the GL calls are done by talking to the graphics card directly, just need to put together a working example to test.


ok, yeh your right shader.setSource does only take 2 args. i was right with my first assumption. not possible with blender in its current state. A third party DLL or a patch to the original source is a workaround i believe.

Ok after having some time to go over the source, the glew supports upto gl 4.2, including the control and evaluation program calls.

Moguri added geometry shader support in Harmony branch. Try the latest harmony build to test the shader.

@CTMB thats what I was noticing… the wrapper is there to create the program through glCreateShader(shaderType), with available shader types of; GL_VERTEX_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER, or GL_FRAGMENT_SHADER

@martinsh I’ll checkout the geometry shader, but correct me if I’m wrong; geometry shaders is slower and less efficient than tesselation shaders.

ah, I see. when I made tessellation in BGE few years ago there was only geometry shaders available in OpenGL. Tessellation shaders are something new then.

glCreateShader dpes not seem to recognize the shader types like the API says…
for instance GL_VERTEX_SHADER… it says that it is not defined… after which it gives me an error that it needs and int instead of GL_VERTEX_SHADER…

In blender is the wrappers tied to and int sequence?
How do you specify the shader type? i.e. vertex, tesselation, geometry, or fragment

I restarted blender and now it works…
go figure lol

Martinsh or anyone who knows, is there any reason why I would not be able to get this tesselation shader working in blender using the wrappers?

I don’t know what kind of OpenGL code is needed to run a tesselation shader, but if there is any the BGE does not have it implemented. For example, adding geometry shader support to that wrapper required some extra OpenGL code in the BGE to handle the information properly.

Really? What are the wrappers there for then?
I had noticed the wrappers were implemented with the above mentioned GL_TESS_CONTROL_SHADER and GL_TESS_EVALUATION_SHADER and had hope for it. Thanks for the reply