Thread: Erasing in openGL

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    37

    Erasing in openGL

    Hi guys,

    does anyone know how to erase shapes and things in opengGL? i have draughts that i want to erase once the are taken, but i don't know how?

    thnx

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Erase the whole screen, and redraw the board in it's new state.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    ...which if you are not already doing you are using OpenGL incorrectly. Double buffering is the answer to your problem.

  4. #4
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    Hang on. Does he mean erase the screen, or "erase" the objects (as in delete them from memory or whatever so they won't be drawn)?
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Dunno - the question could be vague enough to mean either.

    I thought that since he mentioned OpenGL that it referred to the visual representation of the board state, not the internal board representation used by the game logic.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Mar 2007
    Posts
    37
    i love you guys, get me thinking logically, expect more noob questions, it is my first program, sorry......

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Noob questions are fine so long as we can understand the question.

    Expand a bit on your problem and we will be able to help more. What we all are saying is that in all cases you should be updating the screen based on memory contents. Therefore if you wish to 'erase' an object you do not render that 'object' in the next frame.

    If you think of the game world and data as the document and the renderer as the view you can arrive at the doc/view architecture. The view does not handle the document, it merely displays the document data so that the user can understand and use the data. So if you change the document, the view changes automatically since it just renders or draws according to the document data. Notice now that the view can also change in which case this would be another way to present the same data.
    Last edited by VirtualAce; 04-02-2007 at 11:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM