Window to Fullscreen mode texture corruption

On OSX.5.6, I run in a windowed mode, and my textures are fine, I try
again with fullscreen and the textures are blocky and greyscale
looking? I am not switching the screen modes on the fly either, this
is hardcoded and run both modes.

Thanks

Do you have minimal application to show it?
I have the similar problem, want to get more tests…

Mars999 wrote:> On OSX.5.6, I run in a windowed mode, and my textures are fine, I try

again with fullscreen and the textures are blocky and greyscale looking?
I am not switching the screen modes on the fly either, this is hardcoded
and run both modes.

Thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

blocky and grayscale looking, hmm… sounds like:

A) Display gamma changed away from Mac OS’s default high ramp setting
to linear setting

B) resolution decreased, maybe even to a setting that is not a factor
of the native display resolutionOn Tue, Mar 24, 2009 at 4:51 AM, Mars999 wrote:

On OSX.5.6, I run in a windowed mode, and my textures are fine, I try again
with fullscreen and the textures are blocky and greyscale looking? I am not
switching the screen modes on the fly either, this is hardcoded and run both
modes.

Thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

Here is a screenshot of what it looks like.

http://img21.imageshack.us/my.php?image=picture1oix.pngOn Mar 24, 2009, at 4:33 AM, Dmytro Bogovych wrote:

Do you have minimal application to show it?
I have the similar problem, want to get more tests…

Mars999 wrote:

On OSX.5.6, I run in a windowed mode, and my textures are fine, I
try again with fullscreen and the textures are blocky and greyscale
looking? I am not switching the screen modes on the fly either,
this is hardcoded and run both modes.
Thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

2009/3/24 Mars999 :

Here is a screenshot of what it looks like.

http://img21.imageshack.us/my.php?image=picture1oix.png

That’s pretty awesome, but in fact not gray, the textures are
half-intensity RGB stripes, which get muddied together into gray.
Since I don’t know what your texture is supposed to look like
(apparently it isn’t gray, which is what I would have guessed had you
not complained that they now look gray) it looks like your textures
have somehow become corrupted.

Are those mountains in the background?

macless

You should probably provide code that reproduces this problem and tell
us more about your platform (GPU)–
http://codebad.com/

What I meant to say was that it looks like maybe the internal storage
format is different from what it should be. You should show us the
code you use to load the textures.On Tue, Mar 24, 2009 at 12:57 PM, Donny Viszneki <@Donny_Viszneki> wrote:

it looks like your textures have somehow become corrupted.


http://codebad.com/

HOw would that matter, when windowed mode uses the same code? TO load
the textures?On Mar 24, 2009, at 11:59 AM, Donny Viszneki wrote:

On Tue, Mar 24, 2009 at 12:57 PM, Donny Viszneki <donny.viszneki at gmail.com> wrote:

it looks like your textures have somehow become corrupted.

What I meant to say was that it looks like maybe the internal storage
format is different from what it should be. You should show us the
code you use to load the textures.


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It’s either a bug in your code, a bug in SDL, or a bug on the Mac
platform that might be worked around by SDL. Either way, bugs don’t
get fixed without being able to reproduce them. So far you are the
only one that has been able to produce it, it would seem.On Tue, Mar 24, 2009 at 1:00 PM, Mars999 wrote:

HOw would that matter, when windowed mode uses the same code? TO load the
textures?


http://codebad.com/

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height, 0, bgr ?
GL_BGR : GL_RGB, GL_UNSIGNED_BYTE, tex.tex->pixels);

tex is a sdlsurface

this code is the same for both fullscreen and windowed, and works
without problems on PC under Vista 64bit.On Mar 24, 2009, at 12:04 PM, Donny Viszneki wrote:

On Tue, Mar 24, 2009 at 1:00 PM, Mars999 <@Mars_999> wrote:

HOw would that matter, when windowed mode uses the same code? TO
load the
textures?

It’s either a bug in your code, a bug in SDL, or a bug on the Mac
platform that might be worked around by SDL. Either way, bugs don’t
get fixed without being able to reproduce them. So far you are the
only one that has been able to produce it, it would seem.


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That’s really not useful.

2009/3/24 Mars999 :> glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height, 0, bgr ? GL_BGR :

GL_RGB, GL_UNSIGNED_BYTE, tex.tex->pixels);
tex is a sdlsurface
this code is the same for both fullscreen and windowed, and works without
problems on PC under Vista 64bit.

On Mar 24, 2009, at 12:04 PM, Donny Viszneki wrote:

On Tue, Mar 24, 2009 at 1:00 PM, Mars999 wrote:

HOw would that matter, when windowed mode uses the same code? TO load the

textures?

It’s either a bug in your code, a bug in SDL, or a bug on the Mac
platform that might be worked around by SDL. Either way, bugs don’t
get fixed without being able to reproduce them. So far you are the
only one that has been able to produce it, it would seem.


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

Bah the limit has been hit…
I am sending this in two emails.

void NX::GLObject::TextureObject2D::Setup(const std::string& filename)
{
TextureLoader tex;
bool bgr = CheckChannelOrder(filename);
tex.Load(filename);
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, useMipmaps ?
GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR);
switch(channels)
{
case 1:
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, width, height, 0,
GL_LUMINANCE, GL_UNSIGNED_BYTE, tex.tex->pixels);
break;

	case 3:
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height, 0, bgr ?  

GL_BGR : GL_RGB, GL_UNSIGNED_BYTE, tex.tex->pixels);
break;

	case 4:
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, bgr ?  

GL_BGRA : GL_RGBA, GL_UNSIGNED_BYTE, tex.tex->pixels);
break;

	default:
		break;
}
if(useMipmaps)
	glGenerateMipmapEXT(GL_TEXTURE_2D);

}On Mar 24, 2009, at 7:44 AM, Donny Viszneki wrote:

blocky and grayscale looking, hmm… sounds like:

A) Display gamma changed away from Mac OS’s default high ramp setting
to linear setting

B) resolution decreased, maybe even to a setting that is not a factor
of the native display resolution

On Tue, Mar 24, 2009 at 4:51 AM, Mars999 <@Mars_999> wrote:

On OSX.5.6, I run in a windowed mode, and my textures are fine, I
try again
with fullscreen and the textures are blocky and greyscale looking?
I am not
switching the screen modes on the fly either, this is hardcoded and
run both
modes.

Thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

WEll sorry the second message isn’t coming until they approve it the
code is over 40k limitOn Mar 24, 2009, at 7:44 AM, Donny Viszneki wrote:

blocky and grayscale looking, hmm… sounds like:

A) Display gamma changed away from Mac OS’s default high ramp setting
to linear setting

B) resolution decreased, maybe even to a setting that is not a factor
of the native display resolution

On Tue, Mar 24, 2009 at 4:51 AM, Mars999 <@Mars_999> wrote:

On OSX.5.6, I run in a windowed mode, and my textures are fine, I
try again
with fullscreen and the textures are blocky and greyscale looking?
I am not
switching the screen modes on the fly either, this is hardcoded and
run both
modes.

Thanks


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Nowhere else to post it?On Tue, Mar 24, 2009 at 1:32 PM, Mars999 wrote:

WEll sorry the second message isn’t coming until they approve it the code is
over 40k limit


http://codebad.com/

You could just compress your code and attach it as a zip file…>________________________________

From: Mars999
Subject: Re: [SDL] Window to Fullscreen mode texture corruption

Bah the limit has been hit…
I am sending this in two emails.

http://rafb.net/p/pzRC7c80.htmlOn Mar 24, 2009, at 12:51 PM, Mason Wheeler wrote:

You could just compress your code and attach it as a zip file…


From: Mars999 <@Mars_999>
Subject: Re: [SDL] Window to Fullscreen mode texture corruption

Bah the limit has been hit…
I am sending this in two emails.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

There’s your problem. Depending on your display mode, tex will now
point to a surface of a different format. How exactly this leads to
your particular example of image corruption, I have not yet deduced.
This line however is the what makes the difference between two
different display modes.

A good question would be why you thought you had to include this line.On Tue, Mar 24, 2009 at 1:53 PM, Mars999 wrote:

tex = SDL_ConvertSurface(finalImage, finalImage->format, SDL_HWSURFACE);


http://codebad.com/

What am I talking about!? That isn’t SDL_DisplayFormat()!!!

Still, it should be unnecessary.On Tue, Mar 24, 2009 at 2:44 PM, Donny Viszneki <@Donny_Viszneki> wrote:

On Tue, Mar 24, 2009 at 1:53 PM, Mars999 wrote:

tex = SDL_ConvertSurface(finalImage, finalImage->format, SDL_HWSURFACE);

There’s your problem. Depending on your display mode, tex will now
point to a surface of a different format.


http://codebad.com/

Mars999 wrote:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height, 0, bgr ? GL_BGR :
GL_RGB, GL_UNSIGNED_BYTE, tex.tex->pixels);

tex is a sdlsurface

The first thing that comes to mind is that the pixel format of the sdl
surface differs between windowed and full-screen mode. Examine tex->format.

Also, don’t forget to respect tex->pitch.–
Rainer Deyke - rainerd at eldwood.com

Mars999, your problem is that you’re not telling OpenGL the right
format for the source surface. You’re using hardware surfaces and don’t
expect their format to change. The format of hardware surfaces depends
on the current videomode, so that explains why your problem only occurs
in fullscreen mode. By looking at your screenshot it looks like your
fullscreen surface format has 32-bit pixels, while you’re telling
OpenGL it’s 24-bit, so the RGB(A) data of every pixel is shifted for
every pixel (R becomes G, etc).

One solution is to just not use hardware surfaces in the first place.
Using hardware surfaces for making OpenGL textures doesn’t make sense
anyway, it just makes things slower. (Also, you should probably take
into account the surface pitch, unless you can ensure that pitch ==
width*bpp. Look up glTexImage2D/glPixelStore here for details about
pixel access and such: http://www.opengl.org/sdk/docs/man/ )

  • Gerry

Den Tue, 24 Mar 2009 12:53:46 -0500
skrev Mars999 :> http://rafb.net/p/pzRC7c80.html

On Mar 24, 2009, at 12:51 PM, Mason Wheeler wrote:

You could just compress your code and attach it as a zip file…


From: Mars999
Subject: Re: [SDL] Window to Fullscreen mode texture corruption

Bah the limit has been hit…
I am sending this in two emails.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 32);

This is my setup for GL under SDL…I ask for a 32bit framebufffer on
both fullscreen, and windowed modes.

Gerry JJ wrote:> Mars999, your problem is that you’re not telling OpenGL the right

format for the source surface. You’re using hardware surfaces and don’t
expect their format to change. The format of hardware surfaces depends
on the current videomode, so that explains why your problem only occurs
in fullscreen mode. By looking at your screenshot it looks like your
fullscreen surface format has 32-bit pixels, while you’re telling
OpenGL it’s 24-bit, so the RGB(A) data of every pixel is shifted for
every pixel (R becomes G, etc).

One solution is to just not use hardware surfaces in the first place.
Using hardware surfaces for making OpenGL textures doesn’t make sense
anyway, it just makes things slower. (Also, you should probably take
into account the surface pitch, unless you can ensure that pitch ==
width*bpp. Look up glTexImage2D/glPixelStore here for details about
pixel access and such: http://www.opengl.org/sdk/docs/man/ )

  • Gerry

Den Tue, 24 Mar 2009 12:53:46 -0500
skrev Mars999 <@Mars_999>:

http://rafb.net/p/pzRC7c80.html

On Mar 24, 2009, at 12:51 PM, Mason Wheeler wrote:

You could just compress your code and attach it as a zip file…


From: Mars999 <@Mars_999>
Subject: Re: [SDL] Window to Fullscreen mode texture corruption

Bah the limit has been hit…
I am sending this in two emails.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org