Abanoub
Abanoub

Reputation: 3809

Is it possible to get data from shaders

what am trying to do is getting the Position of the vertex after translation, rotation, scaling, and get the Normal direction, after translation, rotation, scaling , then pass the values to my C++ app , is that possible ?

Upvotes: 0

Views: 465

Answers (1)

datenwolf
datenwolf

Reputation: 162164

Possible yes, but the most elegant method depends on the OpenGL version profile available. The most elegant solution would be vertex transform feedback https://www.opengl.org/wiki/Transform_Feedback

If you don't have VTF you'll have to write the information into the framebuffer (in a fragment buffer object) for readback (this will of course prevent you from seeing a "image" but just give you color coded information). Render in GL_POINTS mode, use the gl_VertexID to set the fragment position, pass the transformed data to the fragment shader and have the fragment shader write it into the right color channels.

Upvotes: 2

Related Questions