# OpenGL/GLSL/LWJGL return value from shader

I'm trying to do some bone animation. I don't want the whole skeleton to be loaded to the GLSL shader every time, even tough it's not needed, because one vertex is parented to one bone, not more. My question is simple: (How) can i return some value from the vertex shader back to my code? I'm using LWJGL/Java

• Believe it or not, you actually cant. What you can do is write pixels out to a buffer, and then read the buffer later. – mklingen Feb 14 '15 at 15:23
• There is also GL_ATOMIC_COUNTER_BUFFER atomic increments, and the transform feedback buffer in Daniel Carlsson's answer below. Watching answers carefully, this is an interesting question to me... – david van brink Feb 14 '15 at 19:29
• Ok, then I just load the whole Skeleton into the shader, isn't a huge thing, but could impact performance :/ – Addi Feb 14 '15 at 19:48

• Yes you can, but as always when reading buffers from the CPU you have to keep in mind that the buffer might not be filled yet just because your rendering the next frame in the CPU. You need to use glFenceSync​ to make sure you have valid output in the buffer. – Daniel Carlsson Feb 14 '15 at 22:12