void SystemCinderApp::setup() { //create configuration object to parse program information Configuration* configuration = new Configuration(XML_FILE_PATH); // get what kind of Display we will be using and assign it to our attribute mDisplayType mDisplayType = configuration->GetDisplayID(); /*FBO where we will be rendering our scene */ gl::Fbo::Format format; mFbo = gl::Fbo::create(FBO_HEIGHT, FBO_WIDTH, format.depthTexture()); // Load corresponding shaders, place in assets and use something like this: /* try{ mMappingShader = gl::GlslProg( loadFile("path/shaders/mappingShader.glsl"), loadFile ("path/shaders/mappingShader.glsl"); }catch(...){ console() << "Cant load/compile shader"<<endl; */ WindowRef mMainWindow = getWindow(); // dektop monitor window goes in index 0 mProjectors[0] = mMainWindow; /*If the hardware sphere was selected, we create the corresponding windows*/ if (mDisplayType == 3){ /*Determine how many Displays/Monitors are connected to the system*/ /*I only have one but once we use the projectors m Display should contain a reference to all the displays connected to the system */ mDisplays = ci::Display::getDisplays(); int i = 1; /* open a window for every projector, if we have 2 projectors we will have 3 windows in total (1 desktop monitor, 1 for projector1 and 1 for projector2*/ /* As this is the defult window we set its size in prepareSettings(App::Settings* settings) at top of this file */ for (i; i <= configuration->GetNumberOfProjectors(); i++){ mProjectors[i] = createWindow(Window::Format().size(configuration->GetWidthProjectors(), configuration->GetHeightProjectors())); /* .display sets each window to a monitor but becuase now I only have one monitor all widnows will display to the same monitor */ //mProjectors[i] = createWindow(Window::Format().display(mDisplays[i]).size(configuration->GetWidthProjectors(), configuration->GetHeightProjectors())); } /*connect each window with it's draw method where we will generate and send the corresponding texture from the FBO. You will need to create a method for every projector we add to the system*/ /* build a generate draw for each projector*/ mProjectors[0]->getSignalDraw().connect([this] { drawMain(); }); mProjectors[1]->getSignalDraw().connect([this] { drawFirst(); }); mProjectors[2]->getSignalDraw().connect([this] { drawSecond(); }); //mProjectors[3]->getSignalDraw().connect([this] { drawThird(); }); /*Else virtualSphere or VirtualCube where determined in configuration we call the VirtualDisplayConstructor*/ }else { mVirtualDisplay = new VirtualDisplay(mDisplayType); mProjectors[0]->getSignalDraw().connect([this] { drawSimulator(); }); } setupScene(); gl::enableDepthRead(); gl::enableDepthWrite(); }
void BrushStroker::moveTo(const TabletInputData &originalData) { auto data = originalData; filterData(data); clearLastEditedKeys(); _count = 0; _dataEnd = data; if (_smoothed) { _dataPrev = data; _dataStart = data; } else { drawFirst(data); } }
void BrushStroker::lineTo(const TabletInputData &originalData) { auto data = originalData; filterData(data); _count += 1; if (_smoothed) { if (_count >= 2) { auto polygon = CurveSubdivision(Curve4::fromBSpline(_dataPrev.pos, _dataStart.pos, _dataEnd.pos, data.pos)).polygon(); if (_count == 2) { auto firstData = _dataStart; firstData.pos = polygon.first(); drawFirst(firstData); } drawInterval(polygon, _dataStart, _dataEnd); } _dataPrev = _dataStart; _dataStart = _dataEnd; _dataEnd = data; } else { _dataStart = _dataEnd; _dataEnd = data; if (_dataStart.pos == _dataEnd.pos) return; _segment[0] = _dataStart.pos; _segment[1] = _dataEnd.pos; drawInterval(_segment, _dataStart, _dataEnd); } }