Results 1 to 6 of 6

Thread: Redraw on Mouse Move

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    13

    Redraw on Mouse Move

    Hi Friends,

    I'm trying to develop a 3D drawing application. Now i can a draw a line using the mouse. While drawing, double click to start the line and another double click to finish the line. So after first double click , i draw the entire scene again and again on mouse move util we click another double click to finish the line. If i have only few no. of line while i draw a new line means its no problem to update the entire scene for every mouse move. But if i have more than 10000 lines means is slow down the drawing speed ?

    What my problem is, if anther commands available in opengl to avoid redraw of exist lines while draw a new line ?

    Thanks.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Redraw on Mouse Move

    10000 lines should not be slow on modern hardware.
    But if you want to really scale, a good way is to render existing scene to a texture on first click, then during interactive mouse move, only draw textured quad with previous scene, plus the few new lines.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    13

    Re: Redraw on Mouse Move

    Hi,

    Can u please tell me how to render the existing scene to a texture on click ?

    Thank u.

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Redraw on Mouse Move

    The easiest is to do glCopyTexSubImage2d(), but it only works for visible parts of the rendered window. Try this first.
    The more robust way is to render to an offscreen FBO :
    http://www.opengl.org/wiki/GL_EXT_framebuffer_object
    The are also good tutorials on the web.

  5. #5
    Member Contributor
    Join Date
    Jul 2009
    Location
    Buenos Aires
    Posts
    67

    Re: Redraw on Mouse Move

    You can also use the scissor tests

  6. #6
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Redraw on Mouse Move

    scissor tests : how could that possibly help for the mentioned problem ?

Similar Threads

  1. Move object with mouse
    By roband915 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-25-2011, 07:33 AM
  2. How can I move the object along with the mouse?
    By mehmedean in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 01-11-2010, 03:15 AM
  3. Mouse move and CPU usage
    By Bombata in forum OpenGL: Windows
    Replies: 2
    Last Post: 03-21-2009, 03:37 PM
  4. move by mouse
    By zwe|sam in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-13-2003, 07:58 AM
  5. move object with a mouse
    By adityask in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-14-2002, 02:22 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