I'm writing a plugin that uses GLSL internally for some rendering
stuff. Outside of a GLSL Shader patch, it works exactly as expected.
Inside a GLSL patch, it's a bit trickier: I want to utilize the GLSL's
fragment shader, but use my vertex shader. Doing this is fairly easy,
the question comes down to timing.
In enableExecution: when QC first starts up, a GLSL-using patch
appears to see a valid vertex and fragment shader in use, so it
properly attaches the fragment shader, and I'm good to go. However,
when switching to fullscreen mode, disableExecution: is called and
then enableExecution: is called again (this is probably for changing
the OpenGL Context). In enableExecution: this time around, no shaders
seem to be installed, so the plugin incorrectly uses its built-in
fallback fragment shader. Subsequent context switches (via fullscreen/
non-fullscreen transitions) leave the shader program unavailable in
enableExecution:.
Is this behaviour expected, or is it a bug? I whipped up a quick
plugin that enumerates the currently installed shader programs, placed
it inside a GLSL Shader Patch in a new composition, and here's the
output:
{ Started QC }
Dec 29 23:05:45 phendrana Quartz Composer[92320]: enableExecution:
Current GLSL Program: 3
Dec 29 23:05:45 phendrana Quartz Composer[92320]: * 2 attached
shaders
Dec 29 23:05:45 phendrana Quartz Composer[92320]: * Shader 1
(Vertex Shader)
Dec 29 23:05:45 phendrana Quartz Composer[92320]: * Shader 2
(Fragment Shader)
{ Switched to full screen mode }
Dec 29 23:05:48 phendrana Quartz Composer[92320]: disableExecution
called.
Dec 29 23:05:48 phendrana Quartz Composer[92320]: enableExecution:
Current GLSL Program: 0
{ Switched back and forth a few more times }
Dec 29 23:05:49 phendrana Quartz Composer[92320]: disableExecution
called.
Dec 29 23:05:49 phendrana Quartz Composer[92320]: enableExecution:
Current GLSL Program: 0
Dec 29 23:05:49 phendrana Quartz Composer[92320]: disableExecution
called.
Dec 29 23:05:49 phendrana Quartz Composer[92320]: enableExecution:
Current GLSL Program: 0
In the mean time, are enable/disableExecution: appropriate places to
link GLSL shader programs? If not, would linking every frame in
execute: be expensive performance-wise? Is there a better way to
utilize one of the GLSL Patch's programs?
--
[ christopher wright ]
[EMAIL PROTECTED]
http://kineme.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]