SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
renderer_GLES_1.c
Go to the documentation of this file.
1 #include "SDL_gpu_GLES_1.h"
2 #include "SDL_gpu_RendererImpl.h"
3 
4 #if defined(SDL_GPU_DISABLE_GLES) || defined(SDL_GPU_DISABLE_GLES_1)
5 
6 // Dummy implementations
8 void GPU_FreeRenderer_GLES_1(GPU_Renderer* renderer) {}
9 
10 #else
11 
12 
13 // Most of the code pulled in from here...
14 #define SDL_GPU_USE_GLES
15 #define SDL_GPU_GL_TIER 2
16 #define SDL_GPU_GLES_MAJOR_VERSION 1
17 
18 #define SDL_GPU_USE_ARRAY_PIPELINE
19 #define SDL_GPU_DISABLE_TEXTURE_GETS
20 #define SDL_GPU_DISABLE_SHADERS
21 #define SDL_GPU_DISABLE_RENDER_TO_TEXTURE
22 #define SDL_GPU_APPLY_TRANSFORMS_TO_GL_STACK
23 #define SDL_GPU_NO_VAO
24 
25 #include "renderer_GL_common.inl"
27 
28 
30 {
31  GPU_Renderer* renderer = (GPU_Renderer*)SDL_malloc(sizeof(GPU_Renderer));
32  if(renderer == NULL)
33  return NULL;
34 
35  memset(renderer, 0, sizeof(GPU_Renderer));
36 
37  renderer->id = request;
38  renderer->id.renderer = GPU_RENDERER_GLES_1;
40  renderer->min_shader_version = 0;
41  renderer->max_shader_version = 0;
42 
43  renderer->default_image_anchor_x = 0.5f;
44  renderer->default_image_anchor_y = 0.5f;
45 
46  renderer->current_context_target = NULL;
47 
48  renderer->impl = (GPU_RendererImpl*)SDL_malloc(sizeof(GPU_RendererImpl));
49  memset(renderer->impl, 0, sizeof(GPU_RendererImpl));
50  SET_COMMON_FUNCTIONS(renderer->impl);
51 
52  return renderer;
53 }
54 
56 {
57  if(renderer == NULL)
58  return;
59 
60  SDL_free(renderer->impl);
61  SDL_free(renderer);
62 }
63 
64 #endif
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
GPU_Renderer * GPU_CreateRenderer_GLES_1(GPU_RendererID request)
#define SET_COMMON_FUNCTIONS(impl)
float default_image_anchor_y
Definition: SDL_gpu.h:674
void GPU_FreeRenderer_GLES_1(GPU_Renderer *renderer)
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