void GMBufferTexture::Process() { Texture * texturePtr; if (textureID != -1) texturePtr = TexMan.GetTextureByID(textureID); else texturePtr = t; if (texturePtr == NULL){ std::cout<<"Null-Texture was queued to buffering!"; return; } if (texturePtr->glid != -1 && !texturePtr->dynamic){ std::cout<<"\nTexture "<<texturePtr->name<<" is already buffered (has glid)!"; return; } texturePtr->Bufferize(); return; }
/// Render the character as selected. void TextFont::RenderSelection(uchar c) { /// No good solution for this... yet. if (shaderBased) { return; } // Stop the quads. glEnd(); CheckGLError("TextFont::RenderSelection 1"); // Switch to additive rendering glBlendFunc(GL_SRC_ALPHA, GL_ONE); CheckGLError("TextFont::RenderSelection 1.5"); int characterX = c % 16; int characterY = c / 16; /// Texture co-ordinates. float & xStart = pivotPoint[0]; float & yStart = pivotPoint[1]; // Bind the texture to use. Preferably a gray sort. Texture * tex = TexMan.GetTextureByHex32(0xFFFFFF22); if (tex->glid == -1) tex->Bufferize(); glBindTexture(GL_TEXTURE_2D, tex->glid); CheckGLError("TextFont::RenderSelection 2"); float width = this->charWidth[c]; float halfWidth = width * 0.5f; // Render the quad! glBegin(GL_QUADS); float x1 = halfWidth * -halfScale[0] + xStart - padding[0] * 0.5f, x2 = halfWidth * halfScale[0] + xStart + padding[0] * 0.5f; // And actual rendering. glTexCoord2f(0, 1); glVertex3f(x2, -halfScale[1] + yStart, 0); glTexCoord2f(1, 1); glVertex3f(x1, -halfScale[1] + yStart, 0); glTexCoord2f(1, 0); glVertex3f(x1, halfScale[1] + yStart, 0); glTexCoord2f(0, 0); glVertex3f(x2, halfScale[1] + yStart, 0); glEnd(); CheckGLError("TextFont::RenderSelection 3"); // Re-bind old texture. glBindTexture(GL_TEXTURE_2D, this->texture->glid); // Reset blend-mode. glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); CheckGLError("TextFont::RenderSelection 4"); // Begin quads again. glBegin(GL_QUADS); }