MCPcopy Create free account
hub / github.com/arrayfire/forge / FontAtlas

Method FontAtlas

src/backend/opengl/font_atlas_impl.cpp:112–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112FontAtlas::FontAtlas(const size_t pWidth, const size_t pHeight, const size_t pDepth)
113 : mWidth(pWidth), mHeight(pHeight), mDepth(pDepth), mUsed(0), mId(0)
114{
115 CheckGL("Begin FontAtlas::FontAtlas");
116 if (!((pDepth == 1) || (pDepth == 3) || (pDepth == 4))) {
117 FG_ERROR("Font Atlas: Invalid depth argument", FG_ERR_INTERNAL);
118 }
119
120 glGenTextures(1, &mId);
121 glBindTexture(GL_TEXTURE_2D, mId);
122 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, static_cast<GLint>(GL_CLAMP_TO_EDGE));
123 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, static_cast<GLint>(GL_CLAMP_TO_EDGE));
124 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, static_cast<GLint>(GL_LINEAR));
125 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, static_cast<GLint>(GL_LINEAR));
126 glBindTexture(GL_TEXTURE_2D, 0);
127
128 // one pixel border around the whole atlas to
129 // avoid any artefact when sampling texture
130 nodes.push_back(glm::vec3(BORDER_GAP, BORDER_GAP, mWidth-BORDER_GAP-1));
131
132 mData.resize(mWidth*mHeight*mDepth, 0);
133 CheckGL("End FontAtlas::FontAtlas");
134}
135
136FontAtlas::~FontAtlas()
137{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected