Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch text rendering to use interpolation #1917

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions avogadro/rendering/textlabelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace {
#include "textlabelbase_fs.h"
#include "textlabelbase_vs.h"
} // end anon namespace
} // namespace

#include <iostream>

Expand Down Expand Up @@ -80,8 +80,8 @@
: vertices(4), shadersInvalid(true), textureInvalid(true), vboInvalid(true),
radius(0.0)
{
texture.setMinFilter(Texture2D::Nearest);
texture.setMagFilter(Texture2D::Nearest);
texture.setMinFilter(Texture2D::Linear);
texture.setMagFilter(Texture2D::Linear);
texture.setWrappingS(Texture2D::ClampToEdge);
texture.setWrappingT(Texture2D::ClampToEdge);
}
Expand Down Expand Up @@ -187,13 +187,13 @@

!shaderProgram->enableAttributeArray("offset") ||
!shaderProgram->useAttributeArray("offset", PackedVertex::offsetOffset(),
sizeof(PackedVertex), IntType, 2,
ShaderProgram::NoNormalize) ||
sizeof(PackedVertex), IntType, 2,
ShaderProgram::NoNormalize) ||

!shaderProgram->enableAttributeArray("texCoord") ||
!shaderProgram->useAttributeArray("texCoord", PackedVertex::tcoordOffset(),
sizeof(PackedVertex), FloatType, 2,
ShaderProgram::NoNormalize)) {
!shaderProgram->useAttributeArray(
"texCoord", PackedVertex::tcoordOffset(), sizeof(PackedVertex),
FloatType, 2, ShaderProgram::NoNormalize)) {
std::cerr << "Error setting up TextLabelBase shader program: "
<< shaderProgram->error() << std::endl;
vbo.release();
Expand All @@ -213,7 +213,8 @@

void TextLabelBase::RenderImpl::compileShaders()
{
if (vertexShader != nullptr && fragmentShader != nullptr && shaderProgram != nullptr)
if (vertexShader != nullptr && fragmentShader != nullptr &&
shaderProgram != nullptr)
return;

if (vertexShader == nullptr)
Expand Down Expand Up @@ -242,11 +243,11 @@
std::cerr << shaderProgram->error() << std::endl;
return;
}
/* shaderProgram->detachShader(vertexShader);
shaderProgram->detachShader(fragmentShader);
vertexShader->cleanup();
fragmentShader->cleanup();
*/
/* shaderProgram->detachShader(vertexShader);
shaderProgram->detachShader(fragmentShader);
vertexShader->cleanup();
fragmentShader->cleanup();
*/
Comment on lines +246 to +250

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

shadersInvalid = false;
}
Expand All @@ -259,9 +260,7 @@
vboInvalid = false;
}

TextLabelBase::TextLabelBase() : m_render(new RenderImpl)
{
}
TextLabelBase::TextLabelBase() : m_render(new RenderImpl) {}

TextLabelBase::TextLabelBase(const TextLabelBase& other)
: Drawable(other), m_text(other.m_text),
Expand Down Expand Up @@ -368,4 +367,4 @@
m_render->vboInvalid = true;
}

} // namespace Avogadro
} // namespace Avogadro::Rendering
Loading