Difference between revisions of "LibSR:Rasteriser sample"

From Maths
Jump to: navigation, search
(Saving work)
 
(No difference)

Latest revision as of 21:29, 25 December 2017

		context.setPrimitiveType(::LibSR::PrimitiveType::TRIANGLES);
		context.setRenderType(::LibSR::RenderType::SOLID);
		context.useProgram(*program);
		float aspectRatio = ((float) context.getFramebuffer().getWidth())/
							((float) context.getFramebuffer().getHeight());
		mvp = ::LibSR::Mat4::PerspectiveProjection(0.1f, 0.1f*aspectRatio, 0.1f, 10.0f)
				* ::LibSR::Mat4::Translation(-1.0f, 0.0f, -2.5f)
				* ::LibSR::Mat4::RotateAboutY(0.5f*((float) frame))
				* ::LibSR::Mat4::RotateAboutX(3.14f/4.0f);
		context.bindUniformV(L"MVP", mvp);
		::LibSR::Mat4 other = mvp.getInverse();
		other.transpose();
		context.bindUniformV(L"normalMVP",other);
		program->bindAttributeBuffer(L"a_colour", *colours);
		program->bindAttributeBuffer(L"position", *positions);
		program->bindAttributeBuffer(L"normal",*normals);