void fzDrawLine(const fzVec2& origin, const fzVec2& destination )
    {
        fzGLSetMode(kFZGLMode_Primitives);
        fzVec2 vertices[2] = { origin, destination };

#if FZ_GL_SHADERS
        lazyInitialize();
        fzGLUseProgram(_fzShader->getName());
        FZ_SAFE_APPLY_MATRIX(_fzShader);
        glVertexAttribPointer(kFZAttribPosition, 2, GL_FLOAT, GL_FALSE, 0, vertices);
#else
        glVertexPointer(2, GL_FLOAT, 0, vertices);
#endif
        glDrawArrays(GL_LINES, 0, 2);	
    }
    void fzDrawShape( const fzVec2 *vertices, fzUInt numOfVertices)
    {    
        FZ_ASSERT( numOfVertices > 0, "Number of vertices can not be 0.");
        
        fzGLSetMode(kFZGLMode_Primitives);            
#if FZ_GL_SHADERS
        lazyInitialize();
        fzGLUseProgram(_fzShader->getName());
        FZ_SAFE_APPLY_MATRIX(_fzShader);
        glVertexAttribPointer(kFZAttribPosition, 2, GL_FLOAT, GL_FALSE, 0, vertices);
#else
        glVertexPointer(2, GL_FLOAT, 0, vertices);
#endif
        GLsizei nu = static_cast<GLsizei>(numOfVertices);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, nu);
    }
Beispiel #3
0
 void GLProgram::use() const
 {
     fzGLUseProgram(m_program);
 }