annotate src/video/glesrenderer/SDL_renderer_gles.c @ 2462:012d60068901 gsoc2008_iphone

updated template script
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Mon, 18 Aug 2008 18:11:47 +0000
parents da4fd7cf8745
children
rev   line source
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
1 /*
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
4
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
9
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
13 Lesser General Public License for more details.
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
14
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
18
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
19 Sam Lantinga
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
20 slouken@libsdl.org
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
21 */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
22 #include "SDL_config.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
23
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
24 #if SDL_VIDEO_RENDER_OGL_ES
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
25
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
26 #include "SDL_video.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
27 #include "SDL_opengles.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
28 #include "SDL_sysvideo.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
29 #include "SDL_pixels_c.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
30 #include "SDL_rect_c.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
31 #include "SDL_yuv_sw_c.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
32
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
33 /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
34
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
35 static const float inv255f = 1.0f / 255.0f;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
36
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
37 static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
38 static int GLES_ActivateRenderer(SDL_Renderer * renderer);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
39 static int GLES_DisplayModeChanged(SDL_Renderer * renderer);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
40 static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
41 static int GLES_QueryTexturePixels(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
42 SDL_Texture * texture, void **pixels,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
43 int *pitch);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
44 static int GLES_SetTexturePalette(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
45 SDL_Texture * texture,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
46 const SDL_Color * colors, int firstcolor,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
47 int ncolors);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
48 static int GLES_GetTexturePalette(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
49 SDL_Texture * texture, SDL_Color * colors,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
50 int firstcolor, int ncolors);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
51 static int GLES_SetTextureColorMod(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
52 SDL_Texture * texture);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
53 static int GLES_SetTextureAlphaMod(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
54 SDL_Texture * texture);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
55 static int GLES_SetTextureBlendMode(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
56 SDL_Texture * texture);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
57 static int GLES_SetTextureScaleMode(SDL_Renderer * renderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
58 SDL_Texture * texture);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
59 static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
60 const SDL_Rect * rect, const void *pixels,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
61 int pitch);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
62 static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
63 const SDL_Rect * rect, int markDirty, void **pixels,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
64 int *pitch);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
65 static void GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
66 static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
67 int numrects, const SDL_Rect * rects);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
68 static int GLES_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
69 Uint8 a, const SDL_Rect * rect);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
70 static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
71 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
72 static void GLES_RenderPresent(SDL_Renderer * renderer);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
73 static void GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
74 static void GLES_DestroyRenderer(SDL_Renderer * renderer);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
75
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
76
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
77 SDL_RenderDriver GL_ES_RenderDriver = {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
78 GLES_CreateRenderer,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
79 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
80 "opengl_es",
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
81 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
82 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
83 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
84 SDL_TEXTUREMODULATE_ALPHA),
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
85 (SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
86 SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD |
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
87 SDL_TEXTUREBLENDMODE_MOD),
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
88 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST |
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
89 SDL_TEXTURESCALEMODE_SLOW), 2,
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
90 {
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
91 SDL_PIXELFORMAT_RGB24,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
92 SDL_PIXELFORMAT_ABGR8888,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
93 },
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
94 0,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
95 0}
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
96 };
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
97
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
98 typedef struct
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
99 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
100 SDL_GLContext context;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
101 SDL_bool updateSize;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
102 int blendMode;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
103
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
104 #ifndef APIENTRY
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
105 #define APIENTRY
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
106 #endif
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
107
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
108 SDL_bool useDrawTexture;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
109 SDL_bool GL_OES_draw_texture_supported;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
110
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
111 /* OpenGL ES functions */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
112 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
113 #include "SDL_glesfuncs.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
114 #undef SDL_PROC
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
115
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
116 } GLES_RenderData;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
117
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
118 typedef struct
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
119 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
120 GLuint texture;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
121 GLenum type;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
122 GLfloat texw;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
123 GLfloat texh;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
124 GLenum format;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
125 GLenum formattype;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
126 void *pixels;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
127 int pitch;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
128 SDL_DirtyRectList dirty;
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
129 } GLES_TextureData;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
130
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
131 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
132 GLES_SetError(const char *prefix, GLenum result)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
133 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
134 const char *error;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
135
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
136 switch (result) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
137 case GL_NO_ERROR:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
138 error = "GL_NO_ERROR";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
139 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
140 case GL_INVALID_ENUM:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
141 error = "GL_INVALID_ENUM";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
142 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
143 case GL_INVALID_VALUE:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
144 error = "GL_INVALID_VALUE";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
145 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
146 case GL_INVALID_OPERATION:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
147 error = "GL_INVALID_OPERATION";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
148 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
149 case GL_STACK_OVERFLOW:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
150 error = "GL_STACK_OVERFLOW";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
151 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
152 case GL_STACK_UNDERFLOW:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
153 error = "GL_STACK_UNDERFLOW";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
154 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
155 case GL_OUT_OF_MEMORY:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
156 error = "GL_OUT_OF_MEMORY";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
157 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
158 default:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
159 error = "UNKNOWN";
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
160 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
161 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
162 SDL_SetError("%s: %s", prefix, error);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
163 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
164
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
165 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
166 GLES_LoadFunctions(GLES_RenderData * data)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
167 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
168
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
169 #define SDL_PROC(ret,func,params) \
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
170 data->func = func;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
171 #include "SDL_glesfuncs.h"
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
172 #undef SDL_PROC
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
173
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
174 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
175 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
176
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
177 void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
178 GLES_AddRenderDriver(_THIS)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
179 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
180 if (_this->GL_CreateContext) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
181 SDL_AddRenderDriver(0, &GL_ES_RenderDriver);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
182 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
183 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
184
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
185 SDL_Renderer *
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
186 GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
187 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
188
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
189 SDL_Renderer *renderer;
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
190 GLES_RenderData *data;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
191 GLint value;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
192 int doublebuffer;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
193
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
194 if (!(window->flags & SDL_WINDOW_OPENGL)) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
195 if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
196 return NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
197 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
198 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
199
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
200 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
201 if (!renderer) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
202 SDL_OutOfMemory();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
203 return NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
204 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
205
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
206 data = (GLES_RenderData *) SDL_calloc(1, sizeof(*data));
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
207 if (!data) {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
208 GLES_DestroyRenderer(renderer);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
209 SDL_OutOfMemory();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
210 return NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
211 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
212
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
213 renderer->ActivateRenderer = GLES_ActivateRenderer;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
214 renderer->DisplayModeChanged = GLES_DisplayModeChanged;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
215 renderer->CreateTexture = GLES_CreateTexture;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
216 renderer->QueryTexturePixels = GLES_QueryTexturePixels;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
217 renderer->SetTexturePalette = GLES_SetTexturePalette;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
218 renderer->GetTexturePalette = GLES_GetTexturePalette;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
219 renderer->SetTextureColorMod = GLES_SetTextureColorMod;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
220 renderer->SetTextureAlphaMod = GLES_SetTextureAlphaMod;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
221 renderer->SetTextureBlendMode = GLES_SetTextureBlendMode;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
222 renderer->SetTextureScaleMode = GLES_SetTextureScaleMode;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
223 renderer->UpdateTexture = GLES_UpdateTexture;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
224 renderer->LockTexture = GLES_LockTexture;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
225 renderer->UnlockTexture = GLES_UnlockTexture;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
226 renderer->DirtyTexture = GLES_DirtyTexture;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
227 renderer->RenderFill = GLES_RenderFill;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
228 renderer->RenderCopy = GLES_RenderCopy;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
229 renderer->RenderPresent = GLES_RenderPresent;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
230 renderer->DestroyTexture = GLES_DestroyTexture;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
231 renderer->DestroyRenderer = GLES_DestroyRenderer;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
232 renderer->info = GL_ES_RenderDriver.info;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
233 renderer->window = window->id;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
234 renderer->driverdata = data;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
235
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
236
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
237 renderer->info.flags = (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
238
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
239 if (GLES_LoadFunctions(data) < 0) {
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
240 GLES_DestroyRenderer(renderer);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
241 return NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
242 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
243
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
244 data->context = SDL_GL_CreateContext(window->id);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
245 if (!data->context) {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
246 GLES_DestroyRenderer(renderer);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
247 return NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
248 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
249 if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
250 GLES_DestroyRenderer(renderer);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
251 return NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
252 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
253
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
254 if (flags & SDL_RENDERER_PRESENTVSYNC) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
255 SDL_GL_SetSwapInterval(1);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
256 } else {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
257 SDL_GL_SetSwapInterval(0);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
258 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
259 if (SDL_GL_GetSwapInterval() > 0) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
260 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
261 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
262
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
263 if (SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doublebuffer) == 0) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
264 if (!doublebuffer) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
265 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
266 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
267 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
268
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
269 if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
270 data->GL_OES_draw_texture_supported = SDL_TRUE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
271 data->useDrawTexture = SDL_TRUE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
272 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
273 else {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
274 data->GL_OES_draw_texture_supported = SDL_FALSE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
275 data->useDrawTexture = SDL_FALSE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
276 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
277
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
278 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
279 renderer->info.max_texture_width = value;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
280 data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
281 renderer->info.max_texture_height = value;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
282
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
283 /* Set up parameters for rendering */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
284 data->blendMode = -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
285 data->glDisable(GL_DEPTH_TEST);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
286 data->glDisable(GL_CULL_FACE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
287 data->glEnable(GL_TEXTURE_2D);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
288 data->updateSize = SDL_TRUE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
289
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
290 return renderer;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
291 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
292
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
293 static int GLES_ActivateRenderer(SDL_Renderer * renderer)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
294 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
295
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
296 GLES_RenderData *data = (GLES_RenderData *)renderer->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
297 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
2426
aad0c5ccf6bb Removed log messages
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2359
diff changeset
298
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
299 if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
300 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
301 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
302 if (data->updateSize) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
303 data->glMatrixMode(GL_PROJECTION);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
304 data->glLoadIdentity();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
305 data->glMatrixMode(GL_MODELVIEW);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
306 data->glLoadIdentity();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
307 data->glViewport(0, 0, window->w, window->h);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
308 data->glOrthof(0.0, (GLfloat)window->w, (GLfloat)window->h, 0.0,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
309 0.0, 1.0);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
310 data->updateSize = SDL_FALSE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
311 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
312 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
313 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
314
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
315 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
316 GLES_DisplayModeChanged(SDL_Renderer * renderer)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
317 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
318 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
319
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
320 data->updateSize = SDL_TRUE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
321 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
322 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
323
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
324 static __inline__ int
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
325 power_of_2(int input)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
326 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
327 int value = 1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
328
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
329 while (value < input) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
330 value <<= 1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
331 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
332 return value;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
333 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
334
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
335 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
336 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
337 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
338 GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
339 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
340 GLES_TextureData *data;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
341 GLint internalFormat;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
342 GLenum format, type;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
343 int texture_w, texture_h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
344 GLenum result;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
345 switch (texture->format) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
346 case SDL_PIXELFORMAT_INDEX1LSB:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
347 case SDL_PIXELFORMAT_INDEX1MSB:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
348 case SDL_PIXELFORMAT_INDEX8:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
349 case SDL_PIXELFORMAT_RGB332:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
350 case SDL_PIXELFORMAT_RGB444:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
351 case SDL_PIXELFORMAT_RGB555:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
352 case SDL_PIXELFORMAT_ARGB4444:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
353 case SDL_PIXELFORMAT_ARGB1555:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
354 case SDL_PIXELFORMAT_BGR24:
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
355 case SDL_PIXELFORMAT_BGR888:
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
356 case SDL_PIXELFORMAT_RGB888:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
357 case SDL_PIXELFORMAT_RGBA8888:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
358 case SDL_PIXELFORMAT_ARGB2101010:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
359 case SDL_PIXELFORMAT_ARGB8888:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
360 case SDL_PIXELFORMAT_RGB24:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
361 internalFormat = GL_RGB;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
362 format = GL_RGB;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
363 type = GL_UNSIGNED_BYTE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
364 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
365 case SDL_PIXELFORMAT_ABGR8888:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
366 internalFormat = GL_RGBA;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
367 format = GL_RGBA;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
368 type = GL_UNSIGNED_BYTE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
369 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
370 /*
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
371 These formats would be supported if SDL had the necessary pixel formats
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
372 case SDL_PIXELFORMAT_BGR565:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
373 internalFormat = GL_RGB;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
374 format = GL_RGB;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
375 type = GL_UNSIGNED_SHORT_5_6_5;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
376 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
377 case SDL_PIXELFORMAT_ABGR5551:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
378 internalFormat = GL_RGBA;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
379 format = GL_RGBA;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
380 type = GL_UNSIGNED_SHORT_5_5_5_1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
381 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
382 case SDL_PIXELFORMAT_ABGR4444:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
383 internalFormat = GL_RGBA;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
384 format = GL_RGBA;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
385 type = GL_UNSIGNED_SHORT_4_4_4_4;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
386 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
387 */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
388 default:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
389 SDL_SetError("Unsupported texture format");
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
390 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
391 }
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
392
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
393 data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
394 if (!data) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
395 SDL_OutOfMemory();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
396 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
397 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
398
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
399 if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
400 data->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
401 data->pixels = SDL_malloc(texture->h * data->pitch);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
402 if (!data->pixels) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
403 SDL_OutOfMemory();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
404 SDL_free(data);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
405 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
406 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
407 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
408
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
409 texture->driverdata = data;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
410
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
411 renderdata->glGetError();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
412 renderdata->glGenTextures(1, &data->texture);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
413
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
414 data->type = GL_TEXTURE_2D;
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
415 /* no NPOV textures allowed in OpenGL ES (yet) */
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
416 texture_w = power_of_2(texture->w);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
417 texture_h = power_of_2(texture->h);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
418 data->texw = (GLfloat) texture->w / texture_w;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
419 data->texh = (GLfloat) texture->h / texture_h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
420
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
421 data->format = format;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
422 data->formattype = type;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
423 renderdata->glBindTexture(data->type, data->texture);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
424 renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
425 GL_NEAREST);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
426 renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
427 GL_NEAREST);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
428 renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
429 GL_CLAMP_TO_EDGE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
430 renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
431 GL_CLAMP_TO_EDGE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
432
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
433 renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
434 texture_h, 0, format, type, NULL);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
435
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
436 result = renderdata->glGetError();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
437 if (result != GL_NO_ERROR) {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
438 GLES_SetError("glTexImage2D()", result);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
439 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
440 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
441 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
442 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
443
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
444 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
445 GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
446 void **pixels, int *pitch)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
447 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
448 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
449
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
450 *pixels = data->pixels;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
451 *pitch = data->pitch;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
452 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
453 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
454
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
455 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
456 GLES_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
457 const SDL_Color * colors, int firstcolor, int ncolors)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
458 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
459 SDL_SetError("OpenGL ES does not support paletted textures");
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
460 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
461 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
462
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
463 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
464 GLES_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
465 SDL_Color * colors, int firstcolor, int ncolors)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
466 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
467 SDL_SetError("OpenGL ES does not support paletted textures");
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
468 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
469 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
470
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
471 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
472 SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
473 int pitch)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
474 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
475
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
476
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
477 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
478 renderdata->glBindTexture(data->type, data->texture);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
479 renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
480 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
481
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
482 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
483 GLES_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
484 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
485 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
486 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
487
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
488 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
489 GLES_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
490 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
491 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
492 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
493
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
494 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
495 GLES_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
496 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
497 switch (texture->blendMode) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
498 case SDL_TEXTUREBLENDMODE_NONE:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
499 case SDL_TEXTUREBLENDMODE_MASK:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
500 case SDL_TEXTUREBLENDMODE_BLEND:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
501 case SDL_TEXTUREBLENDMODE_ADD:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
502 case SDL_TEXTUREBLENDMODE_MOD:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
503 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
504 default:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
505 SDL_Unsupported();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
506 texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
507 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
508 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
509 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
510
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
511 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
512 GLES_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
513 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
514 switch (texture->scaleMode) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
515 case SDL_TEXTURESCALEMODE_NONE:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
516 case SDL_TEXTURESCALEMODE_FAST:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
517 case SDL_TEXTURESCALEMODE_SLOW:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
518 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
519 case SDL_TEXTURESCALEMODE_BEST:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
520 SDL_Unsupported();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
521 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
522 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
523 default:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
524 SDL_Unsupported();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
525 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
526 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
527 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
528 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
529
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
530 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
531 GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
532 const SDL_Rect * rect, const void *pixels, int pitch)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
533 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
534 GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
535 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
536 GLenum result;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
537
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
538 SetupTextureUpdate(renderdata, texture, pitch);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
539 renderdata->glGetError();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
540 renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
541 rect->h, data->format, data->formattype,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
542 pixels);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
543 result = renderdata->glGetError();
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
544 if (result != GL_NO_ERROR) {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
545 GLES_SetError("glTexSubImage2D()", result);
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
546 return -1;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
547 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
548 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
549 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
550
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
551 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
552 GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
553 const SDL_Rect * rect, int markDirty, void **pixels,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
554 int *pitch)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
555 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
556 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
557
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
558 if (markDirty) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
559 SDL_AddDirtyRect(&data->dirty, rect);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
560 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
561
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
562 *pixels =
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
563 (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
564 rect->x * SDL_BYTESPERPIXEL(texture->format));
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
565 *pitch = data->pitch;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
566 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
567 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
568
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
569 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
570 GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
571 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
572 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
573
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
574 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
575 GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
576 const SDL_Rect * rects)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
577 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
578 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
579 int i;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
580
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
581 for (i = 0; i < numrects; ++i) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
582 SDL_AddDirtyRect(&data->dirty, &rects[i]);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
583 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
584 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
585
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
586 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
587 GLES_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
588 const SDL_Rect * rect)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
589 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
590
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
591 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
592 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
593
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
594 /* set proper drawing color */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
595 GLfloat oldClearColor[4];
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
596
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
597 data->glGetFloatv(GL_COLOR_CLEAR_VALUE, oldClearColor);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
598
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
599 data->glClearColor((GLclampf) r * inv255f, (GLclampf) g * inv255f,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
600 (GLclampf) b * inv255f, (GLclampf) a * inv255f);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
601
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
602 data->glScissor(rect->x, window->h - rect->y - rect->h, rect->w, rect->h);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
603 data->glEnable(GL_SCISSOR_TEST);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
604 data->glClear(GL_COLOR_BUFFER_BIT);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
605 data->glDisable(GL_SCISSOR_TEST);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
606
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
607 /* reset clear color */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
608 data->glClearColor(oldClearColor[0], oldClearColor[1], oldClearColor[2], oldClearColor[2]);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
609
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
610 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
611 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
612
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
613 static int
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
614 GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
615 const SDL_Rect * srcrect, const SDL_Rect * dstrect)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
616 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
617
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
618 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
619 GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
620 int minx, miny, maxx, maxy;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
621 GLfloat minu, maxu, minv, maxv;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
622 int i;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
623 void *temp_buffer; /* used for reformatting dirty rect pixels */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
624 void *temp_ptr;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
625
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
626 if (texturedata->dirty.list) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
627 SDL_DirtyRect *dirty;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
628 void *pixels;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
629 int bpp = SDL_BYTESPERPIXEL(texture->format);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
630 int pitch = texturedata->pitch;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
631
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
632 SetupTextureUpdate(data, texture, pitch);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
633
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
634 data->glBindTexture(texturedata->type, texturedata->texture);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
635 for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
636 SDL_Rect *rect = &dirty->rect;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
637 pixels = (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch + rect->x * bpp);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
638 /* There is no GL_UNPACK_ROW_LENGTH in OpenGLES
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
639 we must do this reformatting ourselves(!)
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
640
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
641 maybe it'd be a good idea to keep a temp buffer around
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
642 for this purpose rather than allocating it each time
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
643 */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
644 temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
645 temp_ptr = temp_buffer;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
646 for (i=0; i<rect->h; i++) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
647 SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
648 temp_ptr += rect->w * bpp;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
649 pixels += pitch;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
650 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
651
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
652 data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
653 rect->w, rect->h, texturedata->format,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
654 texturedata->formattype, temp_buffer);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
655
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
656 SDL_free(temp_buffer);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
657
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
658 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
659 SDL_ClearDirtyRects(&texturedata->dirty);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
660 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
661
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
662 data->glBindTexture(texturedata->type, texturedata->texture);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
663 data->glEnable(GL_TEXTURE_2D);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
664
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
665 if (texture->modMode) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
666 data->glColor4f((GLfloat) texture->r * inv255f,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
667 (GLfloat) texture->g * inv255f,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
668 (GLfloat) texture->b * inv255f,
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
669 (GLfloat) texture->a * inv255f);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
670 } else {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
671 data->glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
672 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
673
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
674 if (texture->blendMode != data->blendMode) {
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
675 switch (texture->blendMode) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
676 case SDL_TEXTUREBLENDMODE_NONE:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
677 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
678 data->glDisable(GL_BLEND);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
679 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
680 case SDL_TEXTUREBLENDMODE_MASK:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
681 case SDL_TEXTUREBLENDMODE_BLEND:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
682 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
683 data->glEnable(GL_BLEND);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
684 data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
685 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
686 case SDL_TEXTUREBLENDMODE_ADD:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
687 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
688 data->glEnable(GL_BLEND);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
689 data->glBlendFunc(GL_SRC_ALPHA, GL_ONE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
690 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
691 case SDL_TEXTUREBLENDMODE_MOD:
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
692 data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
693 data->glEnable(GL_BLEND);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
694 data->glBlendFunc(GL_ZERO, GL_SRC_COLOR);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
695 break;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
696 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
697 data->blendMode = texture->blendMode;
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
698 }
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
699
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
700 switch (texture->scaleMode) {
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
701 case SDL_TEXTURESCALEMODE_NONE:
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
702 case SDL_TEXTURESCALEMODE_FAST:
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
703 data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
704 GL_NEAREST);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
705 data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
706 GL_NEAREST);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
707 break;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
708 case SDL_TEXTURESCALEMODE_SLOW:
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
709 case SDL_TEXTURESCALEMODE_BEST:
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
710 data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
711 GL_LINEAR);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
712 data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
713 GL_LINEAR);
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
714 break;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
715 }
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
716
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
717 if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
718 /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
719 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
720 GLint cropRect[4];
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
721 cropRect[0] = srcrect->x;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
722 cropRect[1] = srcrect->y + srcrect->h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
723 cropRect[2] = srcrect->w;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
724 cropRect[3] = -srcrect->h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
725 data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
726 data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h, 0, dstrect->w, dstrect->h);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
727 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
728 else {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
729
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
730 minx = dstrect->x;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
731 miny = dstrect->y;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
732 maxx = dstrect->x + dstrect->w;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
733 maxy = dstrect->y + dstrect->h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
734
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
735 minu = (GLfloat) srcrect->x / texture->w;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
736 minu *= texturedata->texw;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
737 maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
738 maxu *= texturedata->texw;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
739 minv = (GLfloat) srcrect->y / texture->h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
740 minv *= texturedata->texh;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
741 maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
742 maxv *= texturedata->texh;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
743
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
744 GLshort vertices[8];
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
745 GLfloat texCoords[8];
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
746
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
747 vertices[0] = minx; vertices[1] = miny;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
748 vertices[2] = maxx; vertices[3] = miny;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
749 vertices[4] = minx; vertices[5] = maxy;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
750 vertices[6] = maxx; vertices[7] = maxy;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
751
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
752 texCoords[0] = minu; texCoords[1] = minv;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
753 texCoords[2] = maxu; texCoords[3] = minv;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
754 texCoords[4] = minu; texCoords[5] = maxv;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
755 texCoords[6] = maxu; texCoords[7] = maxv;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
756
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
757 data->glVertexPointer(2, GL_SHORT, 0, vertices);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
758 data->glEnableClientState(GL_VERTEX_ARRAY);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
759 data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
760 data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
761 data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
762
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
763 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
764
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
765 return 0;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
766 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
767
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
768 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
769 GLES_RenderPresent(SDL_Renderer * renderer)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
770 {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
771 SDL_GL_SwapWindow(renderer->window);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
772 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
773
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
774 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
775 GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
776 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
777 GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
778 GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
779
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
780 if (!data) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
781 return;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
782 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
783 if (data->texture) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
784 glDeleteTextures(1, &data->texture);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
785 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
786 if (data->pixels) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
787 SDL_free(data->pixels);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
788 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
789 SDL_FreeDirtyRects(&data->dirty);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
790 SDL_free(data);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
791 texture->driverdata = NULL;
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
792 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
793
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
794 static void
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
795 GLES_DestroyRenderer(SDL_Renderer * renderer)
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
796 {
2456
da4fd7cf8745 Renamed functions and structures to GLES (rather than GL) to avoid confusion with the OpenGL renderer, which prior used the same names. Removed references to GL_IMG_texture_format_BGRA8888, which will not be supported here. Made it so renderer no longer caches texture filter mode, because I think that is actually bound to specific textures, so we'd need to cache the currently bound texture too ... I don't want to go through that trouble. DOES cache blend function though.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2426
diff changeset
797 GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
2359
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
798
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
799 if (data) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
800 if (data->context) {
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
801 /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
802 SDL_GL_DeleteContext(data->context);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
803 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
804 SDL_free(data);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
805 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
806 SDL_free(renderer);
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
807 }
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
808
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
809 #endif /* SDL_VIDEO_RENDER_OGL */
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
810
b70b96e615d2 These files are the OpenGL ES render driver. You should be able to use them on any platform that supports OpenGL ES -- not just iPhone. The driver is based off the OpenGL render driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
811 /* vi: set ts=4 sw=4 expandtab: */