Ejemplo n.º 1
0
    void paintGL(){
		gl::clearAll();
		using namespace gl::DrawArrays;
		program.use();
		program.bindVertexArray(vao);
		gl::drawArrays( Mode::TRIANGLES,0,6 );
    }
	void paintGL() {
		gl::clearAll();
		program.use();
		glEnable(GL_PROGRAM_POINT_SIZE);
		program.bindVertexArray(vao);
		if (baseIndex&1) {
			gl::pointCoordOrigin(
				gl::PointCoordOrigin::LOWER_LEFT
				);
		}
		else {
			gl::pointCoordOrigin(
				gl::PointCoordOrigin::UPPER_LEFT
				);
		}
		using namespace gl::DrawElementsInstancedBaseInstance;
		gl::drawElementsInstancedBaseInstance(
			Mode::POINTS,
			1,
			Type::UNSIGNED_INT,
			0,
			4,
			4*baseIndex
			);
		glDisable(GL_PROGRAM_POINT_SIZE);
	}
Ejemplo n.º 3
0
        void paintGL(){
            constexpr static float clearColor[] = \
                {0.5f,0.3f,0.3f,1};
            gl::NamedFrameBufferObject root;
            root.clearColor(clearColor);
            root.clearDepth(1);
            program.use();
            program.bindFrameBuffer(root);
            program.bindVertexArray(vao);
            program.setUniformMatrix4fv(
                1, 1, false, &(modelScale[0][0]));
			program.setUniformMatrix4fv(
				3, 1, false, &(normalMatrix[0][0]));
            using namespace gl::DrawElements;
            Pack pack(
                Mode::TRIANGLES,
                indexCount,
                Type::UNSIGNED_INT,
                nullptr);
            gl::draw(pack);
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
0
    void paintGL(){

		 
		program.use();
		program.bindFrameBuffer(dFBO.frameBuffer());
		program.bindVertexArray(vao);
		glViewport(0, 0, 512, 512);
		glClearColor(0.5f, 0.1f, 0.1f, 1);
		gl::clearAll();
		gl::drawArrays(gl::DrawArraysMode::TRIANGLES, 0, 3);
		program.bindFrameBuffer();

		glViewport(0, 0,super->width(), super->height());
		glClearColor(0.1f, 0.1f, 0.5f, 1);
		gl::clearAll();
		glViewport(
			(super->width()-512)/2, 
			(super->height()-512)/2,
			512, 512);
		renderRectangle.render( dFBO.renderBuffer() );
    }