| 116 | } |
| 117 | |
| 118 | window_impl::window_impl(int pWidth, int pHeight, const char* pTitle, |
| 119 | std::weak_ptr<window_impl> pWindow, const bool invisible) |
| 120 | : mID(getNextUniqueId()) |
| 121 | { |
| 122 | initWtkIfNotDone(); |
| 123 | |
| 124 | if (auto observe = pWindow.lock()) { |
| 125 | mWindow = new wtk::Widget(pWidth, pHeight, pTitle, observe->get(), invisible); |
| 126 | } else { |
| 127 | /* when windows are not sharing any context, just create |
| 128 | * a dummy wtk::Widget object and pass it on */ |
| 129 | mWindow = new wtk::Widget(pWidth, pHeight, pTitle, nullptr, invisible); |
| 130 | } |
| 131 | /* Set context (before glewInit()) */ |
| 132 | MakeContextCurrent(this); |
| 133 | |
| 134 | glbinding::Binding::useCurrentContext(); |
| 135 | glbinding::Binding::initialize(false); // lazy function pointer evaluation |
| 136 | |
| 137 | mCxt = mWindow->getGLContextHandle(); |
| 138 | mDsp = mWindow->getDisplayHandle(); |
| 139 | /* copy colormap shared pointer if |
| 140 | * this window shares context with another window |
| 141 | * */ |
| 142 | if (auto observe = pWindow.lock()) { |
| 143 | mCMap = observe->colorMapPtr(); |
| 144 | } else { |
| 145 | mCMap = std::make_shared<colormap_impl>(); |
| 146 | } |
| 147 | |
| 148 | mWindow->resizePixelBuffers(); |
| 149 | |
| 150 | /* set the colormap to default */ |
| 151 | mColorMapUBO = mCMap->cmapUniformBufferId(FG_COLOR_MAP_DEFAULT); |
| 152 | mUBOSize = mCMap->cmapLength(FG_COLOR_MAP_DEFAULT); |
| 153 | glEnable(GL_MULTISAMPLE); |
| 154 | |
| 155 | mWindow->resetViewMatrices(); |
| 156 | mWindow->resetOrientationMatrices(); |
| 157 | |
| 158 | /* setup default window font */ |
| 159 | mFont = std::make_shared<font_impl>(); |
| 160 | #if defined(OS_WIN) |
| 161 | mFont->loadSystemFont("Calibri"); |
| 162 | #else |
| 163 | mFont->loadSystemFont("Vera"); |
| 164 | #endif |
| 165 | glEnable(GL_DEPTH_TEST); |
| 166 | |
| 167 | CheckGL("End Window::Window"); |
| 168 | } |
| 169 | |
| 170 | window_impl::~window_impl() |
| 171 | { |
nothing calls this directly
no test coverage detected