SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
renderer_OpenGL_1_BASE.c
Go to the documentation of this file.
2 #include "SDL_gpu_RendererImpl.h"
3 
4 
5 #if defined(SDL_GPU_DISABLE_OPENGL) || defined(SDL_GPU_DISABLE_OPENGL_1_BASE)
6 
7 // Dummy implementations
10 
11 #else
12 
13 // Most of the code pulled in from here...
14 #define SDL_GPU_USE_OPENGL
15 #define SDL_GPU_DISABLE_SHADERS
16 #define SDL_GPU_DISABLE_RENDER_TO_TEXTURE
17 #define SDL_GPU_USE_FIXED_FUNCTION_PIPELINE
18 #define SDL_GPU_GL_TIER 1
19 #define SDL_GPU_GL_MAJOR_VERSION 1
20 #define SDL_GPU_APPLY_TRANSFORMS_TO_GL_STACK
21 #define SDL_GPU_NO_VAO
22 
23 #include "renderer_GL_common.inl"
25 
26 
28 {
29  GPU_Renderer* renderer = (GPU_Renderer*)SDL_malloc(sizeof(GPU_Renderer));
30  if(renderer == NULL)
31  return NULL;
32 
33  memset(renderer, 0, sizeof(GPU_Renderer));
34 
35  renderer->id = request;
36  renderer->id.renderer = GPU_RENDERER_OPENGL_1_BASE;
38  renderer->min_shader_version = 0;
39  renderer->max_shader_version = 0;
40 
41  renderer->default_image_anchor_x = 0.5f;
42  renderer->default_image_anchor_y = 0.5f;
43 
44  renderer->current_context_target = NULL;
45 
46  renderer->impl = (GPU_RendererImpl*)SDL_malloc(sizeof(GPU_RendererImpl));
47  memset(renderer->impl, 0, sizeof(GPU_RendererImpl));
48  SET_COMMON_FUNCTIONS(renderer->impl);
49 
50  return renderer;
51 }
52 
54 {
55  if(renderer == NULL)
56  return;
57 
58  SDL_free(renderer->impl);
59  SDL_free(renderer);
60 }
61 
62 #endif
void GPU_FreeRenderer_OpenGL_1_BASE(GPU_Renderer *renderer)
GPU_RendererID id
Definition: SDL_gpu.h:656
int max_shader_version
Definition: SDL_gpu.h:663
GPU_Target * current_context_target
Definition: SDL_gpu.h:667
GPU_ShaderLanguageEnum shader_language
Definition: SDL_gpu.h:661
#define SET_COMMON_FUNCTIONS(impl)
GPU_Renderer * GPU_CreateRenderer_OpenGL_1_BASE(GPU_RendererID request)
float default_image_anchor_y
Definition: SDL_gpu.h:674
int min_shader_version
Definition: SDL_gpu.h:662
struct GPU_RendererImpl * impl
Definition: SDL_gpu.h:676
float default_image_anchor_x
Definition: SDL_gpu.h:673
GPU_RendererEnum renderer
Definition: SDL_gpu.h:122