Commit bb5b4401412846ad829b8380bed0419264fa653b
1 parent
56753989
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
Showing
3 changed files
with
35 additions
and
1 deletions
... | ... | @@ -832,6 +832,38 @@ static int gl_texture_to_sdl(lua_State *L) |
832 | 832 | return 1; |
833 | 833 | } |
834 | 834 | |
835 | +static int gl_tex_white = 0; | |
836 | +int init_blank_surface() | |
837 | +{ | |
838 | + Uint32 rmask, gmask, bmask, amask; | |
839 | +#if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
840 | + rmask = 0xff000000; | |
841 | + gmask = 0x00ff0000; | |
842 | + bmask = 0x0000ff00; | |
843 | + amask = 0x000000ff; | |
844 | +#else | |
845 | + rmask = 0x000000ff; | |
846 | + gmask = 0x0000ff00; | |
847 | + bmask = 0x00ff0000; | |
848 | + amask = 0xff000000; | |
849 | +#endif | |
850 | + SDL_Surface *s = SDL_CreateRGBSurface( | |
851 | + SDL_SWSURFACE | SDL_SRCALPHA, | |
852 | + 4, | |
853 | + 4, | |
854 | + 32, | |
855 | + rmask, gmask, bmask, amask | |
856 | + ); | |
857 | + SDL_FillRect(s, NULL, SDL_MapRGBA(s->format, 255, 255, 255, 255)); | |
858 | + | |
859 | + glGenTextures(1, &gl_tex_white); | |
860 | + tglBindTexture(GL_TEXTURE_2D, gl_tex_white); | |
861 | + int fw, fh; | |
862 | + make_texture_for_surface(s, &fw, &fh); | |
863 | + copy_surface_to_texture(s); | |
864 | + return gl_tex_white; | |
865 | +} | |
866 | + | |
835 | 867 | static int gl_draw_quad(lua_State *L) |
836 | 868 | { |
837 | 869 | int x = luaL_checknumber(L, 1); |
... | ... | @@ -854,7 +886,7 @@ static int gl_draw_quad(lua_State *L) |
854 | 886 | } |
855 | 887 | else |
856 | 888 | { |
857 | - tglBindTexture(GL_TEXTURE_2D, 0); | |
889 | + tglBindTexture(GL_TEXTURE_2D, gl_tex_white); | |
858 | 890 | } |
859 | 891 | |
860 | 892 | GLfloat texcoords[2*4] = { | ... | ... |
-
Please register or login to post a comment