thegeneralsolution's picture

Only Powers of 2 Textures working in Screensaver

(Modified from my original post)

I am using OpenTK's TexLib for my texture loading (http://www.opentk.com/project/TexLib). Never had any trouble with it.

I am experiencing a weird issue. When I compile my application to an exe and run it, textures of any shape and size work just fine. Renaming the exe to an "scr" extension (to make it a screensaver) works perfectly fine on most machines, but on a handful of PCs, the textures fail to load unless their dimensions are exactly powers of 2. (32,64,128,256, etc.) But the problem only exists when running as a screensaver. If I rename the screensaver to an exe, the textures load fine, regardless of size.

Why would the application being run as an screensaver cause this strange behavior? Any ideas on how I can circumvent this issue? My screensaver allows user uploaded textures so I'd rather not mandate a "powers of 2" requirement on the texture dimensions.

Thanks!


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture
Quote:

Why would the application being run as an screensaver cause this strange behavior? Any ideas on how I can circumvent this issue? My screensaver allows user uploaded textures so I'd rather not mandate a "powers of 2" requirement on the texture dimensions.

Intel drivers disable hardware acceleration on screensavers for stability reasons. The software accelerated driver only supports power-of-two textures.

I do not know if there is a workaround to get hardware acceleration, but what you can do is detect whether NPOT textures are supported and resize the user texture if not.

Edit: you could also use the Mesa3d software renderer which supports OpenGL 3.3. Depending on the complexity of your screensaver, this might be a feasible solution.

thegeneralsolution's picture

Thank you for your prompt and clear answer, The Fiddler. How could I detect if NPOT textures are supported?

the Fiddler's picture

Check if the "GL_ARB_texture_non_power_of_two" extension is supported. In a compatibility context you'd do:

public bool HasNpot { get; private set; }
 
protected override void OnLoad(EventArgs e)
{
    var extensions = GL.GetString(StringName.Extensions).Split(" ");
    HasNpot = extensions.Contains("GL_ARB_texture_non_power_of_two"));
}