Reenable colored font rendering

This commit is contained in:
Alexander Bock
2015-10-08 22:59:36 +02:00
parent cb27e37778
commit d4da374c23
4 changed files with 35 additions and 44 deletions

View File

@@ -203,7 +203,7 @@ void mainInitFunc() {
ghoul_assert(v != nullptr, "Number of reported viewports was incorrect");
sgct_core::NonLinearProjection* p = v->getNonLinearProjectionPtr();
if (p)
p->setClearColor(0.f, 0.f, 0.f);
p->setClearColor(glm::vec4(0.f, 0.f, 0.f, 1.f));
}
}

View File

@@ -145,30 +145,30 @@ void ABufferVisualizer::render() {
const glm::mat4 scale = glm::scale(glm::mat4(1.0), glm::vec3(0.04, 0.04, 0.04));
glm::mat4 translate, mvp;
// translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, 0));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(0,0,0)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, 1));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(0,0,1)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 1, 0));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(0,1,0)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 0, 0));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(1,0,0)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 1, 1));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(0,1,1)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 0, 1));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(1,0,1)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 1, 0));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(1,1,0)");
// translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 1, 1));
// mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
// Freetype::print3d(fontLight, mvp, "(1,1,1)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, 0));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(0,0,0)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, 1));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(0,0,1)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 1, 0));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(0,1,0)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 0, 0));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(1,0,0)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 1, 1));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(0,1,1)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 0, 1));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(1,0,1)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 1, 0));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(1,1,0)");
translate = glm::translate(glm::mat4(1.0), glm::vec3(1, 1, 1));
mvp = sgct::Engine::instance()->getCurrentModelViewProjectionMatrix()*modelMatrix*translate*rotationText*scale;
Freetype::print3d(fontLight, mvp, "(1,1,1)");
}
void ABufferVisualizer::initializeMarkers() {

View File

@@ -294,10 +294,8 @@ void LuaConsole::render() {
const glm::vec4 green(0, 1, 0, 1);
const glm::vec4 white(1, 1, 1, 1);
const sgct_text::Font* font = sgct_text::FontManager::instance()->getFont(constants::fonts::keyMono, static_cast<int>(font_size));
// sgct_text::print(font, 15.0f, startY, red, "$");
// sgct_text::print(font, 15.0f + font_size, startY, white, "%s", _commands.at(_activeCommand).c_str());
sgct_text::print(font, 15.0f, startY, "$");
sgct_text::print(font, 15.0f + font_size, startY, "%s", _commands.at(_activeCommand).c_str());
sgct_text::print(font, 15.0f, startY, red, "$");
sgct_text::print(font, 15.0f + font_size, startY, white, "%s", _commands.at(_activeCommand).c_str());
size_t n = std::count(_commands.at(_activeCommand).begin(), _commands.at(_activeCommand).begin() + _inputPosition, '\n');
size_t p = _commands.at(_activeCommand).find_last_of('\n', _inputPosition);
@@ -320,8 +318,7 @@ void LuaConsole::render() {
std::stringstream ss;
ss << "%" << linepos + 1 << "s";
// sgct_text::print(font, 15.0f + font_size*0.5f, startY - (font_size)*(n + 1)*3.0f / 2.0f, green, ss.str().c_str(), "^");
sgct_text::print(font, 15.0f + font_size*0.5f, startY - (font_size)*(n + 1)*3.0f / 2.0f, ss.str().c_str(), "^");
sgct_text::print(font, 15.0f + font_size*0.5f, startY - (font_size)*(n + 1)*3.0f / 2.0f, green, ss.str().c_str(), "^");
}
unsigned int LuaConsole::commandInputButton() {

View File

@@ -400,10 +400,10 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
#if 1
#define PrintText(__i__, __format__, ...) Freetype::print(font, 10.f, static_cast<float>(startY - font_size_mono * __i__ * 2), __format__, __VA_ARGS__);
#define PrintColorTextArg(__i__, __format__, __size__, __color__, ...) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __format__, __VA_ARGS__);
#define PrintColorText(__i__, __format__, __size__, __color__) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __format__);
//#define PrintColorTextArg(__i__, __format__, __size__, __color__, ...) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __color__, __format__, __VA_ARGS__);
//#define PrintColorText(__i__, __format__, __size__, __color__) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __color__, __format__);
//#define PrintColorTextArg(__i__, __format__, __size__, __color__, ...) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __format__, __VA_ARGS__);
//#define PrintColorText(__i__, __format__, __size__, __color__) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __format__);
#define PrintColorTextArg(__i__, __format__, __size__, __color__, ...) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __color__, __format__, __VA_ARGS__);
#define PrintColorText(__i__, __format__, __size__, __color__) Freetype::print(font, __size__, static_cast<float>(startY - font_size_mono * __i__ * 2), __color__, __format__);
if (_onScreenInformation._node != -1) {
//int thisId = sgct_core::ClusterManager::instance()->getThisNodeId();
@@ -614,8 +614,7 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
const std::string& message = e->message.substr(0, msg_length);
nr += std::count(message.begin(), message.end(), '\n');
// Freetype::print(font, 10.f, static_cast<float>(font_size_light * nr * 2), white*alpha,
Freetype::print(font, 10.f, static_cast<float>(font_size_light * nr * 2),
Freetype::print(font, 10.f, static_cast<float>(font_size_light * nr * 2), white*alpha,
"%-14s %s%s", // Format
e->timeString.c_str(), // Time string
e->category.substr(0, category_length).c_str(), // Category string (up to category_length)
@@ -631,15 +630,10 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
if (e->level == ghoul::logging::LogManager::LogLevel::Fatal)
color = blue;
Freetype::print(font, static_cast<float>(10 + 39 * font_with_light), static_cast<float>(font_size_light * nr * 2), "%s", lvl.c_str());
Freetype::print(font, static_cast<float>(10 + 53 * font_with_light), static_cast<float>(font_size_light * nr * 2), "%s", message.c_str());
// Freetype::print(font, static_cast<float>(10 + 39 * font_with_light), static_cast<float>(font_size_light * nr * 2), color*alpha, "%s", lvl.c_str());
Freetype::print(font, static_cast<float>(10 + 39 * font_with_light), static_cast<float>(font_size_light * nr * 2), color*alpha, "%s", lvl.c_str());
// Freetype::print(font, static_cast<float>(10 + 53 * font_with_light), static_cast<float>(font_size_light * nr * 2), white*alpha, "%s", message.c_str());
Freetype::print(font, static_cast<float>(10 + 53 * font_with_light), static_cast<float>(font_size_light * nr * 2), white*alpha, "%s", message.c_str());
++nr;
}
}