quote:Original post by Brannon If you want to do that, then render to an offscreen surface, and then blit portions of that to the screen. This is of course assuming that you *can* render to an offscreen surface (not a backbuffer) and assuming that you dont lose the hardware acceleration if you do so.
Ok. How can I do this? It''s impossible in OpenGL to render an offscreen surface.. I have to use SDL to do it..or not?
quote:Original post by Brannon If you want to do that, then render to an offscreen surface, and then blit portions of that to the screen. This is of course assuming that you *can* render to an offscreen surface (not a backbuffer) and assuming that you dont lose the hardware acceleration if you do so.
That''s a horrible method. Even for a 2D API that''s not that great of a method. Simply use glTranslatef and (if not only) occlusion techiques to decide what and where you should render tiles. How are tiles hard? I don''t get it. They aren''t any harder in OpenGL than any other API; they''re barely any different!
How is that a horrible method? Back in the day (386/486/etc), re-drawing an entire screen every frame killed performance. You could get magnitudes of order better perf if you only redrew what changed (for 2D games).
I''m not suggesting you do that. OpenGL is designed (as far as I can tell) to redraw the entire screen each frame. So, use it as it was designed.
Sorry if you thought I was suggesting rendering to an offscreen surface. Dont do it. Redraw the screen.
On windows, you can render to a GDI surface (offscreen), and then blit it where ever you want. But you probably wont get hardware acceleration, since you are then using the generic MS OpenGL APIs, and not the video card driver''s APIs.
There is a way to render to an offscreen surface .. because you can render to a texture .. but I think it involves some nasty tricks.. something along the lines of rendering to the backbuffer, and then reading the pixels from the back buffer into your own buffer, that you then specify as a texture.
I wasn''t complaining about only redrawing a portion of the screen. I was refering to using an offscreen buffer and selecting a portion of it to draw each time. "Dirty rectangles" are still a viable technique in OpenGL, but offscreen buffers are more trouble than they''re worth.