MCPcopy Create free account
hub / github.com/arrayfire/forge / window_impl

Method window_impl

src/backend/opengl/window_impl.cpp:118–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118window_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
170window_impl::~window_impl()
171{

Callers

nothing calls this directly

Calls 12

getNextUniqueIdFunction · 0.85
initWtkIfNotDoneFunction · 0.85
MakeContextCurrentFunction · 0.85
cmapUniformBufferIdMethod · 0.80
cmapLengthMethod · 0.80
getMethod · 0.45
getGLContextHandleMethod · 0.45
getDisplayHandleMethod · 0.45
resizePixelBuffersMethod · 0.45
resetViewMatricesMethod · 0.45
loadSystemFontMethod · 0.45

Tested by

no test coverage detected