diff options
author | Mike Pavone <pavone@retrodev.com> | 2013-10-28 19:37:30 -0700 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2013-10-28 19:37:30 -0700 |
commit | da665eb04a793552ed32ed8944dffbeb5220d7ae (patch) | |
tree | 5532dd1d7f8e0d4f43d469f7823a5a3d9ccbfc1c /render_sdl.c | |
parent | 070b44e5440b966f911ee974490c7c99c91ec3d1 (diff) |
Allow OpenGL support to be disabled at compile time. Move generic utility functions out of config.c
Diffstat (limited to 'render_sdl.c')
-rw-r--r-- | render_sdl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/render_sdl.c b/render_sdl.c index 3c01eeb..f4241fc 100644 --- a/render_sdl.c +++ b/render_sdl.c @@ -97,6 +97,7 @@ uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) } } +#ifndef DISABLE_OPENGL GLuint textures[3], buffers[2], vshader, fshader, program, un_textures[2], at_pos; const GLfloat vertex_data[] = { @@ -142,9 +143,11 @@ GLuint load_shader(char * fname, GLenum shader_type) } return ret; } +#endif void render_alloc_surfaces(vdp_context * context) { +#ifndef DISABLE_OPENGL if (render_gl) { context->oddbuf = context->framebuf = malloc(320 * 240 * 4 * 2); memset(context->oddbuf, 0, 320 * 240 * 4 * 2); @@ -185,9 +188,12 @@ void render_alloc_surfaces(vdp_context * context) un_textures[1] = glGetUniformLocation(program, "textures[1]"); at_pos = glGetAttribLocation(program, "pos"); } else { +#endif context->oddbuf = context->framebuf = malloc(320 * 240 * screen->format->BytesPerPixel * 2); context->evenbuf = ((char *)context->oddbuf) + 320 * 240 * screen->format->BytesPerPixel; +#ifndef DISABLE_OPENGL } +#endif } uint8_t render_depth() @@ -320,7 +326,7 @@ void render_init(int width, int height, char * title, uint32_t fps, uint8_t full } SDL_JoystickEventState(SDL_ENABLE); } - +#ifndef DISABLE_OPENGL void render_context_gl(vdp_context * context) { glBindTexture(GL_TEXTURE_2D, textures[context->framebuf == context->oddbuf ? 0 : 1]); @@ -353,6 +359,7 @@ void render_context_gl(vdp_context * context) context->framebuf = context->framebuf == context->oddbuf ? context->evenbuf : context->oddbuf; } } +#endif uint32_t blankbuf[320*240]; @@ -362,11 +369,13 @@ void render_context(vdp_context * context) uint32_t *buf_32; uint8_t b,g,r; last_frame = SDL_GetTicks(); +#ifndef DISABLE_OPENGL if (render_gl) { render_context_gl(context); return; } +#endif if (SDL_MUSTLOCK(screen)) { if (SDL_LockSurface(screen) < 0) { return; |