   Zooming and Panning Performance Question
  I have a question on panning and zooming.  When I perform these tasks, my CPU takes a hit in performance.  It goes back to normal after the task is complete; but the spike in CPU utilization is bad.  For panning, I currently redraw the entire scene.  I can't simply move the camera about because I already use a clipping trick to reduce CPU utilization.  Hence, doing a straight camera move will result in me drawing a blank space.  However, I might be able to redraw part of the scene and move the camera.  Hence, I pan 30 degrees; I would move the camera and only redraw the blank area.  With zooming, I still have to redraw the entire scene I think.  The reason is I do a trick where I draw the level of detail of an image based on the zoom factor.  Has anyone come across a similar problem?  I can't render the image at max detail and zoom the camera in and out because rendering the entire image at max detail hits the CPU too hard.  Thanks for any help.   
Quote:Original post by fathom88I have a question on panning and zooming.  When I perform these tasks, my CPU takes a hit in performance.  It goes back to normal after the task is complete; but the spike in CPU utilization is bad.  For panning, I currently redraw the entire scene.  I can't simply move the camera about because I already use a clipping trick to reduce CPU utilization.  Hence, doing a straight camera move will result in me drawing a blank space.  However, I might be able to redraw part of the scene and move the camera.  Hence, I pan 30 degrees; I would move the camera and only redraw the blank area.  With zooming, I still have to redraw the entire scene I think.  The reason is I do a trick where I draw the level of detail of an image based on the zoom factor.  Has anyone come across a similar problem?  I can't render the image at max detail and zoom the camera in and out because rendering the entire image at max detail hits the CPU too hard.  Thanks for any help.Are you rendering in software? In hardware-accelerated OpenGL it shouldn't be a problem to redraw the whole scene 100 times per second.(or maybe you have a very old card/drivers)   ;  Thanks for the reply.  The actual drawing part may be super quick, but I have to translate a data set into X,Y coordinates before sending it to OpenGL for render.  I'm sure if I were using a static array of pre-defined X,Y coordinates, OpenGL would not have a problem.  However, I think the extra conversion part hits the CPU hard.  Plus, the data is constantly changing.  I can't store the data set because of memory limitations.  I would need to store the original data form plus an extra X,Y version of it.  This almost doubles my memory usage.   ;  why don't you throw the translation work into the vertex shader?   ;  I'm still not sure what exactly you are doing.Can you provide code?   ;Quote:Original post by fathom88The actual drawing part may be super quick, but I have to translate a data set into X,Y coordinates before sending it to OpenGL for render.So let me get this straight, you are doing some kind of transformation and projection that is so fancy, special and different that you can't use OpenGLs modelview and projection matrix? Why? Is every point in your data set getting a different treatment from all others?It sounds like you're abusing OpenGL as a pure 2D "painting" API, while the first post sounds more like a weird misconception that OpenGL is creating some "real" interactive images to move around in.This needs some clarification to decide if one should point you to some basic ressources about OpenGL or if you REALLY want to do something completely out of the ordinary.   ;  To Trienco, I don't mean "translate" in the terms of rendering.  I mean a piece of hardware gives me data in one format and I must translate that data to pictoral representation.  Hence, the need to convert my data to an X,Y format for OpenGL.  Perhaps format change would have been a better phrase. As to the second part of your post "first post sounds more like a weird misconception that OpenGL is creating some "real" interactive images to move around in." -- Some clarification is order.  I mean once the data is converted and already rendered, I can use gluLookAt() or other set of "transform" functions to pan what's already rendered without having to go though the step of converting the data to pictoral representation because only OpenGL already has the data in an X,Y format.  Hence, my blank space.  I only try to render what is visible on the screen to save myself the overhead of the conversion of machine data to screen plot data.  Thanks for the help.   ;  What format are you getting your data in? If it's just "filtering" out unused data there could/should/might be ways to let OpenGL do it.We also need to clarify on what we mean with "rendered". Whatever was rendered by OpenGL is "fix" and can't be panned, moved or anything without rendering a new frame.You probably won't get around storing the converted data or at least a part of it. So whenever you want to change the view you will at least have to convert the previously invisible data. If you can end up with a whole lot of data a way to structure and organize it to either quickly cull (ie. not render) the invisible parts or decide which parts to drop and replace with new data.Knowing how you get your data (size, speed, etc.) and what you want to do with it would help quite a bit to figure out the best (or least a half decent) way would be.   ;  It's how you use the term rendering. You have two types of rendering in your application. One is done by your application to realize the image from the data. The other is done by OpenGL to actually draw to the screen. People normally think of rendering as OpenGL drawing to the screen and thus the confusion.   ;  I get millions of raw data points (one full update every second).  The conversion is not a trivial matter.  I already use a lookup table to help speed the process up.  I store all the raw data points in a data object but only convert what I need to fill the user's current view.  Converting every point into a X,Y format for plotting is too costly.  If the data wasn't constantly changing, there would be no problem doing a OpenGL "transform" and creating the panning and zooming effect.  However, I clip the parts that are not visible.  For panning, I was hoping to do a OpenGL "transform" on the already visible portion (OpenGL has already rendered it), then convert some amount of data to fill in the blank spot, and finally do something like glDrawElements to do an OpenGL "render" to fill in the missing part.  Currently, I start from scratch every time I pan.  I was hoping to save CPU utilization by not wasting what was already drawn to the screen because the panning does not move the user view a dramatic amount (it does not move one full view every time the user hits the pan button).  Thanks.   