Mercurial > sdl-ios-xcode
annotate src/video/SDL_renderer_gles.c @ 4986:8431f59485d0
Renderer didn't advertise texture format SDL_PIXELFORMAT_ABGR8888
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 12 Jan 2011 15:42:26 -0800 |
parents | 047a580d30f3 |
children | 397e748d901a |
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 |
3697 | 3 Copyright (C) 1997-2010 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); |
3641 | 88 static int GLES_RenderDrawPoints(SDL_Renderer * renderer, |
89 const SDL_Point * points, int count); | |
90 static int GLES_RenderDrawLines(SDL_Renderer * renderer, | |
91 const SDL_Point * points, int count); | |
92 static int GLES_RenderDrawRects(SDL_Renderer * renderer, | |
93 const SDL_Rect ** rects, int count); | |
94 static int GLES_RenderFillRects(SDL_Renderer * renderer, | |
95 const SDL_Rect ** rects, int count); | |
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
|
96 static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 97 const SDL_Rect * srcrect, |
98 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
|
99 static void GLES_RenderPresent(SDL_Renderer * renderer); |
2753 | 100 static void GLES_DestroyTexture(SDL_Renderer * renderer, |
101 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
|
102 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
|
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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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_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
|
106 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
|
107 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 "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
|
109 (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
|
110 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
|
111 (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
|
112 SDL_TEXTUREMODULATE_ALPHA), |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
113 (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
|
114 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), |
4986
8431f59485d0
Renderer didn't advertise texture format SDL_PIXELFORMAT_ABGR8888
Sam Lantinga <slouken@libsdl.org>
parents:
4985
diff
changeset
|
115 (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 6, |
2753 | 116 { |
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
|
117 /* OpenGL ES 1.x supported formats list */ |
4985
047a580d30f3
Fixed blue-red channel swap in OpenGL ES 16-bit texture formats
Sam Lantinga <slouken@libsdl.org>
parents:
4963
diff
changeset
|
118 SDL_PIXELFORMAT_RGBA4444, |
047a580d30f3
Fixed blue-red channel swap in OpenGL ES 16-bit texture formats
Sam Lantinga <slouken@libsdl.org>
parents:
4963
diff
changeset
|
119 SDL_PIXELFORMAT_RGBA5551, |
047a580d30f3
Fixed blue-red channel swap in OpenGL ES 16-bit texture formats
Sam Lantinga <slouken@libsdl.org>
parents:
4963
diff
changeset
|
120 SDL_PIXELFORMAT_RGB565, |
4963
604077962776
Fixed screen texture format on Android
Sam Lantinga <slouken@libsdl.org>
parents:
4929
diff
changeset
|
121 SDL_PIXELFORMAT_RGB24, |
604077962776
Fixed screen texture format on Android
Sam Lantinga <slouken@libsdl.org>
parents:
4929
diff
changeset
|
122 SDL_PIXELFORMAT_BGR888, |
3139 | 123 SDL_PIXELFORMAT_ABGR8888}, |
2753 | 124 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
|
125 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
|
126 }; |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
129 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
131 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
|
132 int blendMode; |
2753 | 133 |
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
|
134 #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
|
135 #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
|
136 #endif |
2753 | 137 |
138 SDL_bool useDrawTexture; | |
139 SDL_bool GL_OES_draw_texture_supported; | |
140 | |
141 /* OpenGL ES functions */ | |
142 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; | |
143 #include "SDL_glesfuncs.h" | |
144 #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
|
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 } 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
|
147 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
149 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 } 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
|
160 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
162 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
|
163 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
165 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
193 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
194 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
195 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
|
196 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
|
197 { |
2753 | 198 |
199 #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
|
200 data->func = func; |
2753 | 201 #include "SDL_glesfuncs.h" |
202 #undef SDL_PROC | |
203 | |
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
|
204 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
|
205 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
206 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 * |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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_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
|
209 { |
2753 | 210 |
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
|
211 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
|
212 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
|
213 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
|
214 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
|
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 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
|
217 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
|
218 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
|
219 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
223 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
|
224 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
|
225 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
|
226 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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->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
|
236 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
|
237 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 renderer->DirtyTexture = GLES_DirtyTexture; |
3641 | 249 renderer->RenderDrawPoints = GLES_RenderDrawPoints; |
250 renderer->RenderDrawLines = GLES_RenderDrawLines; | |
251 renderer->RenderDrawRects = GLES_RenderDrawRects; | |
252 renderer->RenderFillRects = GLES_RenderFillRects; | |
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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 renderer->info = GL_ES_RenderDriver.info; |
3688
6512cba48440
Fixed Cocoa and OpenGL builds
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
258 renderer->window = window; |
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
|
259 renderer->driverdata = data; |
2753 | 260 |
261 renderer->info.flags = | |
262 (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
|
263 |
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
|
264 #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
|
265 #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
|
266 /* 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
|
267 /* packed textures support, affected versions 6.3.2, 6.4.0, 6.4.1 */ |
3169 | 268 renderer->info.num_texture_formats = 2; |
269 renderer->info.texture_formats[0] = SDL_PIXELFORMAT_ABGR8888; | |
270 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
|
271 #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
|
272 #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
|
273 |
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
|
274 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
|
275 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
|
276 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
|
277 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
3688
6512cba48440
Fixed Cocoa and OpenGL builds
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
279 data->context = SDL_GL_CreateContext(window); |
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
|
280 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
|
281 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
|
282 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
|
283 } |
3688
6512cba48440
Fixed Cocoa and OpenGL builds
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
284 if (SDL_GL_MakeCurrent(window, data->context) < 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
|
285 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
|
286 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
|
287 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 (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
|
290 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
|
291 } 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
|
292 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
|
293 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 (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
|
295 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
|
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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
298 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
|
299 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
|
300 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
|
301 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
302 } |
3161
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
303 #if SDL_VIDEO_DRIVER_PANDORA |
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
304 data->GL_OES_draw_texture_supported = SDL_FALSE; |
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
305 data->useDrawTexture = SDL_FALSE; |
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
306 #else |
2753 | 307 if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) { |
308 data->GL_OES_draw_texture_supported = SDL_TRUE; | |
309 data->useDrawTexture = SDL_TRUE; | |
310 } else { | |
311 data->GL_OES_draw_texture_supported = SDL_FALSE; | |
312 data->useDrawTexture = SDL_FALSE; | |
313 } | |
3161
494559cc723b
OpenPandora support added by David Carré
Sam Lantinga <slouken@libsdl.org>
parents:
3139
diff
changeset
|
314 #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
|
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 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
|
317 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
|
318 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
|
319 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
|
320 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 /* 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
328 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
329 |
2753 | 330 static int |
331 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
|
332 { |
2753 | 333 |
334 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3641
diff
changeset
|
335 SDL_Window *window = renderer->window; |
2753 | 336 |
3688
6512cba48440
Fixed Cocoa and OpenGL builds
Sam Lantinga <slouken@libsdl.org>
parents:
3685
diff
changeset
|
337 if (SDL_GL_MakeCurrent(window, data->context) < 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
|
338 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
|
339 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
341 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
|
342 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
|
343 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
|
344 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
|
345 data->glViewport(0, 0, window->w, window->h); |
2753 | 346 data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0, |
347 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
|
348 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
|
349 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
351 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
354 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
|
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 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
|
357 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
359 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
|
360 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
363 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
|
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 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
|
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 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
|
368 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
|
369 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
371 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 static int |
3139 | 374 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
|
375 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 GLenum result; |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
382 |
2753 | 383 switch (texture->format) { |
4963
604077962776
Fixed screen texture format on Android
Sam Lantinga <slouken@libsdl.org>
parents:
4929
diff
changeset
|
384 case SDL_PIXELFORMAT_RGB24: |
3139 | 385 internalFormat = GL_RGB; |
386 format = GL_RGB; | |
387 type = GL_UNSIGNED_BYTE; | |
388 break; | |
4963
604077962776
Fixed screen texture format on Android
Sam Lantinga <slouken@libsdl.org>
parents:
4929
diff
changeset
|
389 case SDL_PIXELFORMAT_BGR888: |
2753 | 390 case SDL_PIXELFORMAT_ABGR8888: |
3139 | 391 internalFormat = GL_RGBA; |
392 format = GL_RGBA; | |
393 type = GL_UNSIGNED_BYTE; | |
394 break; | |
4985
047a580d30f3
Fixed blue-red channel swap in OpenGL ES 16-bit texture formats
Sam Lantinga <slouken@libsdl.org>
parents:
4963
diff
changeset
|
395 case SDL_PIXELFORMAT_RGB565: |
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
|
396 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
|
397 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
|
398 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
|
399 break; |
4985
047a580d30f3
Fixed blue-red channel swap in OpenGL ES 16-bit texture formats
Sam Lantinga <slouken@libsdl.org>
parents:
4963
diff
changeset
|
400 case SDL_PIXELFORMAT_RGBA5551: |
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
|
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_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
|
404 break; |
4985
047a580d30f3
Fixed blue-red channel swap in OpenGL ES 16-bit texture formats
Sam Lantinga <slouken@libsdl.org>
parents:
4963
diff
changeset
|
405 case SDL_PIXELFORMAT_RGBA4444: |
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
|
406 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
|
407 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
|
408 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
|
409 break; |
2753 | 410 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
|
411 SDL_SetError("Unsupported by OpenGL ES texture format"); |
2753 | 412 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
|
413 } |
2753 | 414 |
415 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
|
416 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
|
417 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
|
418 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
|
419 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
422 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
|
423 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
|
424 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
|
425 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
|
426 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
|
427 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
|
428 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
429 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
431 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
|
432 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
433 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
|
434 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
|
435 renderdata->glGenTextures(1, &data->texture); |
2753 | 436 |
437 data->type = GL_TEXTURE_2D; | |
438 /* no NPOV textures allowed in OpenGL ES (yet) */ | |
439 texture_w = power_of_2(texture->w); | |
440 texture_h = power_of_2(texture->h); | |
441 data->texw = (GLfloat) texture->w / texture_w; | |
442 data->texh = (GLfloat) texture->h / texture_h; | |
443 | |
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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 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
|
454 GL_CLAMP_TO_EDGE); |
2753 | 455 |
456 renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w, | |
457 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
|
458 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
|
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 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
|
461 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
|
462 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
|
463 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
|
464 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
465 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
|
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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
469 GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 470 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
|
471 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
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 *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
|
475 *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
|
476 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
|
477 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
478 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
480 GLES_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 481 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
|
482 { |
2753 | 483 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
|
484 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
|
485 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
486 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
488 GLES_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 489 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
|
490 { |
2753 | 491 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
|
492 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
|
493 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
494 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
495 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
|
496 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
|
497 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
|
498 { |
2753 | 499 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata; |
500 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
|
501 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
|
502 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
505 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
|
506 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
508 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
511 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
|
512 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
514 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
515 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
516 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
|
517 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
|
518 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
519 switch (texture->blendMode) { |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
520 case SDL_BLENDMODE_NONE: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
521 case SDL_BLENDMODE_MASK: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
522 case SDL_BLENDMODE_BLEND: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
523 case SDL_BLENDMODE_ADD: |
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 SDL_Unsupported(); |
2884
9dde605c7540
Date: Fri, 19 Dec 2008 20:17:35 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
528 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
|
529 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
|
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 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
534 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
|
535 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 switch (texture->scaleMode) { |
4929
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
537 case SDL_SCALEMODE_NONE: |
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
538 case SDL_SCALEMODE_FAST: |
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
539 case SDL_SCALEMODE_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
|
540 return 0; |
4929
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
541 case SDL_SCALEMODE_BEST: |
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
|
542 SDL_Unsupported(); |
4929
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
543 texture->scaleMode = SDL_SCALEMODE_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
|
544 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
|
545 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
|
546 SDL_Unsupported(); |
4929
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
547 texture->scaleMode = SDL_SCALEMODE_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
|
548 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
|
549 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 static int |
3139 | 553 GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
554 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
|
555 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
556 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
|
557 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
|
558 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
|
559 |
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
|
560 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
|
561 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
|
562 SetupTextureUpdate(renderdata, texture, pitch); |
2753 | 563 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
|
564 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
|
565 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
|
566 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
|
567 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
|
568 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
|
569 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
|
570 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
|
571 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
572 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
|
573 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
576 GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 577 const SDL_Rect * rect, int markDirty, void **pixels, |
578 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
|
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 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
|
581 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
583 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
|
584 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 *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
|
587 (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
|
588 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
|
589 *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
|
590 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
|
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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
594 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
|
595 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 static void |
2753 | 599 GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
600 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
|
601 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
603 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
|
604 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
605 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
|
606 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
|
607 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
608 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
609 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
610 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
|
611 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
|
612 { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
613 if (blendMode != data->blendMode) { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
614 switch (blendMode) { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
615 case SDL_BLENDMODE_NONE: |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
616 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
|
617 data->glDisable(GL_BLEND); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
618 break; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
619 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
|
620 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
|
621 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
|
622 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
|
623 /* 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
|
624 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
|
625 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
|
626 } |
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
|
627 /* fall through */ |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
628 case SDL_BLENDMODE_BLEND: |
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_MINUS_SRC_ALPHA); |
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_ADD: |
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_SRC_ALPHA, GL_ONE); |
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 case SDL_BLENDMODE_MOD: |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
639 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
|
640 data->glEnable(GL_BLEND); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
641 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
|
642 break; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
643 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
644 data->blendMode = blendMode; |
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 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
647 |
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
|
648 static int |
3641 | 649 GLES_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, |
650 int count) | |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
651 { |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
652 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
3547
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
653 int i; |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
654 GLshort *vertices; |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
655 |
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
|
656 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
|
657 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
658 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
|
659 (GLfloat) renderer->g * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
660 (GLfloat) renderer->b * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
661 (GLfloat) renderer->a * inv255f); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
662 |
3547
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
663 vertices = SDL_stack_alloc(GLshort, count*2); |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
664 for (i = 0; i < count; ++i) { |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
665 vertices[2*i+0] = (GLshort)points[i].x; |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
666 vertices[2*i+1] = (GLshort)points[i].y; |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
667 } |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
668 data->glVertexPointer(2, GL_SHORT, 0, vertices); |
2964 | 669 data->glEnableClientState(GL_VERTEX_ARRAY); |
3536
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
670 data->glDrawArrays(GL_POINTS, 0, count); |
2964 | 671 data->glDisableClientState(GL_VERTEX_ARRAY); |
3547
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
672 SDL_stack_free(vertices); |
2964 | 673 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
674 return 0; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
675 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
676 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
677 static int |
3641 | 678 GLES_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, |
679 int count) | |
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
|
680 { |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
681 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
3547
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
682 int i; |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
683 GLshort *vertices; |
2753 | 684 |
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
|
685 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
|
686 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
687 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
|
688 (GLfloat) renderer->g * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
689 (GLfloat) renderer->b * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
690 (GLfloat) renderer->a * inv255f); |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
691 |
3547
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
692 vertices = SDL_stack_alloc(GLshort, count*2); |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
693 for (i = 0; i < count; ++i) { |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
694 vertices[2*i+0] = (GLshort)points[i].x; |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
695 vertices[2*i+1] = (GLshort)points[i].y; |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
696 } |
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
697 data->glVertexPointer(2, GL_SHORT, 0, vertices); |
2964 | 698 data->glEnableClientState(GL_VERTEX_ARRAY); |
3536
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
699 if (count > 2 && |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
700 points[0].x == points[count-1].x && points[0].y == points[count-1].y) { |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
701 /* GL_LINE_LOOP takes care of the final segment */ |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
702 --count; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
703 data->glDrawArrays(GL_LINE_LOOP, 0, count); |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
704 } else { |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
705 data->glDrawArrays(GL_LINE_STRIP, 0, count); |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
706 } |
2964 | 707 data->glDisableClientState(GL_VERTEX_ARRAY); |
3547
8b18669c2663
Fixed building on iPhone
Sam Lantinga <slouken@libsdl.org>
parents:
3536
diff
changeset
|
708 SDL_stack_free(vertices); |
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
|
709 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
710 return 0; |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
711 } |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
712 |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
713 static int |
3641 | 714 GLES_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, |
715 int count) | |
716 { | |
717 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; | |
718 int i; | |
719 | |
720 GLES_SetBlendMode(data, renderer->blendMode, 1); | |
721 | |
722 data->glColor4f((GLfloat) renderer->r * inv255f, | |
723 (GLfloat) renderer->g * inv255f, | |
724 (GLfloat) renderer->b * inv255f, | |
725 (GLfloat) renderer->a * inv255f); | |
726 | |
727 data->glEnableClientState(GL_VERTEX_ARRAY); | |
728 for (i = 0; i < count; ++i) { | |
729 const SDL_Rect *rect = rects[i]; | |
730 GLshort minx = rect->x; | |
731 GLshort maxx = rect->x + rect->w; | |
732 GLshort miny = rect->y; | |
733 GLshort maxy = rect->y + rect->h; | |
734 GLshort vertices[8]; | |
735 vertices[0] = minx; | |
736 vertices[1] = miny; | |
737 vertices[2] = maxx; | |
738 vertices[3] = miny; | |
739 vertices[4] = minx; | |
740 vertices[5] = maxy; | |
741 vertices[6] = maxx; | |
742 vertices[7] = maxy; | |
743 | |
744 data->glVertexPointer(2, GL_SHORT, 0, vertices); | |
745 data->glDrawArrays(GL_LINE_LOOP, 0, 4); | |
746 } | |
747 data->glDisableClientState(GL_VERTEX_ARRAY); | |
748 | |
749 return 0; | |
750 } | |
751 | |
752 static int | |
753 GLES_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, | |
754 int count) | |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
755 { |
2753 | 756 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; |
3536
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
757 int i; |
2753 | 758 |
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
|
759 GLES_SetBlendMode(data, renderer->blendMode, 1); |
2753 | 760 |
2936
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
761 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
|
762 (GLfloat) renderer->g * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
763 (GLfloat) renderer->b * inv255f, |
066384910f50
iPhone build compiles again (drawing routines need to be implemented)
Sam Lantinga <slouken@libsdl.org>
parents:
2884
diff
changeset
|
764 (GLfloat) renderer->a * inv255f); |
2753 | 765 |
3536
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
766 data->glEnableClientState(GL_VERTEX_ARRAY); |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
767 for (i = 0; i < count; ++i) { |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
768 const SDL_Rect *rect = rects[i]; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
769 GLshort minx = rect->x; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
770 GLshort maxx = rect->x + rect->w; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
771 GLshort miny = rect->y; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
772 GLshort maxy = rect->y + rect->h; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
773 GLshort vertices[8]; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
774 vertices[0] = minx; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
775 vertices[1] = miny; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
776 vertices[2] = maxx; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
777 vertices[3] = miny; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
778 vertices[4] = minx; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
779 vertices[5] = maxy; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
780 vertices[6] = maxx; |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
781 vertices[7] = maxy; |
2964 | 782 |
3536
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
783 data->glVertexPointer(2, GL_SHORT, 0, vertices); |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
784 data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents:
3520
diff
changeset
|
785 } |
2964 | 786 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
|
787 |
2753 | 788 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
|
789 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.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 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
|
792 GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
2753 | 793 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
|
794 { |
2753 | 795 |
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
|
796 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
|
797 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
|
798 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
|
799 GLfloat minu, maxu, minv, maxv; |
2753 | 800 int i; |
801 void *temp_buffer; /* used for reformatting dirty rect pixels */ | |
802 void *temp_ptr; | |
803 | |
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
|
804 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
|
805 |
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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 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
|
811 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
812 SetupTextureUpdate(data, texture, pitch); |
2753 | 813 |
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
|
814 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
|
815 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
|
816 SDL_Rect *rect = &dirty->rect; |
2753 | 817 pixels = |
818 (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch + | |
819 rect->x * bpp); | |
820 /* There is no GL_UNPACK_ROW_LENGTH in OpenGLES | |
821 we must do this reformatting ourselves(!) | |
822 | |
823 maybe it'd be a good idea to keep a temp buffer around | |
824 for this purpose rather than allocating it each time | |
825 */ | |
4525
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
826 if( rect->x == 0 && rect->w * bpp == pitch ) { |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
827 temp_buffer = pixels; /* Updating whole texture, no need to reformat */ |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
828 } else { |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
829 temp_buffer = SDL_malloc(rect->w * rect->h * bpp); |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
830 temp_ptr = temp_buffer; |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
831 for (i = 0; i < rect->h; i++) { |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
832 SDL_memcpy(temp_ptr, pixels, rect->w * bpp); |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
833 temp_ptr += rect->w * bpp; |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
834 pixels += pitch; |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
835 } |
2753 | 836 } |
837 | |
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
|
838 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
|
839 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
|
840 texturedata->formattype, temp_buffer); |
2753 | 841 |
4525
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
842 if( temp_buffer != pixels ) { |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
843 SDL_free(temp_buffer); |
3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
844 } |
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
|
845 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
846 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
|
847 } |
2753 | 848 |
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
|
849 data->glBindTexture(texturedata->type, texturedata->texture); |
2753 | 850 |
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
|
851 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
|
852 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
|
853 (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
|
854 (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
|
855 (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
|
856 } 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
|
857 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
|
858 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
859 |
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
|
860 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
|
861 |
2753 | 862 switch (texture->scaleMode) { |
4929
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
863 case SDL_SCALEMODE_NONE: |
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
864 case SDL_SCALEMODE_FAST: |
2753 | 865 data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, |
866 GL_NEAREST); | |
867 data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, | |
868 GL_NEAREST); | |
869 break; | |
4929
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
870 case SDL_SCALEMODE_SLOW: |
aa8888658021
Use the enumerated type for blend and scale mode instead of int
Sam Lantinga <slouken@libsdl.org>
parents:
4525
diff
changeset
|
871 case SDL_SCALEMODE_BEST: |
2753 | 872 data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, |
873 GL_LINEAR); | |
874 data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, | |
875 GL_LINEAR); | |
876 break; | |
877 } | |
878 | |
879 if (data->GL_OES_draw_texture_supported && data->useDrawTexture) { | |
880 /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */ | |
3685
64ce267332c6
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
Sam Lantinga <slouken@libsdl.org>
parents:
3641
diff
changeset
|
881 SDL_Window *window = renderer->window; |
2753 | 882 GLint cropRect[4]; |
883 cropRect[0] = srcrect->x; | |
884 cropRect[1] = srcrect->y + srcrect->h; | |
885 cropRect[2] = srcrect->w; | |
886 cropRect[3] = -srcrect->h; | |
887 data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, | |
888 cropRect); | |
889 data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h, | |
890 0, dstrect->w, dstrect->h); | |
891 } else { | |
892 | |
893 minx = dstrect->x; | |
894 miny = dstrect->y; | |
895 maxx = dstrect->x + dstrect->w; | |
896 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
|
897 |
2753 | 898 minu = (GLfloat) srcrect->x / texture->w; |
899 minu *= texturedata->texw; | |
900 maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w; | |
901 maxu *= texturedata->texw; | |
902 minv = (GLfloat) srcrect->y / texture->h; | |
903 minv *= texturedata->texh; | |
904 maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h; | |
905 maxv *= texturedata->texh; | |
906 | |
907 GLshort vertices[8]; | |
908 GLfloat texCoords[8]; | |
909 | |
910 vertices[0] = minx; | |
911 vertices[1] = miny; | |
912 vertices[2] = maxx; | |
913 vertices[3] = miny; | |
914 vertices[4] = minx; | |
915 vertices[5] = maxy; | |
916 vertices[6] = maxx; | |
917 vertices[7] = maxy; | |
918 | |
919 texCoords[0] = minu; | |
920 texCoords[1] = minv; | |
921 texCoords[2] = maxu; | |
922 texCoords[3] = minv; | |
923 texCoords[4] = minu; | |
924 texCoords[5] = maxv; | |
925 texCoords[6] = maxu; | |
926 texCoords[7] = maxv; | |
927 | |
928 data->glVertexPointer(2, GL_SHORT, 0, vertices); | |
929 data->glEnableClientState(GL_VERTEX_ARRAY); | |
930 data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords); | |
931 data->glEnableClientState(GL_TEXTURE_COORD_ARRAY); | |
932 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
|
933 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
|
934 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
|
935 } |
2753 | 936 |
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
|
937 data->glDisable(GL_TEXTURE_2D); |
2753 | 938 |
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
|
939 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
|
940 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
941 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
942 static void |
3139 | 943 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
|
944 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
945 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
|
946 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
947 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
948 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
|
949 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
|
950 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
951 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
|
952 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
953 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
|
954 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
|
955 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
956 if (data->texture) { |
2753 | 957 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
|
958 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
959 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
|
960 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
|
961 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
962 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
|
963 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
|
964 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
|
965 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
966 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
967 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
|
968 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
|
969 { |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
970 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
|
971 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
972 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
|
973 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
|
974 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
|
975 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
976 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
|
977 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
978 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
|
979 } |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
980 |
3099
82e60908fab1
Date: Mon, 23 Mar 2009 09:17:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
2964
diff
changeset
|
981 #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
|
982 |
68862734a5fd
These files are similar in purpose and structure as SDL_renderer_gl.c and SDL_renderer_gl.h, except they use OpenGL ES 1.1 for rendering.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff
changeset
|
983 /* vi: set ts=4 sw=4 expandtab: */ |