Sign in to follow this  
bencelot

My comp can't handle large textures,

Recommended Posts

Hey all.. I've been testing my game on a number of computers. Even on the oldest computer I have, the game runs at over 100fps. HOWEVER.. about a month ago I decided to add a background image to the menu. This is a 1024x768 sized texture, which is simply rendered to a quad that covers the whole screen. No problem at all for most of my computers.. but on my oldest computer, the fps dropped from ~350fps (in the menu) down to about 0.1fps. This is obviously a HUGE drop for rendering just 1 textured quad. The thing is.. this old computer can still run the actual game at over 100fps.. and the actual game is far more complex than the menu. On screen at any one time the map renders thousands of textured 32x32 tiles, called with glDrawElements. Furthermore, these tiles get their texture by referencing a small section of a 1024x1024 texture image. It seems that the only difference with the single textured quad for the menu system is that it's all happening at once, and is too large for the computers video card (NVIDIA GeForce FX 5700) to handle. Anyway, this wasn't too big a deal.. I just ditched the menu background image and moved on. But now the problem has returned. I'm generating shadows in 2D, copying the screen to a texture using glCopyTexSubImage2D, and then projecting these shadows onto the 3D map. Again.. it works fine on all my other computers.. but now the old computer has gone from over 100fps down to about 0.1fps again.. and I'm guessing it's because I'm using another large texture. I've updated the drivers, but it's still super slow. Are there just some graphics cards that can't support textures that are too large? And is there anything I can do about this? Thanks, Ben.

Share this post


Link to post
Share on other sites
As far as I know there is a maximum size for textures too. Modern graphic cards maximum size is 4900 x 4900 (correct me if I'm wrong). Older cards maybe much less maximum texture size.

Also take care that your textures dimensions match a power of 2. I've read that older graphic cards have problems if they don't do.

Share this post


Link to post
Share on other sites
Quote:
Original post by Eistoeter
As far as I know there is a maximum size for textures too. Modern graphic cards maximum size is 4900 x 4900 (correct me if I'm wrong). Older cards maybe much less maximum texture size.
That would be 4096x4096 for a typical modern card. You can find out the maximum size by calling glGetInteger() with an argument of GL_MAX_TEXTURE_SIZE.
Quote:
Also take care that your textures dimensions match a power of 2. I've read that older graphic cards have problems if they don't do.
Older cards will mostly just refuse to create Non-power-of-2 textures (note that gluBuild2DMipmaps will automatically convert your texture to power-of-2), or at least refuse to display them. Even fairly recent cards (such as my X1600, which is SM 3) can experience a severe performance drop if you use non-power-of-2 textures incorrectly.

Share this post


Link to post
Share on other sites
Genius!
This is why I love gamedev :)

It couldn't handle non 2^n dimensions. I checked the GL_MAX_TEXTURE_SIZE, and it was 4096.. but when I changed one of my existing textures from 1024x1024 to 1024x768, it slowed down.

So now the only question is.. if I'm copying the screen with glCopyTexSubImage2D (which could be any size as the window is resizable..) what would be the best way to get it into 2^n dimensions? Should I just expand out the image with blank pixels.. or is there some cool conversion I could make that's more cost effective?

Share this post


Link to post
Share on other sites
Quote:
Original post by bencelot
So now the only question is.. if I'm copying the screen with glCopyTexSubImage2D (which could be any size as the window is resizable..) what would be the best way to get it into 2^n dimensions? Should I just expand out the image with blank pixels.. or is there some cool conversion I could make that's more cost effective?
Blank pixels should do fine, unless you are strapped for VRAM.

You may also be able to use the ARB_texture_rectangle extension (a very limited predecessor to the current ARB_texture_non_power_of_two extension), and has to be used manually, with certain constraints such as pixel-based texture coordinates.

Share this post


Link to post
Share on other sites
As others have said just having blank pixels would be a good way to go and just use texture coords to get the right image. You could also use the 'blank' area for some sprites on the menu or something like that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this