View Full Version : Best way to move object over 2D static scene ???
I'm writing a 2D application.
The computation of my scene needs too much time. And it's flashy when I try to move
an 'object' over the scene. I use a lot of bitmap in my scene.
My question is, isn't it possible to do those steps ?
1. Render the scene in an image first
2. For each object'move, displaying the image and draw over it the object in its recalculated position (only the object should be recalculated)
If it's possible, how can I do ?
Or, are there best ways ?
Thanks a lot for your answers.
Well, I'm not sure if I understand your question, but it SOUNDS like you are saying it's flickering (flashy), and, you want a way to render it off-screen first, to make it not flicker. Are you looking to use Double Buffering? OpenGL has functionality to draw to a buffer, then swap the buffers, and clear and redraw the back buffer. I don't know the function calls off the top of my head.
Thank you for your answer.
Yes, I'm already using double buffering.
I guess I have found a solution.
I will process 'the scene' in the buffer
whithout the object in motion and with glReadPixel I'll store the image in memory.
Each time the object moves, I will copy the 'scene image' from memory to the buffer
and draw over it only the recalculated object in motion.
Could you say me if it's a good idea ?
09-27-2001, 05:14 AM
This sounds as the right approach. Depending on how often the static image changes etc, you may find other ways of doing it which are faster, but the principle is good (I think).
My suggestion for the "re-writing" of the 2D background would be to upload the image to the card as a texture (or several textures, depending on the maximum texture size of the card), that way you don't have to upload it to the card over the AGP bus every frame - only when it changes => speedup.
...actually, there is another cool technique which you may find useful (?), depending on what you want to do. You can render 6 views of your scene (front, back, up, down, right, left), all from the same point in space. If the observer is placed exactly in that point in space, it is possible to draw the six views on a surrounding cube, and rotating the cube as the observer "turns its head around". This gives a 100% correct 3D view of the scene, and it gives the impression of "real-time" rendering. The only problem is that the six textures roughly have to be as large as the entire screen (in resolution), which eats a lot of video memory (with some simple logic you can reduce the number of tetxures to store in video ram to three).
[This message has been edited by marcus256 (edited 09-27-2001).]
Thank you for your help.
I'll try that later.
Now I have a printing problem. :-)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.