PDA

View Full Version : Redraw on Mouse Move



Thahir
11-07-2009, 07:46 AM
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.

ZbuffeR
11-07-2009, 07:31 PM
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.

Thahir
11-07-2009, 11:47 PM
Hi,

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

Thank u.

ZbuffeR
11-08-2009, 11:01 AM
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.

AdrianPi
11-08-2009, 06:35 PM
You can also use the scissor tests

ZbuffeR
11-08-2009, 07:11 PM
scissor tests : how could that possibly help for the mentioned problem ?