Results 1 to 4 of 4

Thread: Improved rubberbanding in opengl?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Bangalore,India
    Posts
    25

    Improved rubberbanding in opengl?

    Hi, I'm stuck with yet another problem in Opengl.
    Here we go-
    I need to use rubberbanding in my graphics package that is more or less similar to the Paint Brush app in Windows.
    Right now, i've implemented it somewhat like this:
    1)Enter XOR mode.
    2)Draw the line to display it.
    3)And redraw the old line(to erase it) and redraw it(to draw the new line) whenever the mouse motion callback function is invoked.

    The code works just fine, but for the flicker when I move the mouse rapidly.

    It gets worse for the rectangle, worser for the circle( and ellipse) and worst for the bezier curve (for the bezier I cant just see the curve at certain times.)

    The code is similar to F.S. hill Jr' code for rubberbanding.

    Ya, I cant afford a SGI workstation until I get a solution for this prob!!

    My comp has a TNT2 (AGP) as the graphics accelerator (decelerator!!).
    HELP!!!!
    Yup, that's me!!

  2. #2
    Member Contributor
    Join Date
    Nov 2001
    Posts
    77

    Re: Improved rubberbanding in opengl?

    I don't know much about GLUT, but there are generally two ways to eliminate flicker:

    1) redraw only what's needed
    2) double buffering or (preffered) page flipping

    The second option is often the easiest (and IMHO the best) to implement, but I think GLUT does it automatically. I would try to put a "is rendering" bit in your code (ie: bool isRendering). When you begin to render your frame, simply set that bit, and do not enter any rendering code until that bit is cleared (at the end of your code).

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Bangalore,India
    Posts
    25

    Re: Improved rubberbanding in opengl?

    Yup, ur almost there:
    I tried to do double buffering. It works with the animation exmaples that I have: rotating a rectangle when a mouse is clicked.
    But whenever I try to do it in my Interactive programs they just dont work: I have to enter fullscreen , but they dont enter into fullscreen mode (I use GLUT for window management).
    Yup, that's me!!

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Improved rubberbanding in opengl?

    I have an example drawing program that uses rubber banding when drawing object and I do it with glut and double buffering.

    It is just how you write your program that makes the diffrence.

    If you drop me a e-mail and remind me what your looking for, I will be happy to send you example source for my rubber banding routine.




    [This message has been edited by nexusone (edited 02-23-2004).]

Similar Threads

  1. Improved error reporting
    By Ares Lagae in forum OpenGL: GLSL
    Replies: 15
    Last Post: 01-26-2010, 03:58 AM
  2. improved shadowmapping
    By zed in forum OpenGL: Advanced Coding
    Replies: 12
    Last Post: 01-06-2007, 11:33 AM
  3. rubberbanding in opengl
    By princeoflightning in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 02-26-2004, 10:13 AM
  4. rubberbanding in opengl
    By princeoflightning in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-25-2004, 05:27 PM
  5. OpenGL 2.0, is the accumulation buffer being improved?
    By mohsin in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-27-2002, 03:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean