Mercurial > sdl-ios-xcode
annotate src/video/SDL_renderer_gles.c @ 3520:83518f8fcd61
Fixed calls to SDL_AddRenderDriver()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 04 Dec 2009 08:45:08 +0000 |
parents | fe2f10481878 |
children | 0267b8b1595c |
rev | line source |
---|---|
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
1 /* |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
4 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
9 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
14 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
18 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
19 Sam Lantinga |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
20 slouken@libsdl.org |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
21 */ |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
23 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
24 #if SDL_VIDEO_RENDER_OGL_ES |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
25 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
26 #include "SDL_video.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
27 #include "SDL_opengles.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
28 #include "SDL_sysvideo.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
29 #include "SDL_pixels_c.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
30 #include "SDL_rect_c.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
31 #include "SDL_yuv_sw_c.h" |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
32 |
3165
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
33 #if defined(__QNXNTO__) |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
34 /* Include QNX system header to check QNX version later */ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
35 #include <sys/neutrino.h> |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
36 #endif /* __QNXNTO__ */ |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
37 |
3165
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
38 #if defined(SDL_VIDEO_DRIVER_QNXGF) || \ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
39 defined(SDL_VIDEO_DRIVER_PHOTON) || \ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
40 defined(SDL_VIDEO_DRIVER_PANDORA) |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
41 |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
42 /* Empty function stub to get OpenGL ES 1.x support without */ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
43 /* OpenGL ES extension GL_OES_draw_texture supported */ |
3139 | 44 GL_API void GL_APIENTRY |
45 glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height) | |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
46 { |
3139 | 47 return; |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
48 } |
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
49 |
3165
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
50 #endif /* QNXGF || PHOTON || PANDORA */ |
3161
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
51 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
52 /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */ |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
53 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
54 static const float inv255f = 1.0f / 255.0f; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
55 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
56 static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
57 static int GLES_ActivateRenderer(SDL_Renderer * renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
58 static int GLES_DisplayModeChanged(SDL_Renderer * renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
59 static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
60 static int GLES_QueryTexturePixels(SDL_Renderer * renderer, |
2753 | 61 SDL_Texture * texture, void **pixels, |
62 int *pitch); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
63 static int GLES_SetTexturePalette(SDL_Renderer * renderer, |
2753 | 64 SDL_Texture * texture, |
65 const SDL_Color * colors, int firstcolor, | |
66 int ncolors); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
67 static int GLES_GetTexturePalette(SDL_Renderer * renderer, |
2753 | 68 SDL_Texture * texture, SDL_Color * colors, |
69 int firstcolor, int ncolors); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
70 static int GLES_SetTextureColorMod(SDL_Renderer * renderer, |
2753 | 71 SDL_Texture * texture); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
72 static int GLES_SetTextureAlphaMod(SDL_Renderer * renderer, |
2753 | 73 SDL_Texture * texture); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
74 static int GLES_SetTextureBlendMode(SDL_Renderer * renderer, |
2753 | 75 SDL_Texture * texture); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
76 static int GLES_SetTextureScaleMode(SDL_Renderer * renderer, |
2753 | 77 SDL_Texture * texture); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
78 static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 79 const SDL_Rect * rect, const void *pixels, |
80 int pitch); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
81 static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 82 const SDL_Rect * rect, int markDirty, |
83 void **pixels, int *pitch); | |
84 static void GLES_UnlockTexture(SDL_Renderer * renderer, | |
85 SDL_Texture * texture); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
86 static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 87 int numrects, const SDL_Rect * rects); |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
88 static int GLES_RenderPoint(SDL_Renderer * renderer, int x, int y); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
89 static int GLES_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
90 int y2); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
91 static int GLES_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
92 static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 93 const SDL_Rect * srcrect, |
94 const SDL_Rect * dstrect); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
95 static void GLES_RenderPresent(SDL_Renderer * renderer); |
2753 | 96 static void GLES_DestroyTexture(SDL_Renderer * renderer, |
97 SDL_Texture * texture); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
98 static void GLES_DestroyRenderer(SDL_Renderer * renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
99 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
100 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
101 SDL_RenderDriver GL_ES_RenderDriver = { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
102 GLES_CreateRenderer, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
103 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
104 "opengl_es", |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
105 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD | |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
106 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
107 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR | |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
108 SDL_TEXTUREMODULATE_ALPHA), |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
109 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
110 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
111 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | |
3163
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
112 SDL_TEXTURESCALEMODE_SLOW), 5, |
2753 | 113 { |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
114 /* OpenGL ES 1.x supported formats list */ |
3163
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
115 SDL_PIXELFORMAT_ABGR4444, |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
116 SDL_PIXELFORMAT_ABGR1555, |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
117 SDL_PIXELFORMAT_BGR565, |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
118 SDL_PIXELFORMAT_BGR24, |
3139 | 119 SDL_PIXELFORMAT_ABGR8888}, |
2753 | 120 0, |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
121 0} |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
122 }; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
123 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
124 typedef struct |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
125 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
126 SDL_GLContext context; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
127 SDL_bool updateSize; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
128 int blendMode; |
2753 | 129 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
130 #ifndef APIENTRY |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
131 #define APIENTRY |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
132 #endif |
2753 | 133 |
134 SDL_bool useDrawTexture; | |
135 SDL_bool GL_OES_draw_texture_supported; | |
136 | |
137 /* OpenGL ES functions */ | |
138 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; | |
139 #include "SDL_glesfuncs.h" | |
140 #undef SDL_PROC | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
141 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
142 } GLES_RenderData; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
143 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
144 typedef struct |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
145 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
146 GLuint texture; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
147 GLenum type; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
148 GLfloat texw; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
149 GLfloat texh; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
150 GLenum format; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
151 GLenum formattype; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
152 void *pixels; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
153 int pitch; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
154 SDL_DirtyRectList dirty; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
155 } GLES_TextureData; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
156 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
157 static void |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
158 GLES_SetError(const char *prefix, GLenum result) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
159 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
160 const char *error; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
161 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
162 switch (result) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
163 case GL_NO_ERROR: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
164 error = "GL_NO_ERROR"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
165 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
166 case GL_INVALID_ENUM: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
167 error = "GL_INVALID_ENUM"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
168 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
169 case GL_INVALID_VALUE: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
170 error = "GL_INVALID_VALUE"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
171 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
172 case GL_INVALID_OPERATION: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
173 error = "GL_INVALID_OPERATION"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
174 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
175 case GL_STACK_OVERFLOW: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
176 error = "GL_STACK_OVERFLOW"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
177 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
178 case GL_STACK_UNDERFLOW: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
179 error = "GL_STACK_UNDERFLOW"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
180 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
181 case GL_OUT_OF_MEMORY: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
182 error = "GL_OUT_OF_MEMORY"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
183 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
184 default: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
185 error = "UNKNOWN"; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
186 break; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
187 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
188 SDL_SetError("%s: %s", prefix, error); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
189 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
190 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
191 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
192 GLES_LoadFunctions(GLES_RenderData * data) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
193 { |
2753 | 194 |
195 #define SDL_PROC(ret,func,params) \ | |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
196 data->func = func; |
2753 | 197 #include "SDL_glesfuncs.h" |
198 #undef SDL_PROC | |
199 | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
200 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
201 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
202 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
203 SDL_Renderer * |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
204 GLES_CreateRenderer(SDL_Window * window, Uint32 flags) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
205 { |
2753 | 206 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
207 SDL_Renderer *renderer; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
208 GLES_RenderData *data; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
209 GLint value; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
210 int doublebuffer; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
211 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
212 if (!(window->flags & SDL_WINDOW_OPENGL)) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
213 if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
214 return NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
215 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
216 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
217 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
218 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
219 if (!renderer) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
220 SDL_OutOfMemory(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
221 return NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
222 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
223 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
224 data = (GLES_RenderData *) SDL_calloc(1, sizeof(*data)); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
225 if (!data) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
226 GLES_DestroyRenderer(renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
227 SDL_OutOfMemory(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
228 return NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
229 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
230 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
231 renderer->ActivateRenderer = GLES_ActivateRenderer; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
232 renderer->DisplayModeChanged = GLES_DisplayModeChanged; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
233 renderer->CreateTexture = GLES_CreateTexture; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
234 renderer->QueryTexturePixels = GLES_QueryTexturePixels; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
235 renderer->SetTexturePalette = GLES_SetTexturePalette; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
236 renderer->GetTexturePalette = GLES_GetTexturePalette; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
237 renderer->SetTextureColorMod = GLES_SetTextureColorMod; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
238 renderer->SetTextureAlphaMod = GLES_SetTextureAlphaMod; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
239 renderer->SetTextureBlendMode = GLES_SetTextureBlendMode; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
240 renderer->SetTextureScaleMode = GLES_SetTextureScaleMode; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
241 renderer->UpdateTexture = GLES_UpdateTexture; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
242 renderer->LockTexture = GLES_LockTexture; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
243 renderer->UnlockTexture = GLES_UnlockTexture; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
244 renderer->DirtyTexture = GLES_DirtyTexture; |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
245 renderer->RenderPoint = GLES_RenderPoint; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
246 renderer->RenderLine = GLES_RenderLine; |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
247 renderer->RenderFill = GLES_RenderFill; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
248 renderer->RenderCopy = GLES_RenderCopy; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
249 renderer->RenderPresent = GLES_RenderPresent; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
250 renderer->DestroyTexture = GLES_DestroyTexture; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
251 renderer->DestroyRenderer = GLES_DestroyRenderer; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
252 renderer->info = GL_ES_RenderDriver.info; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
253 renderer->window = window->id; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
254 renderer->driverdata = data; |
2753 | 255 |
256 renderer->info.flags = | |
257 (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
258 |
3165
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
259 #if defined(__QNXNTO__) |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
260 #if _NTO_VERSION<=641 |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
261 /* QNX's OpenGL ES implementation is broken regarding */ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
262 /* packed textures support, affected versions 6.3.2, 6.4.0, 6.4.1 */ |
3169 | 263 renderer->info.num_texture_formats = 2; |
264 renderer->info.texture_formats[0] = SDL_PIXELFORMAT_ABGR8888; | |
265 renderer->info.texture_formats[1] = SDL_PIXELFORMAT_BGR24; | |
3165
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
266 #endif /* _NTO_VERSION */ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
267 #endif /* __QNXNTO__ */ |
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
268 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
269 if (GLES_LoadFunctions(data) < 0) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
270 GLES_DestroyRenderer(renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
271 return NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
272 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
273 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
274 data->context = SDL_GL_CreateContext(window->id); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
275 if (!data->context) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
276 GLES_DestroyRenderer(renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
277 return NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
278 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
279 if (SDL_GL_MakeCurrent(window->id, data->context) < 0) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
280 GLES_DestroyRenderer(renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
281 return NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
282 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
283 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
284 if (flags & SDL_RENDERER_PRESENTVSYNC) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
285 SDL_GL_SetSwapInterval(1); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
286 } else { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
287 SDL_GL_SetSwapInterval(0); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
288 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
289 if (SDL_GL_GetSwapInterval() > 0) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
290 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
291 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
292 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
293 if (SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer) == 0) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
294 if (!doublebuffer) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
295 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
296 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
297 } |
3161
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
298 #if SDL_VIDEO_DRIVER_PANDORA |
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
299 data->GL_OES_draw_texture_supported = SDL_FALSE; |
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
300 data->useDrawTexture = SDL_FALSE; |
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
301 #else |
2753 | 302 if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) { |
303 data->GL_OES_draw_texture_supported = SDL_TRUE; | |
304 data->useDrawTexture = SDL_TRUE; | |
305 } else { | |
306 data->GL_OES_draw_texture_supported = SDL_FALSE; | |
307 data->useDrawTexture = SDL_FALSE; | |
308 } | |
3161
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
309 #endif |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
310 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
311 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
312 renderer->info.max_texture_width = value; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
313 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
314 renderer->info.max_texture_height = value; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
315 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
316 /* Set up parameters for rendering */ |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
317 data->blendMode = -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
318 data->glDisable(GL_DEPTH_TEST); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
319 data->glDisable(GL_CULL_FACE); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
320 data->updateSize = SDL_TRUE; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
321 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
322 return renderer; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
323 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
324 |
2753 | 325 static int |
326 GLES_ActivateRenderer(SDL_Renderer * renderer) | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
327 { |
2753 | 328 |
329 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
330 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
2753 | 331 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
332 if (SDL_GL_MakeCurrent(window->id, data->context) < 0) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
333 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
334 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
335 if (data->updateSize) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
336 data->glMatrixMode(GL_PROJECTION); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
337 data->glLoadIdentity(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
338 data->glMatrixMode(GL_MODELVIEW); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
339 data->glLoadIdentity(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
340 data->glViewport(0, 0, window->w, window->h); |
2753 | 341 data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0, |
342 0.0, 1.0); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
343 data->updateSize = SDL_FALSE; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
344 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
345 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
346 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
347 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
348 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
349 GLES_DisplayModeChanged(SDL_Renderer * renderer) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
350 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
351 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
352 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
353 data->updateSize = SDL_TRUE; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
354 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
355 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
356 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
357 static __inline__ int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
358 power_of_2(int input) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
359 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
360 int value = 1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
361 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
362 while (value < input) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
363 value <<= 1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
364 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
365 return value; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
366 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
367 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
368 static int |
3139 | 369 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
370 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
371 GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
372 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
373 GLES_TextureData *data; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
374 GLint internalFormat; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
375 GLenum format, type; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
376 int texture_w, texture_h; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
377 GLenum result; |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
378 |
2753 | 379 switch (texture->format) { |
380 case SDL_PIXELFORMAT_BGR24: | |
3139 | 381 internalFormat = GL_RGB; |
382 format = GL_RGB; | |
383 type = GL_UNSIGNED_BYTE; | |
384 break; | |
2753 | 385 case SDL_PIXELFORMAT_ABGR8888: |
3139 | 386 internalFormat = GL_RGBA; |
387 format = GL_RGBA; | |
388 type = GL_UNSIGNED_BYTE; | |
389 break; | |
3163
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
390 case SDL_PIXELFORMAT_BGR565: |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
391 internalFormat = GL_RGB; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
392 format = GL_RGB; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
393 type = GL_UNSIGNED_SHORT_5_6_5; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
394 break; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
395 case SDL_PIXELFORMAT_ABGR1555: |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
396 internalFormat = GL_RGBA; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
397 format = GL_RGBA; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
398 type = GL_UNSIGNED_SHORT_5_5_5_1; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
399 break; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
400 case SDL_PIXELFORMAT_ABGR4444: |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
401 internalFormat = GL_RGBA; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
402 format = GL_RGBA; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
403 type = GL_UNSIGNED_SHORT_4_4_4_4; |
a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3161
diff
changeset
|
404 break; |
2753 | 405 default: |
3165
7168651d5706
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
Mike Gorchak <lestat@i.com.ua>
parents:
3163
diff
changeset
|
406 SDL_SetError("Unsupported by OpenGL ES texture format"); |
2753 | 407 return -1; |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
408 } |
2753 | 409 |
410 data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data)); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
411 if (!data) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
412 SDL_OutOfMemory(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
413 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
414 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
415 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
416 if (texture->access == SDL_TEXTUREACCESS_STREAMING) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
417 data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
418 data->pixels = SDL_malloc(texture->h * data->pitch); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
419 if (!data->pixels) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
420 SDL_OutOfMemory(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
421 SDL_free(data); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
422 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
423 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
424 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
425 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
426 texture->driverdata = data; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
427 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
428 renderdata->glGetError(); |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
429 renderdata->glEnable(GL_TEXTURE_2D); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
430 renderdata->glGenTextures(1, &data->texture); |
2753 | 431 |
432 data->type = GL_TEXTURE_2D; | |
433 /* no NPOV textures allowed in OpenGL ES (yet) */ | |
434 texture_w = power_of_2(texture->w); | |
435 texture_h = power_of_2(texture->h); | |
436 data->texw = (GLfloat) texture->w / texture_w; | |
437 data->texh = (GLfloat) texture->h / texture_h; | |
438 | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
439 data->format = format; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
440 data->formattype = type; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
441 renderdata->glBindTexture(data->type, data->texture); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
442 renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
443 GL_NEAREST); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
444 renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
445 GL_NEAREST); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
446 renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
447 GL_CLAMP_TO_EDGE); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
448 renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
449 GL_CLAMP_TO_EDGE); |
2753 | 450 |
451 renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, | |
452 texture_h, 0, format, type, NULL); | |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
453 renderdata->glDisable(GL_TEXTURE_2D); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
454 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
455 result = renderdata->glGetError(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
456 if (result != GL_NO_ERROR) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
457 GLES_SetError("glTexImage2D()", result); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
458 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
459 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
460 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
461 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
462 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
463 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
464 GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 465 void **pixels, int *pitch) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
466 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
467 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
468 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
469 *pixels = data->pixels; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
470 *pitch = data->pitch; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
471 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
472 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
473 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
474 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
475 GLES_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 476 const SDL_Color * colors, int firstcolor, int ncolors) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
477 { |
2753 | 478 SDL_SetError("OpenGL ES does not support paletted textures"); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
479 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
480 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
481 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
482 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
483 GLES_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 484 SDL_Color * colors, int firstcolor, int ncolors) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
485 { |
2753 | 486 SDL_SetError("OpenGL ES does not support paletted textures"); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
487 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
488 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
489 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
490 static void |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
491 SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
492 int pitch) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
493 { |
2753 | 494 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
495 renderdata->glBindTexture(data->type, data->texture); | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
496 renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
497 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
498 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
499 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
500 GLES_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
501 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
502 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
503 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
504 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
505 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
506 GLES_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
507 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
508 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
509 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
510 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
511 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
512 GLES_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
513 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
514 switch (texture->blendMode) { |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
515 case SDL_BLENDMODE_NONE: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
516 case SDL_BLENDMODE_MASK: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
517 case SDL_BLENDMODE_BLEND: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
518 case SDL_BLENDMODE_ADD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
519 case SDL_BLENDMODE_MOD: |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
520 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
521 default: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
522 SDL_Unsupported(); |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
523 texture->blendMode = SDL_BLENDMODE_NONE; |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
524 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
525 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
526 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
527 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
528 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
529 GLES_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
530 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
531 switch (texture->scaleMode) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
532 case SDL_TEXTURESCALEMODE_NONE: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
533 case SDL_TEXTURESCALEMODE_FAST: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
534 case SDL_TEXTURESCALEMODE_SLOW: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
535 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
536 case SDL_TEXTURESCALEMODE_BEST: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
537 SDL_Unsupported(); |
2753 | 538 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
539 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
540 default: |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
541 SDL_Unsupported(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
542 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
543 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
544 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
545 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
546 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
547 static int |
3139 | 548 GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
549 const SDL_Rect * rect, const void *pixels, int pitch) | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
550 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
551 GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
552 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
553 GLenum result; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
554 |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
555 renderdata->glGetError(); |
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
556 renderdata->glEnable(data->type); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
557 SetupTextureUpdate(renderdata, texture, pitch); |
2753 | 558 renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w, |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
559 rect->h, data->format, data->formattype, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
560 pixels); |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
561 renderdata->glDisable(data->type); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
562 result = renderdata->glGetError(); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
563 if (result != GL_NO_ERROR) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
564 GLES_SetError("glTexSubImage2D()", result); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
565 return -1; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
566 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
567 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
568 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
569 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
570 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
571 GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 572 const SDL_Rect * rect, int markDirty, void **pixels, |
573 int *pitch) | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
574 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
575 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
576 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
577 if (markDirty) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
578 SDL_AddDirtyRect(&data->dirty, rect); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
579 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
580 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
581 *pixels = |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
582 (void *) ((Uint8 *) data->pixels + rect->y * data->pitch + |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
583 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
584 *pitch = data->pitch; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
585 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
586 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
587 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
588 static void |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
589 GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
590 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
591 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
592 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
593 static void |
2753 | 594 GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
595 int numrects, const SDL_Rect * rects) | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
596 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
597 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
598 int i; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
599 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
600 for (i = 0; i < numrects; ++i) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
601 SDL_AddDirtyRect(&data->dirty, &rects[i]); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
602 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
603 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
604 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
605 static void |
3393
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
606 GLES_SetBlendMode(GLES_RenderData * data, int blendMode, int isprimitive) |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
607 { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
608 if (blendMode != data->blendMode) { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
609 switch (blendMode) { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
610 case SDL_BLENDMODE_NONE: |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
611 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
612 data->glDisable(GL_BLEND); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
613 break; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
614 case SDL_BLENDMODE_MASK: |
3393
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
615 if (isprimitive) { |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
616 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
617 data->glDisable(GL_BLEND); |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
618 /* The same as SDL_BLENDMODE_NONE */ |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
619 blendMode = SDL_BLENDMODE_NONE; |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
620 break; |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
621 } |
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
622 /* fall through */ |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
623 case SDL_BLENDMODE_BLEND: |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
624 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
625 data->glEnable(GL_BLEND); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
626 data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
627 break; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
628 case SDL_BLENDMODE_ADD: |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
629 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
630 data->glEnable(GL_BLEND); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
631 data->glBlendFunc(GL_SRC_ALPHA, GL_ONE); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
632 break; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
633 case SDL_BLENDMODE_MOD: |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
634 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
635 data->glEnable(GL_BLEND); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
636 data->glBlendFunc(GL_ZERO, GL_SRC_COLOR); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
637 break; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
638 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
639 data->blendMode = blendMode; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
640 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
641 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
642 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
643 static int |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
644 GLES_RenderPoint(SDL_Renderer * renderer, int x, int y) |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
645 { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
646 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
647 |
3393
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
648 GLES_SetBlendMode(data, renderer->blendMode, 1); |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
649 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
650 data->glColor4f((GLfloat) renderer->r * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
651 (GLfloat) renderer->g * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
652 (GLfloat) renderer->b * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
653 (GLfloat) renderer->a * inv255f); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
654 |
2964 | 655 GLshort vertices[2]; |
656 vertices[0] = x; | |
657 vertices[1] = y; | |
658 | |
659 data->glVertexPointer(2, GL_SHORT, 0, vertices); | |
660 data->glEnableClientState(GL_VERTEX_ARRAY); | |
661 data->glDrawArrays(GL_POINTS, 0, 1); | |
662 data->glDisableClientState(GL_VERTEX_ARRAY); | |
663 | |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
664 return 0; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
665 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
666 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
667 static int |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
668 GLES_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
669 { |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
670 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
2753 | 671 |
3393
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
672 GLES_SetBlendMode(data, renderer->blendMode, 1); |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
673 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
674 data->glColor4f((GLfloat) renderer->r * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
675 (GLfloat) renderer->g * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
676 (GLfloat) renderer->b * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
677 (GLfloat) renderer->a * inv255f); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
678 |
2964 | 679 GLshort vertices[4]; |
680 vertices[0] = x1; | |
681 vertices[1] = y1; | |
682 vertices[2] = x2; | |
683 vertices[3] = y2; | |
2949
4eabc35fbb4a
Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2937
diff
changeset
|
684 |
2964 | 685 data->glVertexPointer(2, GL_SHORT, 0, vertices); |
686 data->glEnableClientState(GL_VERTEX_ARRAY); | |
687 data->glDrawArrays(GL_LINES, 0, 2); | |
688 data->glDisableClientState(GL_VERTEX_ARRAY); | |
2949
4eabc35fbb4a
Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2937
diff
changeset
|
689 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
690 return 0; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
691 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
692 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
693 static int |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
694 GLES_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect) |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
695 { |
2753 | 696 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
697 | |
3393
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
698 GLES_SetBlendMode(data, renderer->blendMode, 1); |
2753 | 699 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
700 data->glColor4f((GLfloat) renderer->r * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
701 (GLfloat) renderer->g * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
702 (GLfloat) renderer->b * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
703 (GLfloat) renderer->a * inv255f); |
2753 | 704 |
2964 | 705 GLshort minx = rect->x; |
706 GLshort maxx = rect->x + rect->w; | |
707 GLshort miny = rect->y; | |
708 GLshort maxy = rect->y + rect->h; | |
709 | |
710 GLshort vertices[8]; | |
711 vertices[0] = minx; | |
712 vertices[1] = miny; | |
713 vertices[2] = maxx; | |
714 vertices[3] = miny; | |
715 vertices[4] = minx; | |
716 vertices[5] = maxy; | |
717 vertices[6] = maxx; | |
718 vertices[7] = maxy; | |
719 | |
720 data->glVertexPointer(2, GL_SHORT, 0, vertices); | |
721 data->glEnableClientState(GL_VERTEX_ARRAY); | |
722 data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | |
723 data->glDisableClientState(GL_VERTEX_ARRAY); | |
2949
4eabc35fbb4a
Modified OpenGL ES render driver to support new SDL_RenderFill, SDL_RenderLine, and SDL_RenderPoint.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
2937
diff
changeset
|
724 |
2753 | 725 return 0; |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
726 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
727 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
728 static int |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
729 GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 730 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
731 { |
2753 | 732 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
733 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
734 GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
735 int minx, miny, maxx, maxy; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
736 GLfloat minu, maxu, minv, maxv; |
2753 | 737 int i; |
738 void *temp_buffer; /* used for reformatting dirty rect pixels */ | |
739 void *temp_ptr; | |
740 | |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
741 data->glEnable(GL_TEXTURE_2D); |
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
742 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
743 if (texturedata->dirty.list) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
744 SDL_DirtyRect *dirty; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
745 void *pixels; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
746 int bpp = SDL_BYTESPERPIXEL(texture->format); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
747 int pitch = texturedata->pitch; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
748 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
749 SetupTextureUpdate(data, texture, pitch); |
2753 | 750 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
751 data->glBindTexture(texturedata->type, texturedata->texture); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
752 for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
753 SDL_Rect *rect = &dirty->rect; |
2753 | 754 pixels = |
755 (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch + | |
756 rect->x * bpp); | |
757 /* There is no GL_UNPACK_ROW_LENGTH in OpenGLES | |
758 we must do this reformatting ourselves(!) | |
759 | |
760 maybe it'd be a good idea to keep a temp buffer around | |
761 for this purpose rather than allocating it each time | |
762 */ | |
763 temp_buffer = SDL_malloc(rect->w * rect->h * bpp); | |
764 temp_ptr = temp_buffer; | |
765 for (i = 0; i < rect->h; i++) { | |
766 SDL_memcpy(temp_ptr, pixels, rect->w * bpp); | |
767 temp_ptr += rect->w * bpp; | |
768 pixels += pitch; | |
769 } | |
770 | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
771 data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
772 rect->w, rect->h, texturedata->format, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
773 texturedata->formattype, temp_buffer); |
2753 | 774 |
775 SDL_free(temp_buffer); | |
776 | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
777 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
778 SDL_ClearDirtyRects(&texturedata->dirty); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
779 } |
2753 | 780 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
781 data->glBindTexture(texturedata->type, texturedata->texture); |
2753 | 782 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
783 if (texture->modMode) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
784 data->glColor4f((GLfloat) texture->r * inv255f, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
785 (GLfloat) texture->g * inv255f, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
786 (GLfloat) texture->b * inv255f, |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
787 (GLfloat) texture->a * inv255f); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
788 } else { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
789 data->glColor4f(1.0f, 1.0f, 1.0f, 1.0f); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
790 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
791 |
3393
fe2f10481878
Fixed SDL_BLENDMODE_MASK for GL and GLES renderers, now blending works like in software renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3389
diff
changeset
|
792 GLES_SetBlendMode(data, texture->blendMode, 0); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
793 |
2753 | 794 switch (texture->scaleMode) { |
795 case SDL_TEXTURESCALEMODE_NONE: | |
796 case SDL_TEXTURESCALEMODE_FAST: | |
797 data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, | |
798 GL_NEAREST); | |
799 data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, | |
800 GL_NEAREST); | |
801 break; | |
802 case SDL_TEXTURESCALEMODE_SLOW: | |
803 case SDL_TEXTURESCALEMODE_BEST: | |
804 data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, | |
805 GL_LINEAR); | |
806 data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, | |
807 GL_LINEAR); | |
808 break; | |
809 } | |
810 | |
811 if (data->GL_OES_draw_texture_supported && data->useDrawTexture) { | |
812 /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */ | |
813 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | |
814 GLint cropRect[4]; | |
815 cropRect[0] = srcrect->x; | |
816 cropRect[1] = srcrect->y + srcrect->h; | |
817 cropRect[2] = srcrect->w; | |
818 cropRect[3] = -srcrect->h; | |
819 data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, | |
820 cropRect); | |
821 data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h, | |
822 0, dstrect->w, dstrect->h); | |
823 } else { | |
824 | |
825 minx = dstrect->x; | |
826 miny = dstrect->y; | |
827 maxx = dstrect->x + dstrect->w; | |
828 maxy = dstrect->y + dstrect->h; | |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
829 |
2753 | 830 minu = (GLfloat) srcrect->x / texture->w; |
831 minu *= texturedata->texw; | |
832 maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w; | |
833 maxu *= texturedata->texw; | |
834 minv = (GLfloat) srcrect->y / texture->h; | |
835 minv *= texturedata->texh; | |
836 maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h; | |
837 maxv *= texturedata->texh; | |
838 | |
839 GLshort vertices[8]; | |
840 GLfloat texCoords[8]; | |
841 | |
842 vertices[0] = minx; | |
843 vertices[1] = miny; | |
844 vertices[2] = maxx; | |
845 vertices[3] = miny; | |
846 vertices[4] = minx; | |
847 vertices[5] = maxy; | |
848 vertices[6] = maxx; | |
849 vertices[7] = maxy; | |
850 | |
851 texCoords[0] = minu; | |
852 texCoords[1] = minv; | |
853 texCoords[2] = maxu; | |
854 texCoords[3] = minv; | |
855 texCoords[4] = minu; | |
856 texCoords[5] = maxv; | |
857 texCoords[6] = maxu; | |
858 texCoords[7] = maxv; | |
859 | |
860 data->glVertexPointer(2, GL_SHORT, 0, vertices); | |
861 data->glEnableClientState(GL_VERTEX_ARRAY); | |
862 data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords); | |
863 data->glEnableClientState(GL_TEXTURE_COORD_ARRAY); | |
864 data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
865 data->glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
866 data->glDisableClientState(GL_VERTEX_ARRAY); |
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
867 } |
2753 | 868 |
3122
6c98826d88b0
OpenGL ES renderer state fixes. Now GL_TEXTURE_2D is not enabled by default.
Mike Gorchak <lestat@i.com.ua>
parents:
3099
diff
changeset
|
869 data->glDisable(GL_TEXTURE_2D); |
2753 | 870 |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
871 return 0; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
872 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
873 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
874 static void |
3139 | 875 GLES_RenderPresent(SDL_Renderer * renderer) |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
876 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
877 SDL_GL_SwapWindow(renderer->window); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
878 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
879 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
880 static void |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
881 GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
882 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
883 GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
884 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
885 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
886 if (!data) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
887 return; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
888 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
889 if (data->texture) { |
2753 | 890 glDeleteTextures(1, &data->texture); |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
891 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
892 if (data->pixels) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
893 SDL_free(data->pixels); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
894 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
895 SDL_FreeDirtyRects(&data->dirty); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
896 SDL_free(data); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
897 texture->driverdata = NULL; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
898 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
899 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
900 static void |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
901 GLES_DestroyRenderer(SDL_Renderer * renderer) |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
902 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
903 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
904 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
905 if (data) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
906 if (data->context) { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
907 SDL_GL_DeleteContext(data->context); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
908 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
909 SDL_free(data); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
910 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
911 SDL_free(renderer); |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
912 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
913 |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
914 #endif /* SDL_VIDEO_RENDER_OGL_ES */ |
2739
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
915 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
916 /* vi: set ts=4 sw=4 expandtab: */ |