Exemplo n.º 1
0
 Primitive2DList()
 {
     loadProgram(OBJECT, GL_VERTEX_SHADER, "primitive2dlist.vert",
                         GL_FRAGMENT_SHADER, "transparent.frag");
     assignUniforms("custom_alpha");
     assignSamplerNames(0, "tex", ST_BILINEAR_FILTERED);
 }   // Primitive2DList
Exemplo n.º 2
0
    ColoredTextureRectShader()
    {
#ifdef XX
        initQuadBuffer();
#endif
        loadProgram(OBJECT, GL_VERTEX_SHADER, "colortexturedquad.vert",
                            GL_FRAGMENT_SHADER, "colortexturedquad.frag");
        assignUniforms("center", "size", "texcenter", "texsize");

        assignSamplerNames(0, "tex", ST_BILINEAR_FILTERED);

        glGenVertexArrays(1, &m_vao);
        glBindVertexArray(m_vao);
        glEnableVertexAttribArray(0);
        glEnableVertexAttribArray(3);
        glEnableVertexAttribArray(2);
        glBindBuffer(GL_ARRAY_BUFFER, SharedGPUObjects::getQuadBuffer());
        glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);
        glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 
                              (GLvoid *)(2 * sizeof(float)));
        const unsigned quad_color[] = {   0,   0,   0, 255,
                                        255,   0,   0, 255,
                                          0, 255,   0, 255,
                                          0,   0, 255, 255 };
        glGenBuffers(1, &m_color_vbo);
        glBindBuffer(GL_ARRAY_BUFFER, m_color_vbo);
        glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(unsigned), quad_color,
                     GL_DYNAMIC_DRAW);
        glVertexAttribIPointer(2, 4, GL_UNSIGNED_INT, 4 * sizeof(unsigned), 0);
        glBindVertexArray(0);
    }   // ColoredTextureRectShader
Exemplo n.º 3
0
 InstancedColorizeShader()
 {
     loadProgram(OBJECT, GL_VERTEX_SHADER,   "utils/getworldmatrix.vert",
                         GL_VERTEX_SHADER,   "glow_object.vert",
                         GL_FRAGMENT_SHADER, "glow_object.frag");
     assignUniforms();
 }   // InstancedColorizeShader
Exemplo n.º 4
0
    TextureRectShader()
    {
        loadProgram(OBJECT, GL_VERTEX_SHADER, "texturedquad.vert",
                            GL_FRAGMENT_SHADER, "texturedquad.frag");
        assignUniforms("center", "size", "texcenter", "texsize");

        assignSamplerNames(0, "tex", ST_BILINEAR_FILTERED);
    }   // TextureRectShader
Exemplo n.º 5
0
// ============================================================================
Shaders::ColoredLine::ColoredLine()
{
    loadProgram(OBJECT, GL_VERTEX_SHADER,   "sp_pass.vert",
                        GL_FRAGMENT_SHADER, "coloredquad.frag");

    assignUniforms("color");

    glGenVertexArrays(1, &m_vao);
    glBindVertexArray(m_vao);
    glGenBuffers(1, &m_vbo);
    glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
    glBufferData(GL_ARRAY_BUFFER, 6 * 1024 * sizeof(float), 0,
        GL_DYNAMIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
    for (int i = 1; i < 16; i++)
    {
        glDisableVertexAttribArray(i);
    }
    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}   // Shaders::ColoredLine
Exemplo n.º 6
0
 ColoredRectShader()
 {
     loadProgram(OBJECT, GL_VERTEX_SHADER, "coloredquad.vert",
                         GL_FRAGMENT_SHADER, "coloredquad.frag");
     assignUniforms("center", "size", "color");
 }   // ColoredRectShader