SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
renderer_OpenGL_2.c
Go to the documentation of this file.
1 #include "SDL_gpu_OpenGL_2.h"
2 #include "SDL_gpu_RendererImpl.h"
3 
4 
5 #if defined(SDL_GPU_DISABLE_OPENGL) || defined(SDL_GPU_DISABLE_OPENGL_2)
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_USE_BUFFER_PIPELINE
16 #define SDL_GPU_ASSUME_SHADERS
17 #define SDL_GPU_GL_TIER 3
18 #define SDL_GPU_GLSL_VERSION 120
19 #define SDL_GPU_GL_MAJOR_VERSION 2
20 #define SDL_GPU_NO_VAO
21 
22 #include "renderer_GL_common.inl"
24 
25 
27 {
28  GPU_Renderer* renderer = (GPU_Renderer*)SDL_malloc(sizeof(GPU_Renderer));
29  if(renderer == NULL)
30  return NULL;
31 
32  memset(renderer, 0, sizeof(GPU_Renderer));
33 
34  renderer->id = request;
35  renderer->id.renderer = GPU_RENDERER_OPENGL_2;
37  renderer->min_shader_version = 110;
39 
40  renderer->default_image_anchor_x = 0.5f;
41  renderer->default_image_anchor_y = 0.5f;
42 
43  renderer->current_context_target = NULL;
44 
45  renderer->impl = (GPU_RendererImpl*)SDL_malloc(sizeof(GPU_RendererImpl));
46  memset(renderer->impl, 0, sizeof(GPU_RendererImpl));
47  SET_COMMON_FUNCTIONS(renderer->impl);
48 
49  return renderer;
50 }
51 
53 {
54  if(renderer == NULL)
55  return;
56 
57  SDL_free(renderer->impl);
58  SDL_free(renderer);
59 }
60 
61 
62 #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
#define SET_COMMON_FUNCTIONS(impl)
GPU_Renderer * GPU_CreateRenderer_OpenGL_2(GPU_RendererID request)
void GPU_FreeRenderer_OpenGL_2(GPU_Renderer *renderer)
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
#define SDL_GPU_GLSL_VERSION