| 128 | } |
| 129 | |
| 130 | GLuint textureLoadFromFont(const char* filename, const char* string, int size, SDL_Color color){ |
| 131 | //load font and render text to SDL surface |
| 132 | TTF_Init(); |
| 133 | TTF_Font* font = TTF_OpenFont(filename, size); |
| 134 | SDL_Surface* textureSurface2 = TTF_RenderUTF8_Blended(font, string, color); |
| 135 | SDL_Surface* textureSurface = SDL_ConvertSurfaceFormat(textureSurface2, SDL_PIXELFORMAT_RGBA32, 0); |
| 136 | if (!textureSurface){ |
| 137 | SDL_Log("text surface failed: %s\n", TTF_GetError()); |
| 138 | } |
| 139 | |
| 140 | return SDLsurfaceToGLuint(textureSurface, filename); |
| 141 | } |
| 142 | |
| 143 | GLuint textureFromSDLSurface(SDL_Surface* surface){ |
| 144 | return SDLsurfaceToGLuint(surface, "video file"); |
no test coverage detected