Hello
I wondering what special state management or 'no nos' to avoid when
attempting to make a custom consumer patch compatible with to be
rendered within the GLSL macro patch?
My plugin is here, (http://002.vade.info/?page_id=19) its a fairly
modified version of the GLHeighfield plugin with some extra goodies -
namely a texture coordinates and an additional image input patch for
texturing the scan-lines on the final render.
What I have as a partial working solution is to check for the
GL_ACTIVE_PROGRAM in startExecution and store that as an ivar, and re-
bind it before rendering out the final geometry. This seems to work,
however I have some odd behavior: If I create a GLSL shader that uses
a sampler and connect an image input to that sampler input port, I do
not render anything at all (not black, literally no output at all). I
attempted disabling texturing within my plugin but the behavior
remains. Anytime a sampler is made active (fed an image), my rendering
stops. Considering that the internals of the GLSL Shader macro are
black box, im not sure what to do?
I dont know how the GLSL Shader macro patch assigns texture units, but
I am using GL_TEXTURE0, but I suspect this may have more to do with
internal FBO/buffer handling?
My psuedo code is:
startExecution:
check active shader store to temp ivar "previousShader" (this would be
NULL for no shader, or some GLint for whatever the GLSL macro has
loaded on the stack).
check compatibility to make sure plugin can run, if so, continue.
executeAtTime:
// render displacement to FBO->VBO
bind to no shader // we dont want this interfering with our
displacement 'map'
bind FBO
lock displacement image representations and buffer to GL_TEXTURE0
using QCImage lockTextureRepresnetation and bindTexture methods)
render input displacement image to temp FBO on a simple quad.
unlock/unbind image
read FBO to VBO
unbind FBO/bind normal rendering destination
// render VBO.
set up state transforms
enable VBO arrays
bind the "previousShader" (our GLSL macros shader)
lock texturing image representations and buffer to GL_TEXTURE0
render our VBO with our indices
unlock/unbind texture image
fin.
Im worried that some of the more complicated stages (render
displacement map to FBO) interfere with the GLSL Shader macros
assumptions?
Since the plugin will be open source/donationware, im happy to share
the project as it stands with the above additions:
http://002.vade.info/downloads/beta/v002RuttEtraSource.zip
_______________________________________________
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]