View Full Version : How to read variables in fragment shader?
For example, depending on the variable A, an program will continue or stop by the end of every pass.
09-20-2006, 05:08 AM
Sorry, but your question is unclear. Are you asking how to pass variables from application to shader?
Sorry, it was my fault.
I am writing a seed filling algorithm on GPU, and need passing some variables from shader to application. These variables will be used to change the application running: to continue to filling, to generate new seed and start new round seed filling or to stop the application.
09-20-2006, 05:47 AM
Ok, actually you can't pass variables from shader to application.
The only output of your shader are pixels (color, depth and indirectly stencil). So, your shader should draw a pixel, and application should read it using glReadPixels.
You could also use occlusion query to count pixels that were drawn if you need such information.
09-20-2006, 05:54 AM
And one more thing - I don't think that using GPU for seed fill is a good idea. The nature of this algorithm is too far away from the way GPU's work. Seed fill is recursive/scatter and GPU's are parallel/gather.
09-27-2006, 10:21 PM
maybe you should use pbuffer or fbo to process the texture data
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.