Skip to content
Snippets Groups Projects
Commit 30b3f89e authored by Odilitime's avatar Odilitime
Browse files

truncate texture if larger than card supports

parent b2252443
No related branches found
No related tags found
No related merge requests found
......@@ -154,6 +154,8 @@ std::unique_ptr<std::pair<int, int>> TextRasterizer::size(const rasterizationReq
return std::make_unique<std::pair<int, int>>(std::pair<int, int>(response->width, response->height));
}
#include <GL/glew.h>
std::unique_ptr<rasterizationResponse> TextRasterizer::rasterize(const rasterizationRequest &request) const {
if (request.startX == request.availableWidth) {
......@@ -308,6 +310,14 @@ std::unique_ptr<rasterizationResponse> TextRasterizer::rasterize(const rasteriza
response->y1 = -response->height;
//std::cout << "xd: " << static_cast<int>(response->x1-response->x0) << " yd: " << static_cast<int>(response->y0-response->y1) << std::endl;
int max;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
std::cout << "Requesting texture of " << response->textureWidth << "x" << response->textureHeight << "max: " << max << std::endl;
if (response->textureHeight > max) {
std::cout << "Truncating text texture to fit in your video card" << std::endl;
response->textureHeight = max;
}
// texture coords
response->s0 = 0.0f;
response->t0 = 0.0f;
......@@ -319,7 +329,7 @@ std::unique_ptr<rasterizationResponse> TextRasterizer::rasterize(const rasteriza
// still neds to start at X
cx = response->wrapped ? request.startX : 0; // reset
cy = 0;
//std::cout << "starting at: " << cx << std::endl;
//std::cout << "[" << request.text << "] wrapped? " << response->wrapped << " starting at: " << cx << std::endl;
//int miny0 = 99;
int maxy0 = 0;
for (unsigned int i = 0; i < glyphCount; i++) {
......
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