PDA

View Full Version : Transform Feedback: buffer offset



john_connor
04-05-2017, 09:04 AM
hi everyone,

im trying to render to render the solar system. each planet has 1 texture, the mesh is just a simple sphere. as you might know, jupiter isnt only rotation, it's surface / atmosphere is relatively dynamic (https://en.wikipedia.org/wiki/File:PIA02863_-_Jupiter_surface_motion_animation.gif). thats why i thought i need transform feedback to capture dynamic texture coordinates. but not only jupiter, all hte gas planets have a dynamic surface.

the problem:
i want to render all the planets with dynamic texcoords with 1 program object. i also want to have the texcoords in the same vertex buffer, by the way: the vertex buffer is double-buffered ("buffer ping-ponging"). to be able to animate to surface for each planet independently, i think i'll use a texture layer for each planet that tells the vertexshader how to animate the sufrace at each point:

for each texel: (phi; theta) -> vec2 velocity
then: newtexcoords += velocity * time (will be captured)

how can i set the xfb_offset dynamically so that uranus' texcoords dont override jupiter's texcoords in the buffer ??
all the spheres will have the same vertexcount / mesh, only the texcoords should be animated independently.

Dark Photon
04-05-2017, 05:16 PM
Can you use glBindBufferRange (https://www.khronos.org/opengl/wiki/GLAPI/glBindBufferRange)() for this?

john_connor
04-06-2017, 05:31 AM
thx for your answer

nevermind :doh: i'm an idiot, i forgot that all the data will be captured continuously unti i call glEndTransformFeedback(), so there wont be any override problems ... however, i tought about it, and my conclusion is that it wont work "so easy", i coud animate some clouds or so but the differences in velocity of texcoords (of surface color) will be visible, it'll look like the surface "tears" apart (if i just upload values of a math function, i'd have to model the texcoords somehow with "blender" or so .. i guess)

by the way: it still doesnt work to in-shader-specify xfb data + use a fragmentshader :(