this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Changed GPU_CopyImage() implementation to do a blit to the new image's FBO. This of course won't work without FBO support... Couldn't get glCopyTexImage2D() to work.

+31 -9
-4
SDL_gpu/GL_common/SDL_gpuShapes_GL_common.inl
··· 135 135 136 136 static void Arc(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color) 137 137 { 138 - float originalSA = start_angle; 139 - 140 138 if(start_angle > end_angle) 141 139 { 142 140 float swapa = end_angle; ··· 202 200 203 201 static void ArcFilled(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color) 204 202 { 205 - float originalSA = start_angle; 206 - 207 203 if(start_angle > end_angle) 208 204 { 209 205 float swapa = end_angle;
+31 -5
SDL_gpu/GL_common/SDL_gpu_GL_common.inl
··· 1514 1514 gl_format = GL_RGB; 1515 1515 channels = 3; 1516 1516 break; 1517 + default: 1518 + GPU_PushErrorCode("GPU_CreateUninitializedImage", GPU_ERROR_DATA_ERROR, "Unsupported image format (%x)", format); 1519 + return NULL; 1517 1520 } 1518 1521 1519 1522 if(channels < 1 || channels > 4) ··· 2311 2314 if(image == NULL) 2312 2315 return NULL; 2313 2316 2314 - GPU_Image* result = CreateUninitializedImage(renderer, image->w, image->h, image->format); 2317 + GPU_Image* result = renderer->CreateImage(renderer, image->w, image->h, image->format); 2315 2318 if(result == NULL) 2319 + { 2320 + GPU_PushErrorCode("GPU_CopyImage", GPU_ERROR_BACKEND_ERROR, "Failed to create new image."); 2316 2321 return NULL; 2322 + } 2317 2323 2318 - SDL_Surface* surface = renderer->CopySurfaceFromImage(renderer, image); 2319 - if(surface == NULL) 2324 + GPU_Target* target = GPU_LoadTarget(result); 2325 + if(target == NULL) 2326 + { 2327 + GPU_FreeImage(result); 2328 + GPU_PushErrorCode("GPU_CopyImage", GPU_ERROR_BACKEND_ERROR, "Failed to load target."); 2320 2329 return NULL; 2330 + } 2321 2331 2322 - InitImageWithSurface(renderer, result, surface); 2332 + // For some reason, I wasn't able to get glCopyTexImage2D() or glCopyTexSubImage2D() working without getting GL_INVALID_ENUM (0x500). 2333 + // It seemed to only work for the default framebuffer... 2334 + 2335 + // Clear the color, blending, and filter mode 2336 + SDL_Color color = image->color; 2337 + Uint8 use_blending = image->use_blending; 2338 + GPU_FilterEnum filter_mode = image->filter_mode; 2339 + GPU_SetColor(image, NULL); 2340 + GPU_SetBlending(image, 0); 2341 + GPU_SetImageFilter(image, GPU_NEAREST); 2342 + 2343 + renderer->Blit(renderer, image, NULL, target, image->w/2, image->h/2); 2323 2344 2324 - SDL_FreeSurface(surface); 2345 + // Restore the saved settings 2346 + GPU_SetColor(image, &color); 2347 + GPU_SetBlending(image, use_blending); 2348 + GPU_SetImageFilter(image, filter_mode); 2349 + 2350 + GPU_FreeTarget(target); 2325 2351 2326 2352 return result; 2327 2353 }