コード例 #1
0
	Example(GLuint width, GLuint height)
	 : log_sink(
		[](const oglplus::ARB_debug_output::CallbackData& data) -> void
		{
			std::cout << "[" << data.id << "] '" <<
				data.message << "'" << std::endl;
			std::cout << "  [source]   '" <<
				oglplus::EnumValueName(data.source)  << "'" <<
				std::endl;
			std::cout << "  [type]     '" <<
				oglplus::EnumValueName(data.type)  << "'" <<
				std::endl;
			std::cout << "  [severity] '" <<
				oglplus::EnumValueName(data.severity)  << "'" <<
				std::endl;
		}
	)
	{
		using namespace oglplus;

		dbg.Control(
			DebugOutputARBSource::DontCare,
			DebugOutputARBType::DontCare,
			DebugOutputARBSeverity::Low,
			true
		);

		gl.ClearColor(1.0f, 1.0f, 1.0f, 0.0f);
		gl.Viewport(width, height);

		glc.MatrixMode(CompatibilityMatrixMode::Projection);
		glc.LoadIdentity();
		glc.MatrixMode(CompatibilityMatrixMode::Modelview);
		glc.LoadIdentity();
	}
コード例 #2
0
	PathExample(int, const char**)
	{
		using namespace oglplus;

		PathNVCommand commands[] = {
			PathNVCommand::MoveTo,
			PathNVCommand::LineTo,
			PathNVCommand::LineTo,
			PathNVCommand::LineTo,
			PathNVCommand::LineTo,
			PathNVCommand::Close
		};

		GLfloat coords[] = {
			 0.00, 0.85,
			 0.65,-0.80,
			-0.85, 0.30,
			 0.85, 0.30,
			-0.65,-0.80
		};

		path.Commands(
			sizeof(commands)/sizeof(commands[0]),
			commands,
			sizeof(coords)/sizeof(coords[0]),
			coords
		);

		path.StrokeWidth(0.01);
		path.JoinStyle(PathNVJoinStyle::Round);

		GLfloat dash_array[] = {0.05, 0.02};

		path.DashArray(
			sizeof(dash_array)/sizeof(dash_array[0]),
			dash_array
		);

		glc.MatrixMode(CompatibilityMatrixMode::Projection);
		glc.LoadIdentity();
		glc.MatrixMode(CompatibilityMatrixMode::Modelview);
		glc.LoadIdentity();

		gl.ClearColor(1.0f, 1.0f, 1.0f, 0.0f);
		gl.ClearStencil(0);
		gl.StencilMask(~0);
		gl.StencilFunc(CompareFunction::NotEqual, 0, 0x1F);
		gl.StencilOp(
			StencilOperation::Keep,
			StencilOperation::Keep,
			StencilOperation::Zero
		);

		gl.Enable(Capability::StencilTest);
	}