Own Shaders for Textures ??

Hi,

i’m a OpenGL beginner and i want render some text with FreeType.

Do i Need a own shader for Rendering textures ?? Or can i just extend the old shader:


#version 430

layout (location = 0) in vec3 v3_Vertex;
layout (location = 1) in vec4 v4_Color;


uniform mat4 mat4_ViewTransformation;
uniform mat4 mat4_ProjectionTransformation;
uniform mat4 mat4_ModelTransformation;

out vec4 RGBAColor;

void main() 
{

    gl_Position =  mat4_ProjectionTransformation * mat4_ViewTransformation * mat4_ModelTransformation * vec4(v3_Vertex,1.0f);
    //v4_Color = vec4(0.0, 1.0, 0.0, 1.0);
    RGBAColor = v4_Color;
}

As improvement, use a specific shader. Most of the time, for example, you won’t use the modelview matrix. Also, positions can be send only with a Vec2.
But if your existing shader can handle this, then it’s also possible to reuse it.

Okay, so i have decided to use several different shaders.
Now i’m on the Point where i want to map the glyph Texture.

In my example the texture of the glyph is mapped to a quadrangle wich consists of two triangles.

So What is the reason mapping the glyph texture to two triangles, and not mapping it just to one quadrangle ??

Quads have been deprecated in OpenGL 3.0. See this.
The other reason is that quads generally have weaker performances than triangles. Most of the time they were simulated by the driver as 2 triangles.
There are other reasons like quads are not flat but they are out of concern here.

Okay, so i can render a character now. I have used the two triangles too.
I have rendered the C:\Windows\Fonts\ imes.ttf font. But i think this was not a good choice i think it is too “bold” anyhow…

I’m looking for a good font with good readable small numbers. I Want render Dates and Numbers for a coordinate System…