Hi,
I have a shader that is used to draw a font. I know that people use texture to draw points, but here the point drawing shader is so fast that it does not make a difference to change it to texture. However, the way i implemented takes a lot of memory to hold the pixel values.
Currently i use an array of coordinates to draw the text and an array of ARGB to set the color. But the color is always the same, i just change the A-channel of the color, replicating the RGB in all pixels. The shader is below:
#define POINTS_VERTEX_CODE \
"attribute vec4 a_Position; attribute vec4 a_Color; varying vec4 v_Color; " \
"uniform mat4 projectionMatrix; " \
"void main() {v_Color = a_Color; gl_Position = a_Position * projectionMatrix;}"
#define POINTS_FRAGMENT_CODE \
"precision mediump float;" \
"varying vec4 v_Color;" \
"void main() {gl_FragColor = v_Color;}"
What i have to change in the code above to let i upload just the RGB and pass an array of A-channels? This would save a lot of memory, because instead of passing 4 bytes for each pixel, i would pass just 1 byte for the pixel.
thanks in advance,
guich