I’m a glsl beginner.
I’m experimenting how to get color value from fbo texture and mapp the value to mesh depth.
It seems like I could not get color value from fbo texture and map them to mesh depth.
I uploaded my experiment Xcode Project to Github.
Please help what I misunderstanding about GLSL color parameter.
It looks like you’re getting the coordinates wrong, try not using ofDisableArbTex() and putting this into your fragment shader:
int xc = gl_InstanceID%(iCount);
int yc = gl_InstanceID/(iCount);
//vec4 pixelDepth = texture(tex0,vec2(instanceX +fCount/2.0 , instanceY +fCount/2.0));
vec4 pixelDepth = texture(tex0,vec2(xc,yc));
Also, check out this tutorial that I and Lukasz wrote, it might help you going forward: http://www.openframeworks.cc/tutorials/graphics/shaders.html#fbos
Thank you for replying and helping.
Yes, it works.
aslo, I started to read the tutorial you recommend.
It’s very well-written tutorial for especially shader/fbo beginner like me.
I appreciate your help.