示例#1
0
 void drawObject(const Object& obj) {
         renderProgram.uniform("obj", obj.objTransform);
         renderProgram.uniform("shininess", obj.material->shininess);
         obj.material->bind();
         obj.geometry->bind(vao);
         obj.geometry->draw();
 }
示例#2
0
        static GL::Program initProgram() {
                GL::Program renderProgram;

                auto vert = GL::Shader::fromString(GL_VERTEX_SHADER, readFile("../vert.glsl"));
                auto frag = GL::Shader::fromString(GL_FRAGMENT_SHADER, readFile("../frag.glsl"));

                renderProgram.attachShader(vert);
                renderProgram.attachShader(frag);
                renderProgram.link();
                renderProgram.use();

                renderProgram.uniform("projection", glm::perspectiveFovRH(3.14159f/2.0f, 1024.0f, 768.0f, 0.01f, 100.0f));
                renderProgram.uniform("camera", glm::translate(glm::vec3(0, 0, -2)));
                renderProgram.uniform("obj", glm::mat4());

                renderProgram.uniform<int>("textureID", 0);
                renderProgram.uniform<int>("normMapID", 1);
                renderProgram.uniform<int>("shadowmapArrayID", 4);

                return renderProgram;
        }