Erasing in openGL

This is a discussion on Erasing in openGL within the Game Programming forums, part of the General Programming Boards category; Hi guys, does anyone know how to erase shapes and things in opengGL? i have draughts that i want to ...

  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
    32,821
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    ...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,070
    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)?
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    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-03-2007 at 12:06 AM.

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, 11:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01: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, 11:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21