Skip to content
Snippets Groups Projects
Commit bb5b4401 authored by dg's avatar dg
Browse files

Fixed drawQuad (it would randomly start using a texture when when told not to)

git-svn-id: http://svn.net-core.org/repos/t-engine4@3371 51575b47-30f0-44d4-a5cc-537603b46e54
parent 56753989
No related branches found
No related tags found
No related merge requests found
......@@ -832,6 +832,38 @@ static int gl_texture_to_sdl(lua_State *L)
return 1;
}
static int gl_tex_white = 0;
int init_blank_surface()
{
Uint32 rmask, gmask, bmask, amask;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;
#endif
SDL_Surface *s = SDL_CreateRGBSurface(
SDL_SWSURFACE | SDL_SRCALPHA,
4,
4,
32,
rmask, gmask, bmask, amask
);
SDL_FillRect(s, NULL, SDL_MapRGBA(s->format, 255, 255, 255, 255));
glGenTextures(1, &gl_tex_white);
tglBindTexture(GL_TEXTURE_2D, gl_tex_white);
int fw, fh;
make_texture_for_surface(s, &fw, &fh);
copy_surface_to_texture(s);
return gl_tex_white;
}
static int gl_draw_quad(lua_State *L)
{
int x = luaL_checknumber(L, 1);
......@@ -854,7 +886,7 @@ static int gl_draw_quad(lua_State *L)
}
else
{
tglBindTexture(GL_TEXTURE_2D, 0);
tglBindTexture(GL_TEXTURE_2D, gl_tex_white);
}
GLfloat texcoords[2*4] = {
......
......@@ -22,5 +22,6 @@
#define _CORELUA_H_
extern int luaopen_core(lua_State *L);
extern int init_blank_surface();
#endif
......@@ -908,6 +908,7 @@ int main(int argc, char *argv[])
}
// setupDisplayTimer(30);
init_blank_surface();
boot_lua(2, FALSE, argc, argv);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment