| 156 | } |
| 157 | |
| 158 | void Plot3DOpenGLCanvas::initializeGL() |
| 159 | { |
| 160 | initializeOpenGLFunctions(); |
| 161 | |
| 162 | // The following line triggered a bug where the whole screen would turn |
| 163 | // black during scrolling (specifically it seems that multiple calls to |
| 164 | // this function causes the issue): |
| 165 | // glEnable(GL_DEPTH_TEST); |
| 166 | |
| 167 | glEnable(GL_BLEND); |
| 168 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 169 | QColor color(String(canvas_3d_.param_.getValue("background_color").toString()).toQString()); |
| 170 | qglClearColor_(color); |
| 171 | calculateGridLines_(); |
| 172 | |
| 173 | //abort if no layers are displayed |
| 174 | if (canvas_3d_.getLayerCount() == 0) { return; } |
| 175 | |
| 176 | if (canvas_3d_.action_mode_ == PlotCanvas::AM_ZOOM) |
| 177 | { |
| 178 | if (!canvas_3d_.rubber_band_.isVisible()) |
| 179 | { |
| 180 | axes_ = makeAxes_(); |
| 181 | if (canvas_3d_.show_grid_) |
| 182 | { |
| 183 | gridlines_ = makeGridLines_(); |
| 184 | } |
| 185 | xrot_ = 90 * 16; |
| 186 | yrot_ = 0; |
| 187 | zrot_ = 0; |
| 188 | zoom_ = 1.25; |
| 189 | |
| 190 | if (stickdata_ != 0) |
| 191 | { |
| 192 | glDeleteLists(stickdata_, 1); |
| 193 | #ifdef DEBUG_TOPPVIEW |
| 194 | cout << "BEGIN " << OPENMS_PRETTY_FUNCTION << endl; |
| 195 | std::cout << "Deleting sticklist near makeDataAsTopView" << std::endl; |
| 196 | #endif |
| 197 | } |
| 198 | |
| 199 | stickdata_ = makeDataAsTopView_(); |
| 200 | axes_ticks_ = makeAxesTicks_(); |
| 201 | //drawAxesLegend_(); |
| 202 | } |
| 203 | } |
| 204 | else if (canvas_3d_.action_mode_ == PlotCanvas::AM_TRANSLATE) |
| 205 | { |
| 206 | if (canvas_3d_.show_grid_) { gridlines_ = makeGridLines_(); } |
| 207 | axes_ = makeAxes_(); |
| 208 | ground_ = makeGround_(); |
| 209 | x_1_ = 0.0; |
| 210 | y_1_ = 0.0; |
| 211 | x_2_ = 0.0; |
| 212 | y_2_ = 0.0; |
| 213 | |
| 214 | if (stickdata_ != 0) |
| 215 | { |