|
Title: Using OpenGL - Works fine on some computers, textures won't load on others Post by: Coriform on May 25, 2011, 10:06:08 AM 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? Title: Re: Using OpenGL - Works fine on some computers, textures won't load on others Post by: Nix on May 25, 2011, 10:27:10 AM How are you loading textures? You might want to just use something that's already cross-platform and tested like SFML. I use SFML's image loading functions and they work perfectly with OpenGL.
Title: Re: Using OpenGL - Works fine on some computers, textures won't load on others Post by: ThemsAllTook on May 25, 2011, 10:42:36 AM Are some of your texture sizes powers of two and some not? Non-power-of-two textures aren't supported everywhere.
Does glGetError() tell you anything? Title: Re: Using OpenGL - Works fine on some computers, textures won't load on others Post by: Coriform on May 25, 2011, 11:11:43 AM Are some of your texture sizes powers of two and some not? Non-power-of-two textures aren't supported everywhere. Does glGetError() tell you anything? glGetError() is reporting zeros all over. I tried messing around with some of the images - specifically, some of them are of dimensions that are not power-of-two. Wierd stuff happened. For example, I have my background image, like my other images, textured onto a polygon that is stretched to the dimensions of the level. So when I made a smaller background, on my dev machine it of course just stretched the texture like usual. However, on a different computer (specifically, the Vista pc) it acted as if all of the images were in the same buffer, and selected textures from a different part of the buffer. What I mean is, I use a spritesheet for the level tiles, and when I changed the background image, the player's animation started picking random spots from the tilesheet (this is opposed to the previous behavior which was to simply display nothing. Additionally, no change occurred with the background image. This is very puzzling. Title: Re: Using OpenGL - Works fine on some computers, textures won't load on others Post by: goshki on May 25, 2011, 11:37:39 AM This is very puzzling. Make sure that you have the latest graphics card drivers. Also, if you have the ability, try to test on more than one Vista/Win 2K machines. Title: Re: Using OpenGL - Works fine on some computers, textures won't load on others Post by: Coriform on May 25, 2011, 12:15:56 PM After more thorough investigation, I've determined this is a power-of-two issue. The commonality between the computers giving me problems was their age - they are running dated integrated graphics. After ensuring each of my source images had dimensions of power of 2, the problem was fixed. Apparently older video cards don't even render textures that are not represented by source images of the proper resolution.
Title: Re: Using OpenGL - Works fine on some computers, textures won't load on others Post by: Prinsessa on May 25, 2011, 12:27:21 PM After more thorough investigation, I've determined this is a power-of-two issue. The commonality between the computers giving me problems was their age - they are running dated integrated graphics. After ensuring each of my source images had dimensions of power of 2, the problem was fixed. Apparently older video cards don't even render textures that are not represented by source images of the proper resolution. I used to have this issue with Irrlicht, and my solution was to, during runtime, while the image was loaded, pad out the software image with invisible pixels until the image was the nearest power of two, and then used that. I think SFML does this for me, as I have never had any problems with SFML. It's a neat solution. |