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(); }
void Render() { using namespace oglplus; gl.Clear().ColorBuffer().StencilBuffer(); glc.Color(0.2, 0.2, 1.0); text_path.StencilFillInstanced( glyph_indices, PathNVFillMode::CountUp, 0xFF, PathNVTransformType::TranslateX, glyph_spacings); text_path.CoverFillInstanced( glyph_indices, PathNVFillCoverMode::BoundingBoxOfBoundingBoxes, PathNVTransformType::TranslateX, glyph_spacings); glc.Color(0.0, 0.0, 0.0); text_path.StencilStrokeInstanced( glyph_indices, 1, ~0, PathNVTransformType::TranslateX, glyph_spacings); text_path.CoverStrokeInstanced( glyph_indices, PathNVStrokeCoverMode::ConvexHull, PathNVTransformType::TranslateX, glyph_spacings); }
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); }
void Render(void) { using namespace oglplus; gl.Clear().ColorBuffer().StencilBuffer(); glc.Color(0.2, 0.2, 1.0); path.StencilFill(PathNVFillMode::CountUp, 0x1F); path.CoverFill(PathNVFillCoverMode::BoundingBox); glc.Color(0.1, 0.1, 0.1); path.StencilStroke(1, ~0); path.CoverStroke(PathNVStrokeCoverMode::ConvexHull); }
void Display(void) { using namespace oglplus; gl.Clear().ColorBuffer(); glc.Begin(CompatibilityPrimitiveType::Triangles); glc.Color(1.0, 0.0, 0.0); glc.Vertex(0.0f, 0.0f); glc.Color(0.0, 1.0, 0.0); glc.Vertex(1.0f, 0.0f); glc.Color(0.0, 0.0, 1.0); glc.Vertex(0.0f, 1.0f); glc.End(); }