Sign in to follow this  
Coriform

OpenGL Some textures not loading on different computers

Recommended Posts

I've come across a strange problem. I am building a 2D game engine using C++, SDL, and OpenGL. Everything works fine on my primary development machine. However, if I try to run the application on various other computers (I tried a Win2K machine and a Win Vista machine) some textures don't load, and it's not consistant. Here's the breakdown of results on my available computers:
Windows 7 - everything (background, level tiles, player, cursor) is fine.
Windows Vista - only level tiles show
Windows 2K - only level tiles and mouse cursor image display
Ubuntu - everything is fine.

I've compiled under Visual Studio and mingw for all Windows machines.


At first I thought that maybe the primitive values could be producing incorrect texture IDs, but I checked and all textuers are stored as GLuints, which are platform agnostic.

Any idea as to why different computers would produce different results, regarding texture rendering?

Share this post


Link to post
Share on other sites
I was going to say that you are using NPOT textures and that you aren't checking for NPOT support but since it is random, it must be something else.
Are you using shaders? GLSL?

Share this post


Link to post
Share on other sites
Platform (or any other software-related consideration) is more or less completely irrelevant for this kind of thing; you're coding to hardware so (assuming that your own code is fundamentally sound) it's all down to drivers and hardware. Have you collected any info on what kind of display adapters these machines have?

Share this post


Link to post
Share on other sites
[quote name='mhagain' timestamp='1306357768' post='4815770']
Platform (or any other software-related consideration) is more or less completely irrelevant for this kind of thing; you're coding to hardware so (assuming that your own code is fundamentally sound) it's all down to drivers and hardware. Have you collected any info on what kind of display adapters these machines have?
[/quote]

I was able to determine the problem - it was a "power-of-two" issue. The computers giving me funny results are both very old, with dated graphics controllers. While not typically a problem, OpenGL on older cards appears to have difficulty displaying textures that have dimensions not divisible by 2^x. I was able to fix this problem by correcting my source image resolution.

Share this post


Link to post
Share on other sites
[quote name='Coriform' timestamp='1306361424' post='4815792']
OpenGL on older cards appears to have difficulty displaying textures that have dimensions not divisible by 2^x.[/quote]

Until nobody nowhere else use that kind of hardware anymore that will still be the standard for me. :)

Share this post


Link to post
Share on other sites
In this kind of case, if you're not mipmapping or repeating the textures (which can make things more complex - not unsolvable, just more complex) you can resolve it by adding some padding around the texture to make it a power of two, and adjusting texcoords to match. This is often preferable to resampling the texture (which can blur finer detail too much). There is a cost in extra video RAM usage but it shouldn't be a problem on today's (or even older) hardware. Packing textures into a texture atlas can also help.

Share this post


Link to post
Share on other sites
[quote name='Coriform' timestamp='1306346603' post='4815690']
I've come across a strange problem. ...
[/quote]

Also, you should read about NPOT
http://www.opengl.org/wiki/NPOT_Texture

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