Exemplo n.º 1
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.º 2
0
// ----------------------------------------------------------------------------
void SharedGPUObjects::init()
{
    if (m_has_been_initialised)
        return;
    initQuadVBO();
    initQuadBuffer();
    initBillboardVBO();
    initSkyTriVBO();
    initFrustrumVBO();
    initParticleQuadVBO();
    
    if (CVS->isARBUniformBufferObjectUsable())
    {
        initShadowVPMUBO();
        initLightingDataUBO();
        if (CVS->supportsHardwareSkinning())
            initSkinningUBO();
    }

    m_has_been_initialised = true;
}   // SharedGPUObjects
Exemplo n.º 3
0
void DXInstancing::init() {
    initQuadBuffer();
    initShadersAndInputLayout();
}