From 06d30e79d527d8e02b09893480905ad0032e6d7e Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 7 Jul 2012 22:35:16 +0200 Subject: [PATCH] add missing SDL/gles* files --- .gitignore | 1 - src/SDL/.hg/cache/tags | 5 +- src/SDL/.hg/dirstate | Bin 54169 -> 54169 bytes src/SDL/src/render/nds/SDL_libgl2D.c | 315 ++++++++++++++++++ src/SDL/src/render/nds/SDL_libgl2D.h | 154 +++++++++ src/SDL/src/render/opengles/SDL_glesfuncs.h | 40 +++ src/SDL/src/render/opengles2/SDL_gles2funcs.h | 47 +++ 7 files changed, 559 insertions(+), 3 deletions(-) create mode 100644 src/SDL/src/render/nds/SDL_libgl2D.c create mode 100644 src/SDL/src/render/nds/SDL_libgl2D.h create mode 100644 src/SDL/src/render/opengles/SDL_glesfuncs.h create mode 100644 src/SDL/src/render/opengles2/SDL_gles2funcs.h diff --git a/.gitignore b/.gitignore index ed224e2..732dfc3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.swp Python-* freetype-* -SDL_* build/* src/SDL/Xcode-iPhoneOS/SDL/build/ tmp/* diff --git a/src/SDL/.hg/cache/tags b/src/SDL/.hg/cache/tags index 1ad4323..0f4a093 100644 --- a/src/SDL/.hg/cache/tags +++ b/src/SDL/.hg/cache/tags @@ -1,5 +1,5 @@ -6098 c781fe3628a1d9ebfe5beb62dabf551fcef053aa a1616a61e966c1b1136d6ca57a0e7165441d603a -6087 185f8588deaa9c9790cb91730eb6e59dd9a27392 +6309 f4e14c811fd52e34ee70aaebdd812965c17cb192 a1616a61e966c1b1136d6ca57a0e7165441d603a +6308 2b923729fd01d34b3913bd4ac8458c7121825f78 bb426bf40cac1882c852d81a696d72abf05ee755 5551 b95bb58b703af987349d3603a7d008e11a061d7a a1616a61e966c1b1136d6ca57a0e7165441d603a 5079 f2d8e0b59ccac6688e7a5c89399f7c842507968e a1616a61e966c1b1136d6ca57a0e7165441d603a 4416 06be4b33029d9e4012380084dd37dc1730062921 @@ -29,3 +29,4 @@ bb051fa871aa0b53ea57df56a446cec3bb85924c release-1.2.2 4867f7f7dd3426d1dbbeef48b3f3b3aa19590cc4 release-1.2.12 7c2589fb8d4df54c6faabd3faebd0c0e73f67879 release-1.2.13 f14cf9d71233934811774f941d0de121d5f96ccf release-1.2.14 +fba40d9f4a733e0cbf9197a0b1d19f9cff138f99 release-1.2.15 diff --git a/src/SDL/.hg/dirstate b/src/SDL/.hg/dirstate index 28efee18942d4fc1179d3aca45d2b1994926ddb3..618946b3c8ec3266fef8aae8d3fbe9a539457983 100644 GIT binary patch delta 2663 zcmY+Gc~n&Q9mRRWz9`$U2n;Yf!#2#uj)D&0f)PbP1ymvg1`%YDHN=>j2+_C#9~E(f zxZsY$i~EMPE(DcGG)B{7H0g<{O?tGkC;g+<&d{FI=Kc51d+)p4d*8jkjsun*2P{w2 z3s^dY@Ir_r?eisKpTyBpxJ^cEFilr{aI|@bOfiMO*@Q47NR7-^OUY0oXYVShwSCHC zO(YfC6h5^Bw}pBZ*k|#$Tg?&sKfI8z>62XQszn3=7LUj=7QXl=Hp$Q zE0%g#3ZpG7-u(Bnu&@|M?|OGOdV2AdXBY36$q@R&*yHsbF?S}>?0uA+F_%d?6~Unm z(MWxw=~+C1E}tCazUlP(e$L^OdTM6M#ZJE^0pVvB}ycs~9zt-V@{V;sy z#Wnx0B^Ld>2-L74@C~1g3K7@KzZFO?jWka@ej1(oy)e9Mi*B41x5s5+RJ>%9GK!wV z!CY0U_1m%R6!JV| zP-0<$wm@bzYf5$&4J~h>3Oj^@s$OE-OkQ|6Ug48*3rb)?_(L+6E}~Jb5+A9p1m@cL zGg_O+mPtNru#?iO-HUU1FduB3K($UUKF~!890>}SNZ0aoeJsTh+XB{- z*RnXyi=qJXM>+9@yBz1ua#AdS6apr5VcBT2`&c$n7GwT?2J+fY}pn;e{_Sy z`V<-0RN|=^1Z103oajsDEy*zwRFL9N!p+Lrq?T$EFxr!f; zZ<&srF@Z8?(=A z_?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_p_Rfm=W=;l`GBBv7xyl?N*i+q3w%)#$L*<5-)3?D z91ku`b7yP2FN3E4m*sfjH)^rF6ehs?WPEijLl7 zbVsBAK*RlwJ{%uXf_%qJyb50DpzBmTGClcempy$2Da`0mW17=Os%JDYZ-xz&6MUSZ zc>x$s_)4{J{vdEmF`D+mNMhg9q9|(M+u?HlU35~kb$oG|V}oNv=d&-DcEWtZij6$e zs^}=zzmWPo#930$?-O`Z{R-1dcJRxh(E~a*-Q<=8peTJE$2gO;z0_IYL0LZbm*QBq zvy{eiu(22**t~jR`-TOyBo8O7qDA!Z;%H^0kk8PCuToW@q+_8gj~1rTnHwnhao5qp z%f-XEv)zTAl^N`uV8m3F%9&$f(#ooG0o7t1@9tAdU5h6P*koG_897X{U795h=nT@- zFVjf9Z>zcZ63 z%_ergGmqHSN)iq#$X&e&&1^3oCVSA-=`8)a+S25bPeP=?wU-6fFW2(pyKnG?vx<-Q zhBN)Rnev(>?smm-*KFa_Wd-6aFP_)b(7f&s?$$gp^rs`;oKL#RKc-6Qca520FJ6!#(JH?;3wEmrFnGbQMTU4#3pBe&8_cb(~H0;n3cZI9}7DX(`|<{|I_p zy0~e%;+`$G^lb9w)b3;^zpdbvJ>k~Eu_Bz6O1n3T3o9&zM4Ja_6Xi5c z9?bN%D72AL3~8^W>P9SoM5{U8KAmwLzO<%ANEMj zzUGN+J;S?0NUr3L@DuG{s`$jCAYo%QF`EPQn+Pp^d2 g@@WMX_5sX`4`#}>38ZaEVn%-z7Z+-Y{%q#|0EWO(NdN!< diff --git a/src/SDL/src/render/nds/SDL_libgl2D.c b/src/SDL/src/render/nds/SDL_libgl2D.c new file mode 100644 index 0000000..7ba9be0 --- /dev/null +++ b/src/SDL/src/render/nds/SDL_libgl2D.c @@ -0,0 +1,315 @@ +/* + * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D, + * with permission of the original author. The following is mostly his + * code/comments. + * + * + * Easy GL2D + * + * Relminator 2010 + * Richard Eric M. Lope BSN RN + * + * http://rel.betterwebber.com + * + * A very small and simple DS rendering lib using the 3d core to render 2D stuff + */ +#include "SDL_config.h" + +#if SDL_VIDEO_RENDER_NDS + +#include "SDL_libgl2D.h" + +/* + * Our static global variable used for Depth values since we cannot + * disable depth testing in the DS hardware This value is incremented + * for every draw call. */ +v16 g_depth; +int gCurrentTexture; + +/* + * !!! PRIVATE !!! Set orthographic projection at 1:1 correspondence + * to screen coords glOrtho expects f32 values but if we use the + * standard f32 values, we need to rescale either every vert or the + * modelview matrix by the same amount to make it work. That's gonna + * give us lots of overflows and headaches. So we "scale down" and + * use an all integer value. + */ +void SetOrtho(void) +{ + glMatrixMode(GL_PROJECTION); // set matrixmode to projection + glLoadIdentity(); // reset + glOrthof32(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -1 << 12, 1 << 12); // downscale projection matrix +} + +/* + * Initializes GL in 2D mode Also initializes GL in 3d mode so that we + * could combine 2D and 3D later Almost a direct copy from the DS + * example files + */ +void glScreen2D(void) +{ + // initialize gl + glInit(); + + // enable textures + glEnable(GL_TEXTURE_2D); + + // enable antialiasing + glEnable(GL_ANTIALIAS); + + // setup the rear plane + glClearColor(0, 0, 0, 31); // BG must be opaque for AA to work + glClearPolyID(63); // BG must have a unique polygon ID for AA to work + + glClearDepth(GL_MAX_DEPTH); + + // this should work the same as the normal gl call + glViewport(0,0,255,191); + + // any floating point gl call is being converted to fixed prior to being implemented + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(70, 256.0 / 192.0, 1, 200); + + gluLookAt( 0.0, 0.0, 1.0, //camera possition + 0.0, 0.0, 0.0, //look at + 0.0, 1.0, 0.0); //up + + glMaterialf(GL_AMBIENT, RGB15(31,31,31)); + glMaterialf(GL_DIFFUSE, RGB15(31,31,31)); + glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31)); + glMaterialf(GL_EMISSION, RGB15(31,31,31)); + + // ds uses a table for shinyness..this generates a half-ass one + glMaterialShinyness(); + + // not a real gl function and will likely change + glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK); +} + +/* + * Sets up OpenGL for 2d rendering Call this before drawing any of + * GL2D's drawing or sprite functions. + */ +void glBegin2D(void) +{ + // save 3d perpective projection matrix + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + + // save 3d modelview matrix for safety + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + + + // what?!! No glDisable(GL_DEPTH_TEST)?!!!!!! + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glDisable(GL_ANTIALIAS); // disable AA + glDisable(GL_OUTLINE); // disable edge-marking + + glColor(0x7FFF); // max color + + glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); // no culling + + SetOrtho(); + + glMatrixMode(GL_TEXTURE); // reset texture matrix just in case we did some funky stuff with it + glLoadIdentity(); + + glMatrixMode(GL_MODELVIEW); // reset modelview matrix. No need to scale up by << 12 + glLoadIdentity(); + + gCurrentTexture = 0; // set current texture to 0 + g_depth = 0; // set depth to 0. We need this var since we cannot disable depth testing +} + +/* + * Issue this after drawing 2d so that we don't mess the matrix stack. + * The complement of glBegin2D. + */ +void glEnd2D(void) +{ + // restore 3d matrices and set current matrix to modelview + glMatrixMode(GL_PROJECTION); + glPopMatrix(1); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(1); +} + +/* + * Draws a pixel + * Parameters: + * x,y -> First coordinate of the line + * color -> RGB15/ARGB16 color + */ +void glPutPixel(int x, int y, int color) +{ + glBindTexture(0, 0); + glColor(color); + glBegin(GL_TRIANGLES); + gxVertex3i(x, y, g_depth); + gxVertex2i(x, y); + gxVertex2i(x, y); + glEnd(); + glColor(0x7FFF); + g_depth++; + gCurrentTexture = 0; +} + +/* + * Draws a line + * Parameters: + * x1,y1 -> First coordinate of the line + * x2,y2 -> Second coordinate of the line + * color -> RGB15/ARGB16 color + */ +void glLine(int x1, int y1, int x2, int y2, int color) +{ + x2++; + y2++; + + glBindTexture(0, 0); + glColor(color); + glBegin(GL_TRIANGLES); + gxVertex3i(x1, y1, g_depth); + gxVertex2i(x2, y2); + gxVertex2i(x2, y2); + glEnd(); + glColor(0x7FFF); + g_depth++; + gCurrentTexture = 0; +} + +/* + * Draws a Filled Box + * Parameters: + * x1,y1 -> Top-left corner of the box + * x2,y2 -> Bottom-Right corner of the box + * color -> RGB15/ARGB16 color +*/ +void glBoxFilled(int x1, int y1, int x2, int y2, int color) +{ + x2++; + y2++; + + glBindTexture(0, 0); + glColor(color); + glBegin(GL_QUADS); + gxVertex3i(x1, y1, g_depth); // use 3i for first vertex so that we increment HW depth + gxVertex2i(x1, y2); // no need for 3 vertices as 2i would share last depth call + gxVertex2i(x2, y2); + gxVertex2i(x2, y1); + glEnd(); + glColor(0x7FFF); + g_depth++; + gCurrentTexture = 0; +} + +/* + * + * Create a tile. + * Very rigid and prone to human error. + * + * Parameters: + * *sprite -> pointer to a glImage + * texture_width -> width/height of the texture; + * texture_height -> valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d) + * sprite_width + * sprite_height -> width/height of the picture in the texture. + * type -> The format of the texture (see glTexImage2d) + * param -> parameters for the texture (see glTexImage2d) + */ +int glLoadTile(glImage *sprite, + int texture_width, + int texture_height, + int sprite_width, + int sprite_height, + GL_TEXTURE_TYPE_ENUM type, + int param, + int pallette_width, + const u16 *palette, + const uint8 *texture) +{ + int textureID; + + glGenTextures(1, &textureID); + glBindTexture(0, textureID); + glTexImage2D(0, 0, type, texture_width, texture_height, 0, param, texture); + glColorTableEXT(0, 0, pallette_width, 0, 0, palette); + + sprite->width = sprite_width; + sprite->height = sprite_height; + sprite->textureID = textureID; + + return textureID; +} + +/* + * I made this since the scale wrappers are either the vectorized mode + * or does not permit you to scale only the axis you want to + * scale. Needed for sprite scaling. + */ +static inline void gxScalef32(s32 x, s32 y, s32 z) +{ + MATRIX_SCALE = x; + MATRIX_SCALE = y; + MATRIX_SCALE = z; +} + +/* + * I this made for future naming conflicts. + */ +static inline void gxTranslate3f32(int32 x, int32 y, int32 z) +{ + MATRIX_TRANSLATE = x; + MATRIX_TRANSLATE = y; + MATRIX_TRANSLATE = z; +} + +/* + * Draws an axis exclusive scaled sprite + * Parameters: + * x -> x position of the sprite + * y -> y position of the sprite + * scaleX -> 20.12 FP X axis scale value (1 << 12 is normal) + * scaleY -> 20.12 FP Y axis scale value (1 << 12 is normal) + * flipmode -> mode for flipping (see GL_FLIP_MODE enum) + * *spr -> pointer to a glImage + */ +void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr) +{ + const int x1 = 0; + const int y1 = 0; + const int x2 = spr->width; + const int y2 = spr->height; + const int u1 = ((flipmode & GL_FLIP_H) ? spr->width-1 : 0); + const int u2 = ((flipmode & GL_FLIP_H) ? 0 : spr->width-1); + const int v1 = ((flipmode & GL_FLIP_V) ? spr->height-1 : 0); + const int v2 = ((flipmode & GL_FLIP_V) ? 0 : spr->height-1); + + if (spr->textureID != gCurrentTexture) + { + glBindTexture(GL_TEXTURE_2D, spr->textureID); + gCurrentTexture = spr->textureID; + } + + glPushMatrix(); + + gxTranslate3f32(x, y, 0); + gxScalef32(scaleX, scaleY, 1 << 12); + + glBegin(GL_QUADS); + + gxTexcoord2i(u1, v1); gxVertex3i(x1, y1, g_depth); + gxTexcoord2i(u1, v2); gxVertex2i(x1, y2); + gxTexcoord2i(u2, v2); gxVertex2i(x2, y2); + gxTexcoord2i(u2, v1); gxVertex2i(x2, y1); + + glEnd(); + + glPopMatrix(1); + g_depth++; +} + +#endif /* SDL_VIDEO_RENDER_NDS */ diff --git a/src/SDL/src/render/nds/SDL_libgl2D.h b/src/SDL/src/render/nds/SDL_libgl2D.h new file mode 100644 index 0000000..4d56f0e --- /dev/null +++ b/src/SDL/src/render/nds/SDL_libgl2D.h @@ -0,0 +1,154 @@ +/* + * Note: The Nintendo DS port to SDL uses excerpts from the libGL2D, + * with permission of the original author. The following is mostly his + * code/comments. + * + * + * Easy GL2D + * + * Relminator 2010 + * Richard Eric M. Lope BSN RN + * + * http://rel.betterwebber.com + * + * A very small and simple DS rendering lib using the 3d core to render 2D stuff + */ +#include "SDL_config.h" + +#if SDL_VIDEO_RENDER_NDS + +#include + +/* LibGL extension(s) */ +static inline void gxTexcoord2i(t16 u, t16 v) +{ + GFX_TEX_COORD = (v << 20) | ((u << 4) & 0xFFFF); +} + +static inline void gxVertex3i(v16 x, v16 y, v16 z) +{ + GFX_VERTEX16 = (y << 16) | (x & 0xFFFF); + GFX_VERTEX16 = ((uint32)(uint16)z); +} + +static inline void gxVertex2i(v16 x, v16 y) +{ + GFX_VERTEX_XY = (y << 16) | (x & 0xFFFF); +} + +/* + * Enums selecting flipping mode. + * + * These enums are bits for flipping the sprites. + * You can "|" (or) GL_FLIP_V and GL_FLIP_H to flip + * both ways. + */ +typedef enum +{ + GL_FLIP_NONE = (1 << 0), /* No flipping */ + GL_FLIP_V = (1 << 1), /* Sprite is rendered vertically flipped */ + GL_FLIP_H = (1 << 2), /* Sprite is rendered horizontally flipped */ +} GL_FLIP_MODE; + +/* Struct for out GL-Based Images. */ +typedef struct +{ + int width; /* Width of the Sprite */ + int height; /* Height of the Sprite */ + int textureID; /* Texture handle (used in glDeleteTextures()) + The texture handle in VRAM (returned by glGenTextures()) + ie. This references the actual texture stored in VRAM. */ +} glImage; + +extern v16 g_depth; +extern int gCurrentTexture; + +/* + * Draws an Axis Exclusive Scaled Sprite + * Parameters: + * x X position of the sprite. + * y Y position of the sprite. + * scaleX 20.12 fixed-point X-Axis scale value (1 << 12 is normal). + * scaleY 20.12 fixed-point Y-Axis scale value (1 << 12 is normal). + * flipmode mode for flipping (see GL_FLIP_MODE enum). + * *spr pointer to a glImage. +*/ +void glSpriteScaleXY(int x, int y, s32 scaleX, s32 scaleY, int flipmode, const glImage *spr); + +/* Initializes our Tileset (like glInitSpriteset()) but without the use of Texture Packer auto-generated files. + * Can only be used when tiles in a tilset are of the same dimensions. + * Parameters: + * *sprite Pointer to an array of glImage. + * tile_wid Width of each tile in the texture. + * tile_hei Height of each tile in the texture. + * bmp_wid Width of of the texture or tileset. + * bmp_hei height of of the texture or tileset. + * type The format of the texture (see glTexImage2d()). + * sizeX The horizontal size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()). + * sizeY The vertical size of the texture; valid sizes are enumerated in GL_TEXTURE_TYPE_ENUM (see glTexImage2d()). + * param parameters for the texture (see glTexImage2d()). + * pallette_width Length of the palette. Valid values are 4, 16, 32, 256 (if 0, then palette is removed from currently bound texture). + * *palette Pointer to the palette data to load (if NULL, then palette is removed from currently bound texture). + * *texture Pointer to the texture data to load. +*/ +int glLoadTile(glImage *sprite, + int texture_width, + int texture_height, + int sprite_width, + int sprite_height, + GL_TEXTURE_TYPE_ENUM type, + int param, + int pallette_width, + const u16 *palette, + const uint8 *texture); + +/* Initializes GL in 2D mode */ +void glScreen2D(void); + +/* + * Sets up OpenGL for 2d rendering. + * + * Call this before drawing any of GL2D's drawing or sprite functions. + */ +void glBegin2D(void); + +/* + * Issue this after drawing 2d so that we don't mess the matrix stack. + * + * The complement of glBegin2D(). + */ +void glEnd2D(void); + +/* + * Draws a Pixel + * x X position of the pixel. + * y Y position of the pixel. + * color RGB15/ARGB16 color. + */ +void glPutPixel(int x, int y, int color); + +/* + * Draws a Line + * x1,y1 Top-Left coordinate of the line. + * x2,y2 Bottom-Right coordinate of the line. + * color RGB15/ARGB16 color. + */ +void glLine(int x1, int y1, int x2, int y2, int color); + +/* + * Draws a Box + * x1,y1 Top-Left coordinate of the box. + * x2,y2 Bottom-Right coordinate of the box. + * color RGB15/ARGB16 color. +*/ +void glBox(int x1, int y1, int x2, int y2, int color); + +/* + * Draws a Filled Box + * x1,y1 Top-Left coordinate of the box. + * x2,y2 Bottom-Right coordinate of the box. + * color RGB15/ARGB16 color. + */ +void glBoxFilled(int x1, int y1, int x2, int y2, int color); + +#endif /* SDL_VIDEO_RENDER_NDS */ diff --git a/src/SDL/src/render/opengles/SDL_glesfuncs.h b/src/SDL/src/render/opengles/SDL_glesfuncs.h new file mode 100644 index 0000000..aab15a1 --- /dev/null +++ b/src/SDL/src/render/opengles/SDL_glesfuncs.h @@ -0,0 +1,40 @@ +SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glClear, (GLbitfield)) +SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) +SDL_PROC(void, glColor4f, (GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *)) +SDL_PROC(void, glDisable, (GLenum)) +SDL_PROC(void, glDisableClientState, (GLenum array)) +SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei)) +SDL_PROC(void, glDrawTexiOES, (GLint, GLint, GLint, GLint, GLint)) +SDL_PROC(void, glEnable, (GLenum)) +SDL_PROC(void, glEnableClientState, (GLenum)) +SDL_PROC(void, glFinish, (void)) +SDL_PROC(void, glGenFramebuffersOES, (GLsizei, GLuint *)) +SDL_PROC(void, glGenTextures, (GLsizei, GLuint *)) +SDL_PROC(GLenum, glGetError, (void)) +SDL_PROC(void, glGetIntegerv, (GLenum, GLint *)) +SDL_PROC(void, glLoadIdentity, (void)) +SDL_PROC(void, glMatrixMode, (GLenum)) +SDL_PROC(void, glOrthof, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glPixelStorei, (GLenum, GLint)) +SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) +SDL_PROC(void, glTexCoordPointer, (GLint, GLenum, GLsizei, const GLvoid *)) +SDL_PROC(void, glTexEnvf, (GLenum, GLenum, GLfloat)) +SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) +SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) +SDL_PROC(void, glTexParameteriv, (GLenum, GLenum, const GLint *)) +SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) +SDL_PROC(void, glVertexPointer, (GLint, GLenum, GLsizei, const GLvoid *)) +SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei)) +SDL_PROC(void, glBindFramebufferOES, (GLenum, GLuint)) +SDL_PROC(void, glFramebufferTexture2DOES, (GLenum, GLenum, GLenum, GLuint, GLint)) +SDL_PROC(GLenum, glCheckFramebufferStatusOES, (GLenum)) +SDL_PROC(void, glPushMatrix, (void)) +SDL_PROC(void, glTranslatef, (GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glRotatef, (GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glPopMatrix, (void)) +SDL_PROC(void, glDeleteFramebuffersOES, (GLsizei, const GLuint*)) + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/SDL/src/render/opengles2/SDL_gles2funcs.h b/src/SDL/src/render/opengles2/SDL_gles2funcs.h new file mode 100644 index 0000000..7b7d5e1 --- /dev/null +++ b/src/SDL/src/render/opengles2/SDL_gles2funcs.h @@ -0,0 +1,47 @@ +SDL_PROC(void, glActiveTexture, (GLenum)) +SDL_PROC(void, glAttachShader, (GLuint, GLuint)) +SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *)) +SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glClear, (GLbitfield)) +SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) +SDL_PROC(void, glCompileShader, (GLuint)) +SDL_PROC(GLuint, glCreateProgram, (void)) +SDL_PROC(GLuint, glCreateShader, (GLenum)) +SDL_PROC(void, glDeleteProgram, (GLuint)) +SDL_PROC(void, glDeleteShader, (GLuint)) +SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *)) +SDL_PROC(void, glDisable, (GLenum)) +SDL_PROC(void, glDisableVertexAttribArray, (GLuint)) +SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei)) +SDL_PROC(void, glEnable, (GLenum)) +SDL_PROC(void, glEnableVertexAttribArray, (GLuint)) +SDL_PROC(void, glFinish, (void)) +SDL_PROC(void, glGenFramebuffers, (GLsizei, GLuint *)) +SDL_PROC(void, glGenTextures, (GLsizei, GLuint *)) +SDL_PROC(void, glGetBooleanv, (GLenum, GLboolean *)) +SDL_PROC(const GLubyte *, glGetString, (GLenum)) +SDL_PROC(GLenum, glGetError, (void)) +SDL_PROC(void, glGetIntegerv, (GLenum, GLint *)) +SDL_PROC(void, glGetProgramiv, (GLuint, GLenum, GLint *)) +SDL_PROC(void, glGetShaderInfoLog, (GLuint, GLsizei, GLsizei *, char *)) +SDL_PROC(void, glGetShaderiv, (GLuint, GLenum, GLint *)) +SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *)) +SDL_PROC(void, glLinkProgram, (GLuint)) +SDL_PROC(void, glPixelStorei, (GLenum, GLint)) +SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) +SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) +SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const char **, const GLint *)) +SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)) +SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) +SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) +SDL_PROC(void, glUniform1i, (GLint, GLint)) +SDL_PROC(void, glUniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat)) +SDL_PROC(void, glUniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) +SDL_PROC(void, glUseProgram, (GLuint)) +SDL_PROC(void, glVertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const void *)) +SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei)) +SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint)) +SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint)) +SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum)) +SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *))