| 262 | } |
| 263 | |
| 264 | void Font::renderTextCache(TextCache* cache) |
| 265 | { |
| 266 | if(!textureID) |
| 267 | { |
| 268 | LOG(LogError) << "Error - tried to draw with Font that has no texture loaded!"; |
| 269 | return; |
| 270 | } |
| 271 | |
| 272 | if(cache == NULL) |
| 273 | { |
| 274 | LOG(LogError) << "Attempted to draw NULL TextCache!"; |
| 275 | return; |
| 276 | } |
| 277 | |
| 278 | if(cache->sourceFont != this) |
| 279 | { |
| 280 | LOG(LogError) << "Attempted to draw TextCache with font other than its source!"; |
| 281 | return; |
| 282 | } |
| 283 | |
| 284 | glBindTexture(GL_TEXTURE_2D, textureID); |
| 285 | glEnable(GL_TEXTURE_2D); |
| 286 | glEnable(GL_BLEND); |
| 287 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 288 | |
| 289 | glEnableClientState(GL_VERTEX_ARRAY); |
| 290 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
| 291 | glEnableClientState(GL_COLOR_ARRAY); |
| 292 | |
| 293 | glVertexPointer(2, GL_FLOAT, sizeof(TextCache::Vertex), &cache->verts[0].pos); |
| 294 | glTexCoordPointer(2, GL_FLOAT, sizeof(TextCache::Vertex), &cache->verts[0].tex); |
| 295 | glColorPointer(4, GL_UNSIGNED_BYTE, 0, cache->colors); |
| 296 | |
| 297 | glDrawArrays(GL_TRIANGLES, 0, cache->vertCount); |
| 298 | |
| 299 | glDisableClientState(GL_VERTEX_ARRAY); |
| 300 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
| 301 | glDisableClientState(GL_COLOR_ARRAY); |
| 302 | |
| 303 | glDisable(GL_TEXTURE_2D); |
| 304 | glDisable(GL_BLEND); |
| 305 | } |
| 306 | |
| 307 | Eigen::Vector2f Font::sizeText(std::string text) const |
| 308 | { |
nothing calls this directly
no outgoing calls
no test coverage detected