sdl_gpu blit strangeness

Not sure if this is the right place, but if not, I’ll delete it… I’m assuming there are some people using sdl_gpu here :slight_smile:

So I have a GPU_Image loaded into ‘tile’ - and if I dump ‘tile’ via GPU_CopySurfaceFromImage() and SDL_SaveBMP(), then the resulting image looks just the same as the original source. I’m happy that ‘tile’ is ok.

Then I have some code:

	_bg = GPU_CreateImage(W, H, GPU_FORMAT_RGBA);
	GPU_Target *target = GPU_GetTarget(_bg);

	tile->anchor_x		= 0;
	tile->anchor_y		= 0;
	int w = tile->w;
	int h = tile->h;
	for (int y=0; y<H; y+=h)
		for (int x=0; x<W; x+=w)
			GPU_Blit(tile, NULL, target, x, y);

… and the resulting ‘_bg’ image looks … washed out. Testing with a bright tile like:

… the resulting tiled _bg looks like:

I’m wondering if there is something I have to add to the code above, or if it’s perhaps a color-space issue, or anyone got any better ideas ?

Cheers :slight_smile:

Replying to oneself may be poor form, but I figure it’s better to post a solution than delete the post…

I had to call GPU_SetBlending(tile, false) before blotting with it. I’d originally thought it wasn’t blending because the color variation didn’t seem to be linear, but apparently it was. The tiled ‘_bg’ looks just the same as the input ‘tile’ image now :slight_smile:

Cool! Glad you got it. I was going to say it looked like blending was happening.