#define LRP_VERTEX_CODE \
"attribute vec4 a_Position;" \
"uniform mat4 projectionMatrix;" \
"void main() {gl_PointSize = 1.0; gl_Position = a_Position*projectionMatrix;}"
#define LRP_FRAGMENT_CODE \
"precision mediump float;" \
"uniform vec4 a_Color;" \
"void main() {gl_FragColor = a_Color;}"
lrpColor = glGetUniformLocation(lrpProgram, "a_Color");
lrpPosition = glGetAttribLocation(lrpProgram, "a_Position"); // get handle to vertex shader's vPosition member
glEnableVertexAttribArray(lrpPosition); // Enable a handle to the vertices - since this is the only one used, keep it enabled all the time
void glDrawPixel(int32 x, int32 y, int32 rgb)
{
glFillRect(x,y,1,1,rgb);
}
void glFillRect(int32 x, int32 y, int32 w, int32 h, int32 rgb)
{
GLfloat* coords = lrcoords;
PixelConv pc;
pc.pixel = rgb;
coords[0] = coords[3] = x;
coords[1] = coords[10] = y;
coords[4] = coords[7] = y+h;
coords[6] = coords[9] = x+w;
setCurrentProgram(lrpProgram);
glUniform4f(lrpColor, f255[pc.r], f255[pc.g], f255[pc.b], 1);
glVertexAttribPointer(lrpPosition, COORDS_PER_VERTEX, GL_FLOAT, GL_FALSE, COORDS_PER_VERTEX * sizeof(float), coords);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, rectOrder);
}