Hi again!
I’m right now dissecting the FilterManager and swapped out the CardMaker
for a custom Full Screen Triangle using three empty vertices. The Triangle itself
is created in the vertex shader without actually pulling any data from memory.
There are a few sites going into this, like this one:
rauwendaal.net/2014/06/14/rende … in-opengl/
And before you wonder, it really is faster than doing a quad, for several reasons.
Not only does it save a vertex and the shader from pulling data from memory,
it also saves processing time on the adjacent edges of the two triangles making up a quad.
Due to pixels being processed in groups, the touching lines of the triangle partly get processed twice,
which can be a performance hog for heavy shaders. The Triangle eliminates this.
For my rather moderate shader doing six passes (aka 6 Triangles) it saves me 0.3-0.4msec rendering time.
I think that’s quite the improvement for such a simple change.
Now, I wanted to ask if you would want me to put that into the FilterManager and create a Pull request on github. I only ever did this ONCE (a pull request, so I’m new to “open source-ing”), so I thought about going the safe route adding a “useTriangle” boolean defaulted to False, so the new code wouldn’t possibly make old code potentially unusable.
So it would then look like this, in FilterManager:
def __init__(self, win, cam, forcex=0, forcey=0, UseTriangle=False):
And the following code would then check if it’s True or False, choosing between Quad or Triangle.
What do you think?