Skip to main content
gamedev.net
🔒 Locked

2D Optimizations

Started by eXt_ Mar 11, 2008 at 8:36 PM 2 replies 950+ views
Original Post
eXt_
eXt_
Hi, I have coded a little application with opengl that swaps a couple of images with a nice fading transition. I would however want to optimize this application as much as possible, the transition part especially. It works like this, during initialization I disable depth testing and lighting and enable blending and alpha_testing. I also set the projection matrix to an 2d orthogonal matrix. When I load the images I resize them to 1024x1024 and convert them to 24bits and load the texture with the same settings and with linear filtering. (I assume the images has the same aspect ratio as the screen) When I render the transition I draw two screen aligned quads (one for each texture). The first is always drawn with color 1,1,1,1 but the second has the alpha depend on how far the transition has gone. I never clear the scene, I just redraw it. But even with quite a new graphics card (geforce 7600) it is a bit slow. The fading is not as smooth as I want it to be. So, is there any more tricks that I can do to make this faster?
V-man
V-man
Quote:
I never clear the scene, I just redraw it.

I suggest you call glClear at the beginning, always.

Quote:
But even with quite a new graphics card (geforce 7600) it is a bit slow. The fading is not as smooth as I want it to be. So, is there any more tricks that I can do to make this faster?

Perhaps you are upload the texture every frame?
It's hard to guess what you are doing.
eXt_
eXt_
Quote:
Original post by V-man
I suggest you call glClear at the beginning, always.


Why? I see no reason to clear the buffers.

Quote:
Original post by V-man
Perhaps you are upload the texture every frame?
It's hard to guess what you are doing.


No, I only upload the texture before the transition starts. I'm just wondering if there is some tricks that might make the application perform faster in my case. For instance, I don't need depth testing so I disabled it.

It doesn't run slow, but still not the performance I would expect. As an experiment I'm running it on a geforce 5200 now and at 800x600 I only have ~20 fps during the transition.
dmatter
dmatter
Quote:
Original post by eXt_
Quote:
Original post by V-man
I suggest you call glClear at the beginning, always.


Why? I see no reason to clear the buffers.

You don't need to do it every frame but do it at-least once in the application prior to rendering, in an initialisation stage for example.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.