开发者

Redraw old buffer question

开发者 https://www.devze.com 2023-03-28 18:50 出处:网络
My main scene is composed of GL_POINTS in 3D space.What I would like to do is be able to draw a single GL_LINES line (2d overlay) on top of the scene as the user moves his finger across the screen whi

My main scene is composed of GL_POINTS in 3D space. What I would like to do is be able to draw a single GL_LINES line (2d overlay) on top of the scene as the user moves his finger across the screen while retaining the underlaying 3D GL_POINTS state. I am having trouble understanding if this is possible. Do I need 2 framebuffers? How do I save the previous framebuffer data of GL_POINTS and re-render that in subsequent frames? Do I need to mix framebuffers - one for the GL_LINE layer and one for the GL_POINTS data?

I tried only calling presentFramebuffer without calling setFramebuffer but that is retaining each GL_LINES drawn fro开发者_开发技巧m previous frames - which I do not want. How do I retain parts of the framebuffer and remove other parts?


  1. you do not need a 2 frame-buffers at all

    • frame buffer is your screen memory
    • just render all stuff on that one you have
  2. if you mean by frame-buffer VBO (VertexBufferObject) then they are not the same at all

    • if you render the same data (vertexes)
    • then you need just 1x VBO
    • and call glDrawArrays/glDrawElements twice
    • once with GL_POINTS and once with GL_LINES/GL_LINE_LOOP or whatever

    • if you render different data

    • then you need 2x VBO
    • or if there are only few Lines then you can still use glBegin/glEnd for them instead.
  3. if you just need separate areas of view then you can use

    • clipping, change view-port, overwrite borders by quads, ...
    • draw to texture, and so on ... there is a lot of options more there
0

精彩评论

暂无评论...
验证码 换一张
取 消