GithubHelp home page GithubHelp logo

Black background about gltext HOT 5 OPEN

vallentin avatar vallentin commented on June 14, 2024
Black background

from gltext.

Comments (5)

trlsmax avatar trlsmax commented on June 14, 2024 6

just figure it out

#define _gltDrawText() \
	glUseProgram(_gltText2DShader); \
	\
	glActiveTexture(GL_TEXTURE0); \
	glBindTexture(GL_TEXTURE_2D, _gltText2DFontTexture); \
	\
	glUniformMatrix4fv(_gltText2DShaderMVPUniformLocation, 1, GL_FALSE, mvp); \
	\
    GLboolean last_enable_blend = glIsEnabled(GL_BLEND);\
    glEnable(GL_BLEND);\
    glBlendEquation(GL_FUNC_ADD);\
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\
    \
	glBindVertexArray(text->_vao); \
	glDrawArrays(GL_TRIANGLES, 0, text->vertexCount); \
	glBindVertexArray(0); \
    \
    if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);

from gltext.

vallentin avatar vallentin commented on June 14, 2024

Currently you can change the text color with gltColor. If you change the color, then it is only applied to the fill of the text, however changing the transparency would also affect the outline. Since the color is only multiplied with the font texels in the shader.

https://github.com/MrVallentin/glText/blob/2a2802ad161d30356413fbeb0e591e27ff7a565a/gltext.h#L523-L527

What is the exact use case? Do you simply want to be be able to apply different fill and outline colors?
I'll at least look into that in the near future, have a few other ideas I want to implement as well.

Sorry it took a month to respond, didn't realize my mail filtering meant I wouldn't get notifications.

from gltext.

trlsmax avatar trlsmax commented on June 14, 2024

Nice lib, and easy to use. Thanks.
But same here, just want the text background can set to transparent.

from gltext.

loveq007 avatar loveq007 commented on June 14, 2024

Thank you, trlsmax, nice method

from gltext.

orbea avatar orbea commented on June 14, 2024

@vallentin Any news on this?

from gltext.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.