2008-09-02 00:37:04 +00:00
|
|
|
/*
|
|
|
|
SDL - Simple DirectMedia Layer
|
2010-01-24 21:10:53 +00:00
|
|
|
Copyright (C) 1997-2010 Sam Lantinga
|
2008-09-02 00:37:04 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
Sam Lantinga
|
|
|
|
slouken@libsdl.org
|
|
|
|
*/
|
|
|
|
#include "SDL_config.h"
|
|
|
|
|
2011-02-08 10:04:09 -08:00
|
|
|
#if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
|
2008-09-02 00:37:04 +00:00
|
|
|
|
|
|
|
#include "SDL_opengles.h"
|
2011-02-02 14:34:54 -08:00
|
|
|
#include "../SDL_sysrender.h"
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2011-02-01 21:40:03 -08:00
|
|
|
#if defined(SDL_VIDEO_DRIVER_PANDORA)
|
2009-06-05 07:30:51 +00:00
|
|
|
|
|
|
|
/* Empty function stub to get OpenGL ES 1.x support without */
|
|
|
|
/* OpenGL ES extension GL_OES_draw_texture supported */
|
2009-05-31 11:53:12 +00:00
|
|
|
GL_API void GL_APIENTRY
|
|
|
|
glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-06-05 07:30:51 +00:00
|
|
|
|
2011-02-01 21:40:03 -08:00
|
|
|
#endif /* PANDORA */
|
2009-05-31 11:53:12 +00:00
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
/* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
|
|
|
|
|
2011-02-02 14:34:54 -08:00
|
|
|
/* Used to re-create the window with OpenGL capability */
|
|
|
|
extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
|
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
static const float inv255f = 1.0f / 255.0f;
|
|
|
|
|
|
|
|
static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
|
2011-02-01 19:19:43 -08:00
|
|
|
static void GLES_WindowEvent(SDL_Renderer * renderer,
|
|
|
|
const SDL_WindowEvent *event);
|
2008-09-02 00:37:04 +00:00
|
|
|
static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
|
|
|
|
static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
2008-09-15 04:32:36 +00:00
|
|
|
const SDL_Rect * rect, const void *pixels,
|
|
|
|
int pitch);
|
2008-09-02 00:37:04 +00:00
|
|
|
static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
2011-02-03 00:19:40 -08:00
|
|
|
const SDL_Rect * rect, void **pixels, int *pitch);
|
2008-09-15 04:32:36 +00:00
|
|
|
static void GLES_UnlockTexture(SDL_Renderer * renderer,
|
|
|
|
SDL_Texture * texture);
|
2011-02-07 20:06:26 -08:00
|
|
|
static void GLES_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect);
|
2010-01-13 04:58:31 +00:00
|
|
|
static int GLES_RenderDrawPoints(SDL_Renderer * renderer,
|
|
|
|
const SDL_Point * points, int count);
|
|
|
|
static int GLES_RenderDrawLines(SDL_Renderer * renderer,
|
|
|
|
const SDL_Point * points, int count);
|
|
|
|
static int GLES_RenderFillRects(SDL_Renderer * renderer,
|
|
|
|
const SDL_Rect ** rects, int count);
|
2008-09-02 00:37:04 +00:00
|
|
|
static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
2008-09-15 04:32:36 +00:00
|
|
|
const SDL_Rect * srcrect,
|
|
|
|
const SDL_Rect * dstrect);
|
2008-09-02 00:37:04 +00:00
|
|
|
static void GLES_RenderPresent(SDL_Renderer * renderer);
|
2008-09-15 04:32:36 +00:00
|
|
|
static void GLES_DestroyTexture(SDL_Renderer * renderer,
|
|
|
|
SDL_Texture * texture);
|
2008-09-02 00:37:04 +00:00
|
|
|
static void GLES_DestroyRenderer(SDL_Renderer * renderer);
|
|
|
|
|
|
|
|
|
2011-02-06 00:00:13 -08:00
|
|
|
SDL_RenderDriver GLES_RenderDriver = {
|
2008-09-02 00:37:04 +00:00
|
|
|
GLES_CreateRenderer,
|
|
|
|
{
|
2011-02-06 00:48:41 -08:00
|
|
|
"opengles",
|
|
|
|
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
|
2011-02-03 00:19:40 -08:00
|
|
|
1,
|
|
|
|
{SDL_PIXELFORMAT_ABGR8888},
|
2008-09-15 04:32:36 +00:00
|
|
|
0,
|
2008-09-02 00:37:04 +00:00
|
|
|
0}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
SDL_GLContext context;
|
|
|
|
SDL_bool updateSize;
|
|
|
|
int blendMode;
|
2008-09-15 04:32:36 +00:00
|
|
|
|
|
|
|
SDL_bool useDrawTexture;
|
|
|
|
SDL_bool GL_OES_draw_texture_supported;
|
2008-09-02 00:37:04 +00:00
|
|
|
} GLES_RenderData;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GLuint texture;
|
|
|
|
GLenum type;
|
|
|
|
GLfloat texw;
|
|
|
|
GLfloat texh;
|
|
|
|
GLenum format;
|
|
|
|
GLenum formattype;
|
|
|
|
void *pixels;
|
|
|
|
int pitch;
|
|
|
|
} GLES_TextureData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
GLES_SetError(const char *prefix, GLenum result)
|
|
|
|
{
|
|
|
|
const char *error;
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
case GL_NO_ERROR:
|
|
|
|
error = "GL_NO_ERROR";
|
|
|
|
break;
|
|
|
|
case GL_INVALID_ENUM:
|
|
|
|
error = "GL_INVALID_ENUM";
|
|
|
|
break;
|
|
|
|
case GL_INVALID_VALUE:
|
|
|
|
error = "GL_INVALID_VALUE";
|
|
|
|
break;
|
|
|
|
case GL_INVALID_OPERATION:
|
|
|
|
error = "GL_INVALID_OPERATION";
|
|
|
|
break;
|
|
|
|
case GL_STACK_OVERFLOW:
|
|
|
|
error = "GL_STACK_OVERFLOW";
|
|
|
|
break;
|
|
|
|
case GL_STACK_UNDERFLOW:
|
|
|
|
error = "GL_STACK_UNDERFLOW";
|
|
|
|
break;
|
|
|
|
case GL_OUT_OF_MEMORY:
|
|
|
|
error = "GL_OUT_OF_MEMORY";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error = "UNKNOWN";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SDL_SetError("%s: %s", prefix, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
SDL_Renderer *
|
|
|
|
GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|
|
|
{
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
SDL_Renderer *renderer;
|
|
|
|
GLES_RenderData *data;
|
|
|
|
GLint value;
|
2011-02-02 14:34:54 -08:00
|
|
|
Uint32 window_flags;
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2011-02-02 14:34:54 -08:00
|
|
|
window_flags = SDL_GetWindowFlags(window);
|
|
|
|
if (!(window_flags & SDL_WINDOW_OPENGL)) {
|
|
|
|
if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) {
|
2008-09-02 00:37:04 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
|
|
|
|
if (!renderer) {
|
|
|
|
SDL_OutOfMemory();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = (GLES_RenderData *) SDL_calloc(1, sizeof(*data));
|
|
|
|
if (!data) {
|
|
|
|
GLES_DestroyRenderer(renderer);
|
|
|
|
SDL_OutOfMemory();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
renderer->WindowEvent = GLES_WindowEvent;
|
2008-09-02 00:37:04 +00:00
|
|
|
renderer->CreateTexture = GLES_CreateTexture;
|
|
|
|
renderer->UpdateTexture = GLES_UpdateTexture;
|
|
|
|
renderer->LockTexture = GLES_LockTexture;
|
|
|
|
renderer->UnlockTexture = GLES_UnlockTexture;
|
2011-02-07 20:06:26 -08:00
|
|
|
renderer->SetClipRect = GLES_SetClipRect;
|
2010-01-13 04:58:31 +00:00
|
|
|
renderer->RenderDrawPoints = GLES_RenderDrawPoints;
|
|
|
|
renderer->RenderDrawLines = GLES_RenderDrawLines;
|
|
|
|
renderer->RenderFillRects = GLES_RenderFillRects;
|
2008-09-02 00:37:04 +00:00
|
|
|
renderer->RenderCopy = GLES_RenderCopy;
|
|
|
|
renderer->RenderPresent = GLES_RenderPresent;
|
|
|
|
renderer->DestroyTexture = GLES_DestroyTexture;
|
|
|
|
renderer->DestroyRenderer = GLES_DestroyRenderer;
|
2011-02-06 00:00:13 -08:00
|
|
|
renderer->info = GLES_RenderDriver.info;
|
2008-09-02 00:37:04 +00:00
|
|
|
renderer->driverdata = data;
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-01 12:19:46 -08:00
|
|
|
renderer->info.flags = SDL_RENDERER_ACCELERATED;
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2011-02-06 10:22:25 -08:00
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
|
|
|
|
2010-01-21 07:28:01 +00:00
|
|
|
data->context = SDL_GL_CreateContext(window);
|
2008-09-02 00:37:04 +00:00
|
|
|
if (!data->context) {
|
|
|
|
GLES_DestroyRenderer(renderer);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-01-21 07:28:01 +00:00
|
|
|
if (SDL_GL_MakeCurrent(window, data->context) < 0) {
|
2008-09-02 00:37:04 +00:00
|
|
|
GLES_DestroyRenderer(renderer);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SDL_RENDERER_PRESENTVSYNC) {
|
|
|
|
SDL_GL_SetSwapInterval(1);
|
|
|
|
} else {
|
|
|
|
SDL_GL_SetSwapInterval(0);
|
|
|
|
}
|
|
|
|
if (SDL_GL_GetSwapInterval() > 0) {
|
|
|
|
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
|
|
|
}
|
|
|
|
|
2009-05-31 11:53:12 +00:00
|
|
|
#if SDL_VIDEO_DRIVER_PANDORA
|
|
|
|
data->GL_OES_draw_texture_supported = SDL_FALSE;
|
|
|
|
data->useDrawTexture = SDL_FALSE;
|
|
|
|
#else
|
2008-09-15 04:32:36 +00:00
|
|
|
if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) {
|
|
|
|
data->GL_OES_draw_texture_supported = SDL_TRUE;
|
|
|
|
data->useDrawTexture = SDL_TRUE;
|
|
|
|
} else {
|
|
|
|
data->GL_OES_draw_texture_supported = SDL_FALSE;
|
|
|
|
data->useDrawTexture = SDL_FALSE;
|
|
|
|
}
|
2009-05-31 11:53:12 +00:00
|
|
|
#endif
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
|
2008-09-02 00:37:04 +00:00
|
|
|
renderer->info.max_texture_width = value;
|
2011-02-06 02:35:14 -08:00
|
|
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
|
2008-09-02 00:37:04 +00:00
|
|
|
renderer->info.max_texture_height = value;
|
|
|
|
|
|
|
|
/* Set up parameters for rendering */
|
|
|
|
data->blendMode = -1;
|
2011-02-06 02:35:14 -08:00
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
glDisable(GL_CULL_FACE);
|
2008-09-02 00:37:04 +00:00
|
|
|
data->updateSize = SDL_TRUE;
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
2011-01-19 23:56:16 -08:00
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
return renderer;
|
|
|
|
}
|
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
static SDL_GLContext SDL_CurrentContext = NULL;
|
|
|
|
|
2008-09-15 04:32:36 +00:00
|
|
|
static int
|
|
|
|
GLES_ActivateRenderer(SDL_Renderer * renderer)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
2008-09-15 04:32:36 +00:00
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
2010-01-21 06:21:52 +00:00
|
|
|
SDL_Window *window = renderer->window;
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
if (SDL_CurrentContext != data->context) {
|
|
|
|
if (SDL_GL_MakeCurrent(window, data->context) < 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
SDL_CurrentContext = data->context;
|
2008-09-02 00:37:04 +00:00
|
|
|
}
|
|
|
|
if (data->updateSize) {
|
2011-02-02 14:34:54 -08:00
|
|
|
int w, h;
|
|
|
|
|
|
|
|
SDL_GetWindowSize(window, &w, &h);
|
2011-02-06 02:35:14 -08:00
|
|
|
glMatrixMode(GL_PROJECTION);
|
|
|
|
glLoadIdentity();
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
glLoadIdentity();
|
|
|
|
glViewport(0, 0, w, h);
|
|
|
|
glOrthof(0.0, (GLfloat) w, (GLfloat) h, 0.0, 0.0, 1.0);
|
2008-09-02 00:37:04 +00:00
|
|
|
data->updateSize = SDL_FALSE;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
static void
|
|
|
|
GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
if (event->event == SDL_WINDOWEVENT_RESIZED) {
|
|
|
|
/* Rebind the context to the window area and update matrices */
|
|
|
|
SDL_CurrentContext = NULL;
|
|
|
|
data->updateSize = SDL_TRUE;
|
|
|
|
}
|
2008-09-02 00:37:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static __inline__ int
|
|
|
|
power_of_2(int input)
|
|
|
|
{
|
|
|
|
int value = 1;
|
|
|
|
|
|
|
|
while (value < input) {
|
|
|
|
value <<= 1;
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-05-23 22:41:08 +00:00
|
|
|
GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
|
|
|
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
|
|
|
|
GLES_TextureData *data;
|
|
|
|
GLint internalFormat;
|
|
|
|
GLenum format, type;
|
|
|
|
int texture_w, texture_h;
|
|
|
|
GLenum result;
|
Date: Mon, 23 Mar 2009 09:17:24 +0200
From: "Mike Gorchak"
Subject: New QNX patches
Please apply patch qnx4.diff, which is attached. What has been done:
1)Added back OpenGL ES renderer for QNX target. Added few corrections to
OpenGL ES renderer to let it work under QNX. OpenGL ES renderer do not
support textures under QNX, so I think some additional work must be done.
2) Added GL_OES_query_matrix extension to SDL_opengles.h header file, which
required by OpenGL ES 1.1 specification.
3) Added attribute clearing at the entrance of function
SDL_GL_GetAttribure(). Added error checking into the function
SDL_GL_GetAttribure(), because some attributes can't be obtained in OpenGL
ES 1.0.
4) Porting testdyngles to OpenGL ES 1.0 (1.1 has glColor4ub() and
glColor4f() functions, but 1.0 has glColor4f() only).
5) Added error checking after obtaining attributes using
SDL_GL_GetAttribute() function to the testgl2 and testgles.
6) Small correction to testmultiaudio with printing errors.
7) Added software and accelerated OpenGL ES 1.0 support into the QNX GF
driver.
Please remove ./src/audio/nto directory - it will not be used anymore.
Please create ./src/audio/qsa directory and add content of the archive
qsa.tar.gz into this directory. I rewrote some sound code, added support for
multiple audio cards, enumeration, etc. Added initial support for capture.
As far as I can understand SDL 1.3 is not supporting audio capture right now
? Sam, Am I right ? Or audio capture must be supported through the
PlayDevice routine ?
And last, please put file SDL_gf_opengles.c to the ./src/video/qnxgf
directory. It is OpenGL ES 1.1 emulation layer for some functions, which are
not supported by OpenGL ES 1.0.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403566
2009-03-24 10:33:12 +00:00
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2008-09-15 04:32:36 +00:00
|
|
|
switch (texture->format) {
|
|
|
|
case SDL_PIXELFORMAT_ABGR8888:
|
2009-05-23 22:41:08 +00:00
|
|
|
internalFormat = GL_RGBA;
|
|
|
|
format = GL_RGBA;
|
|
|
|
type = GL_UNSIGNED_BYTE;
|
|
|
|
break;
|
2008-09-15 04:32:36 +00:00
|
|
|
default:
|
2011-02-06 00:48:41 -08:00
|
|
|
SDL_SetError("Texture format not supported");
|
2008-09-15 04:32:36 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
|
2008-09-02 00:37:04 +00:00
|
|
|
if (!data) {
|
|
|
|
SDL_OutOfMemory();
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
|
|
|
data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
|
|
|
|
data->pixels = SDL_malloc(texture->h * data->pitch);
|
|
|
|
if (!data->pixels) {
|
|
|
|
SDL_OutOfMemory();
|
|
|
|
SDL_free(data);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
texture->driverdata = data;
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glGetError();
|
|
|
|
glEnable(GL_TEXTURE_2D);
|
|
|
|
glGenTextures(1, &data->texture);
|
2008-09-15 04:32:36 +00:00
|
|
|
|
|
|
|
data->type = GL_TEXTURE_2D;
|
|
|
|
/* no NPOV textures allowed in OpenGL ES (yet) */
|
|
|
|
texture_w = power_of_2(texture->w);
|
|
|
|
texture_h = power_of_2(texture->h);
|
|
|
|
data->texw = (GLfloat) texture->w / texture_w;
|
|
|
|
data->texh = (GLfloat) texture->h / texture_h;
|
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
data->format = format;
|
|
|
|
data->formattype = type;
|
2011-02-06 02:35:14 -08:00
|
|
|
glBindTexture(data->type, data->texture);
|
|
|
|
glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
|
2011-01-31 22:44:43 -08:00
|
|
|
GL_LINEAR);
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
|
2011-01-31 22:44:43 -08:00
|
|
|
GL_LINEAR);
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
|
2008-09-02 00:37:04 +00:00
|
|
|
GL_CLAMP_TO_EDGE);
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
|
2008-09-02 00:37:04 +00:00
|
|
|
GL_CLAMP_TO_EDGE);
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexImage2D(data->type, 0, internalFormat, texture_w,
|
2008-09-15 04:32:36 +00:00
|
|
|
texture_h, 0, format, type, NULL);
|
2011-02-06 02:35:14 -08:00
|
|
|
glDisable(GL_TEXTURE_2D);
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
result = glGetError();
|
2008-09-02 00:37:04 +00:00
|
|
|
if (result != GL_NO_ERROR) {
|
|
|
|
GLES_SetError("glTexImage2D()", result);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-05-23 22:41:08 +00:00
|
|
|
GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
|
|
|
const SDL_Rect * rect, const void *pixels, int pitch)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
|
|
|
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
|
|
|
|
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
|
|
|
|
GLenum result;
|
2011-01-19 23:47:50 -08:00
|
|
|
int bpp = SDL_BYTESPERPIXEL(texture->format);
|
|
|
|
void * temp_buffer;
|
|
|
|
void * temp_ptr;
|
|
|
|
int i;
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glGetError();
|
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
|
|
glEnable(data->type);
|
|
|
|
glBindTexture(data->type, data->texture);
|
2011-01-19 23:47:50 -08:00
|
|
|
|
|
|
|
if( rect->w * bpp == pitch ) {
|
|
|
|
temp_buffer = (void *)pixels; /* No need to reformat */
|
|
|
|
} else {
|
|
|
|
/* Reformatting of mem area required */
|
|
|
|
temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
|
|
|
|
temp_ptr = temp_buffer;
|
|
|
|
for (i = 0; i < rect->h; i++) {
|
|
|
|
SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
|
|
|
|
temp_ptr += rect->w * bpp;
|
|
|
|
pixels += pitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
|
2008-09-02 00:37:04 +00:00
|
|
|
rect->h, data->format, data->formattype,
|
2011-01-19 23:47:50 -08:00
|
|
|
temp_buffer);
|
|
|
|
|
|
|
|
if( temp_buffer != pixels ) {
|
|
|
|
SDL_free(temp_buffer);
|
|
|
|
}
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glDisable(data->type);
|
|
|
|
result = glGetError();
|
2008-09-02 00:37:04 +00:00
|
|
|
if (result != GL_NO_ERROR) {
|
|
|
|
GLES_SetError("glTexSubImage2D()", result);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
2011-02-03 00:19:40 -08:00
|
|
|
const SDL_Rect * rect, void **pixels, int *pitch)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
|
|
|
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
|
|
|
|
|
|
|
|
*pixels =
|
|
|
|
(void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
|
|
|
|
rect->x * SDL_BYTESPERPIXEL(texture->format));
|
|
|
|
*pitch = data->pitch;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|
|
|
{
|
2011-02-03 00:19:40 -08:00
|
|
|
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
|
2008-09-02 00:37:04 +00:00
|
|
|
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
|
|
|
|
|
2011-02-03 00:19:40 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
|
|
glEnable(data->type);
|
|
|
|
glBindTexture(data->type, data->texture);
|
|
|
|
glTexSubImage2D(data->type, 0, 0, 0, texture->w,
|
2011-02-03 00:19:40 -08:00
|
|
|
texture->h, data->format, data->formattype,
|
|
|
|
data->pixels);
|
2011-02-06 02:35:14 -08:00
|
|
|
glDisable(data->type);
|
2008-09-02 00:37:04 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 20:06:26 -08:00
|
|
|
static void
|
|
|
|
GLES_SetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect)
|
|
|
|
{
|
|
|
|
GL_ActivateRenderer(renderer);
|
|
|
|
|
|
|
|
if (rect) {
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
SDL_GetWindowSize(renderer->window, &w, &h);
|
|
|
|
glScissor(rect->x, (h-(rect->y+rect->h)), rect->w, rect->h);
|
|
|
|
glEnable(GL_SCISSOR_TEST);
|
|
|
|
} else {
|
|
|
|
glDisable(GL_SCISSOR_TEST);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-31 07:56:56 +00:00
|
|
|
static void
|
2011-01-31 23:23:57 -08:00
|
|
|
GLES_SetBlendMode(GLES_RenderData * data, int blendMode)
|
2008-12-31 07:56:56 +00:00
|
|
|
{
|
|
|
|
if (blendMode != data->blendMode) {
|
|
|
|
switch (blendMode) {
|
|
|
|
case SDL_BLENDMODE_NONE:
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
|
|
|
glDisable(GL_BLEND);
|
2008-12-31 07:56:56 +00:00
|
|
|
break;
|
|
|
|
case SDL_BLENDMODE_BLEND:
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
2008-12-31 07:56:56 +00:00
|
|
|
break;
|
|
|
|
case SDL_BLENDMODE_ADD:
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
2008-12-31 07:56:56 +00:00
|
|
|
break;
|
2011-02-04 19:50:56 -08:00
|
|
|
case SDL_BLENDMODE_MOD:
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
2011-02-04 19:50:56 -08:00
|
|
|
break;
|
2008-12-31 07:56:56 +00:00
|
|
|
}
|
|
|
|
data->blendMode = blendMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
static int
|
2010-01-13 04:58:31 +00:00
|
|
|
GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points,
|
|
|
|
int count)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
2008-12-31 07:56:56 +00:00
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
2009-12-12 00:55:13 +00:00
|
|
|
int i;
|
|
|
|
GLshort *vertices;
|
2008-12-31 07:56:56 +00:00
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2011-01-31 23:23:57 -08:00
|
|
|
GLES_SetBlendMode(data, renderer->blendMode);
|
2008-12-31 07:56:56 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glColor4f((GLfloat) renderer->r * inv255f,
|
2008-12-31 07:56:56 +00:00
|
|
|
(GLfloat) renderer->g * inv255f,
|
|
|
|
(GLfloat) renderer->b * inv255f,
|
|
|
|
(GLfloat) renderer->a * inv255f);
|
|
|
|
|
2009-12-12 00:55:13 +00:00
|
|
|
vertices = SDL_stack_alloc(GLshort, count*2);
|
|
|
|
for (i = 0; i < count; ++i) {
|
|
|
|
vertices[2*i+0] = (GLshort)points[i].x;
|
|
|
|
vertices[2*i+1] = (GLshort)points[i].y;
|
|
|
|
}
|
2011-02-06 02:35:14 -08:00
|
|
|
glVertexPointer(2, GL_SHORT, 0, vertices);
|
|
|
|
glDrawArrays(GL_POINTS, 0, count);
|
2009-12-12 00:55:13 +00:00
|
|
|
SDL_stack_free(vertices);
|
2009-01-02 16:03:37 +00:00
|
|
|
|
2008-12-31 07:56:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2008-12-31 07:56:56 +00:00
|
|
|
static int
|
2010-01-13 04:58:31 +00:00
|
|
|
GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points,
|
|
|
|
int count)
|
2008-12-31 07:56:56 +00:00
|
|
|
{
|
2008-09-15 04:32:36 +00:00
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
2009-12-12 00:55:13 +00:00
|
|
|
int i;
|
|
|
|
GLshort *vertices;
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2011-01-31 23:23:57 -08:00
|
|
|
GLES_SetBlendMode(data, renderer->blendMode);
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glColor4f((GLfloat) renderer->r * inv255f,
|
2008-12-31 07:56:56 +00:00
|
|
|
(GLfloat) renderer->g * inv255f,
|
|
|
|
(GLfloat) renderer->b * inv255f,
|
|
|
|
(GLfloat) renderer->a * inv255f);
|
|
|
|
|
2009-12-12 00:55:13 +00:00
|
|
|
vertices = SDL_stack_alloc(GLshort, count*2);
|
|
|
|
for (i = 0; i < count; ++i) {
|
|
|
|
vertices[2*i+0] = (GLshort)points[i].x;
|
|
|
|
vertices[2*i+1] = (GLshort)points[i].y;
|
|
|
|
}
|
2011-02-06 02:35:14 -08:00
|
|
|
glVertexPointer(2, GL_SHORT, 0, vertices);
|
2009-12-09 15:56:56 +00:00
|
|
|
if (count > 2 &&
|
|
|
|
points[0].x == points[count-1].x && points[0].y == points[count-1].y) {
|
|
|
|
/* GL_LINE_LOOP takes care of the final segment */
|
|
|
|
--count;
|
2011-02-06 02:35:14 -08:00
|
|
|
glDrawArrays(GL_LINE_LOOP, 0, count);
|
2009-12-09 15:56:56 +00:00
|
|
|
} else {
|
2011-02-06 02:35:14 -08:00
|
|
|
glDrawArrays(GL_LINE_STRIP, 0, count);
|
2009-12-09 15:56:56 +00:00
|
|
|
}
|
2009-12-12 00:55:13 +00:00
|
|
|
SDL_stack_free(vertices);
|
2009-01-01 23:47:33 +00:00
|
|
|
|
2008-12-31 07:56:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2010-01-13 04:58:31 +00:00
|
|
|
static int
|
|
|
|
GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects,
|
|
|
|
int count)
|
2008-12-31 07:56:56 +00:00
|
|
|
{
|
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
2009-12-09 15:56:56 +00:00
|
|
|
int i;
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2011-01-31 23:23:57 -08:00
|
|
|
GLES_SetBlendMode(data, renderer->blendMode);
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glColor4f((GLfloat) renderer->r * inv255f,
|
2008-12-31 07:56:56 +00:00
|
|
|
(GLfloat) renderer->g * inv255f,
|
|
|
|
(GLfloat) renderer->b * inv255f,
|
|
|
|
(GLfloat) renderer->a * inv255f);
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2009-12-09 15:56:56 +00:00
|
|
|
for (i = 0; i < count; ++i) {
|
|
|
|
const SDL_Rect *rect = rects[i];
|
|
|
|
GLshort minx = rect->x;
|
|
|
|
GLshort maxx = rect->x + rect->w;
|
|
|
|
GLshort miny = rect->y;
|
|
|
|
GLshort maxy = rect->y + rect->h;
|
|
|
|
GLshort vertices[8];
|
|
|
|
vertices[0] = minx;
|
|
|
|
vertices[1] = miny;
|
|
|
|
vertices[2] = maxx;
|
|
|
|
vertices[3] = miny;
|
|
|
|
vertices[4] = minx;
|
|
|
|
vertices[5] = maxy;
|
|
|
|
vertices[6] = maxx;
|
|
|
|
vertices[7] = maxy;
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glVertexPointer(2, GL_SHORT, 0, vertices);
|
|
|
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
2009-12-09 15:56:56 +00:00
|
|
|
}
|
2009-01-01 23:47:33 +00:00
|
|
|
|
2008-09-15 04:32:36 +00:00
|
|
|
return 0;
|
2008-09-02 00:37:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
2008-09-15 04:32:36 +00:00
|
|
|
const SDL_Rect * srcrect, const SDL_Rect * dstrect)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
|
|
|
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
|
|
|
|
int minx, miny, maxx, maxy;
|
|
|
|
GLfloat minu, maxu, minv, maxv;
|
2008-09-15 04:32:36 +00:00
|
|
|
int i;
|
|
|
|
void *temp_buffer; /* used for reformatting dirty rect pixels */
|
|
|
|
void *temp_ptr;
|
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glEnable(GL_TEXTURE_2D);
|
2009-05-14 10:54:34 +00:00
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glBindTexture(texturedata->type, texturedata->texture);
|
2008-09-15 04:32:36 +00:00
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
if (texture->modMode) {
|
2011-02-06 02:35:14 -08:00
|
|
|
glColor4f((GLfloat) texture->r * inv255f,
|
2008-09-02 00:37:04 +00:00
|
|
|
(GLfloat) texture->g * inv255f,
|
|
|
|
(GLfloat) texture->b * inv255f,
|
|
|
|
(GLfloat) texture->a * inv255f);
|
|
|
|
} else {
|
2011-02-06 02:35:14 -08:00
|
|
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
2008-09-02 00:37:04 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 23:23:57 -08:00
|
|
|
GLES_SetBlendMode(data, texture->blendMode);
|
2008-09-02 00:37:04 +00:00
|
|
|
|
2008-09-15 04:32:36 +00:00
|
|
|
if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
|
|
|
|
/* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
|
|
|
|
GLint cropRect[4];
|
2011-02-02 14:34:54 -08:00
|
|
|
int w, h;
|
|
|
|
SDL_Window *window = renderer->window;
|
|
|
|
|
|
|
|
SDL_GetWindowSize(window, &w, &h);
|
2008-09-15 04:32:36 +00:00
|
|
|
cropRect[0] = srcrect->x;
|
|
|
|
cropRect[1] = srcrect->y + srcrect->h;
|
|
|
|
cropRect[2] = srcrect->w;
|
|
|
|
cropRect[3] = -srcrect->h;
|
2011-02-06 02:35:14 -08:00
|
|
|
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
|
2008-09-15 04:32:36 +00:00
|
|
|
cropRect);
|
2011-02-06 02:35:14 -08:00
|
|
|
glDrawTexiOES(dstrect->x, h - dstrect->y - dstrect->h, 0,
|
2011-02-02 14:34:54 -08:00
|
|
|
dstrect->w, dstrect->h);
|
2008-09-15 04:32:36 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
minx = dstrect->x;
|
|
|
|
miny = dstrect->y;
|
|
|
|
maxx = dstrect->x + dstrect->w;
|
|
|
|
maxy = dstrect->y + dstrect->h;
|
|
|
|
|
|
|
|
minu = (GLfloat) srcrect->x / texture->w;
|
|
|
|
minu *= texturedata->texw;
|
|
|
|
maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
|
|
|
|
maxu *= texturedata->texw;
|
|
|
|
minv = (GLfloat) srcrect->y / texture->h;
|
|
|
|
minv *= texturedata->texh;
|
|
|
|
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
|
|
|
|
maxv *= texturedata->texh;
|
|
|
|
|
|
|
|
GLshort vertices[8];
|
|
|
|
GLfloat texCoords[8];
|
|
|
|
|
|
|
|
vertices[0] = minx;
|
|
|
|
vertices[1] = miny;
|
|
|
|
vertices[2] = maxx;
|
|
|
|
vertices[3] = miny;
|
|
|
|
vertices[4] = minx;
|
|
|
|
vertices[5] = maxy;
|
|
|
|
vertices[6] = maxx;
|
|
|
|
vertices[7] = maxy;
|
|
|
|
|
|
|
|
texCoords[0] = minu;
|
|
|
|
texCoords[1] = minv;
|
|
|
|
texCoords[2] = maxu;
|
|
|
|
texCoords[3] = minv;
|
|
|
|
texCoords[4] = minu;
|
|
|
|
texCoords[5] = maxv;
|
|
|
|
texCoords[6] = maxu;
|
|
|
|
texCoords[7] = maxv;
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glVertexPointer(2, GL_SHORT, 0, vertices);
|
|
|
|
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
|
|
|
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
2008-09-15 04:32:36 +00:00
|
|
|
}
|
|
|
|
|
2011-02-06 02:35:14 -08:00
|
|
|
glDisable(GL_TEXTURE_2D);
|
2009-05-14 10:54:34 +00:00
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-05-23 22:41:08 +00:00
|
|
|
GLES_RenderPresent(SDL_Renderer * renderer)
|
2008-09-02 00:37:04 +00:00
|
|
|
{
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
SDL_GL_SwapWindow(renderer->window);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|
|
|
{
|
|
|
|
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
|
|
|
|
|
2011-02-01 19:19:43 -08:00
|
|
|
GLES_ActivateRenderer(renderer);
|
|
|
|
|
2008-09-02 00:37:04 +00:00
|
|
|
if (!data) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (data->texture) {
|
2008-09-15 04:32:36 +00:00
|
|
|
glDeleteTextures(1, &data->texture);
|
2008-09-02 00:37:04 +00:00
|
|
|
}
|
|
|
|
if (data->pixels) {
|
|
|
|
SDL_free(data->pixels);
|
|
|
|
}
|
|
|
|
SDL_free(data);
|
|
|
|
texture->driverdata = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
GLES_DestroyRenderer(SDL_Renderer * renderer)
|
|
|
|
{
|
|
|
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
if (data->context) {
|
|
|
|
SDL_GL_DeleteContext(data->context);
|
|
|
|
}
|
|
|
|
SDL_free(data);
|
|
|
|
}
|
|
|
|
SDL_free(renderer);
|
|
|
|
}
|
|
|
|
|
2011-02-08 10:04:09 -08:00
|
|
|
#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */
|
2008-09-02 00:37:04 +00:00
|
|
|
|
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|