Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: clearing a point

  1. #1
    Newbie Newbie
    Join Date
    Apr 2014
    Posts
    2

    clearing a point

    I am making a particle physics thing were sand falls from the top of the screen and collects on the bottom.
    the sand is being drawn using GL_POINTS.
    since the whole screen is a lot of points to draw (1920x1080) and the sand does not move much i would only like to render the point when it moves.
    to do this i tried removing glClear( GL_COLOR_BUFFER_BIT ); and drawing over the old pixels after i move them with a black pixel but it doesn't work.
    the sand leaves streaks like its not being cleared and the streaks flicker like it cant decide weather or not to put color or black so its flipping back and forth or something.
    is there a way to do this or do i need to just clear the whole screen.

  2. #2
    Intern Contributor Brokenmind's Avatar
    Join Date
    Feb 2014
    Location
    Aachen / Germany
    Posts
    71
    Quote Originally Posted by blaze157 View Post
    and drawing over the old pixels after i move them with a black pixel but it doesn't work.
    This sounds like you draw over the old pixel after you move them, which is the same coordinate as the new pixel. The flickering you see might have the same origin, so you should test whether you really overdraw the old position instead of the new one.

    As for the question whether particle physics should be drawn using another approach, I unfortunately cannot help you.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Sep 2013
    Posts
    107
    Just quoting the "Common Mistakes"-Page:
    The buffers should always be cleared. On much older hardware, there was a technique to get away without clearing the scene, but on even semi-recent hardware, this will actually make things slower. So always do the clear.
    Source: https://www.opengl.org/wiki/Common_M...s#Swap_Buffers

  4. #4
    Newbie Newbie
    Join Date
    Apr 2014
    Posts
    2
    This sounds like you draw over the old pixel after you move them, which is the same coordinate as the new pixel. The flickering you see might have the same origin
    that makes sense, i guess i was thinking about my 2D field of particles and i forgot that openGL can be layered and you can have 2 points in the same place

    well its no big deal ill just clear the whole screen. thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •