void Waveform::renderGL( ) { if(!mIsInitialized) { InitializeGLCanvas(); } if(!IsShownOnScreen()) return; SetCurrentGLContext(); LOG_GL_ERRORV(glClear(GL_COLOR_BUFFER_BIT)); prepare2DViewport(0,0,mWindowWidth, mWindowHeight); if (mCurrentWaveView >= 0) { DrawWaveView(views[mCurrentWaveView]); } LOG_GL_ERRORV(SwapBuffers()); }
void xlGridCanvasPictures::render( wxPaintEvent& event ) { if(!mIsInitialized) { InitializeGLCanvas(); } if(!IsShownOnScreen()) return; SetCurrentGLContext(); LOG_GL_ERRORV(glClear(GL_COLOR_BUFFER_BIT)); prepare2DViewport(0,0,mWindowWidth, mWindowHeight); if( mEffect != nullptr ) { DrawPicturesEffect(); DrawBaseGrid(); DrawSelection(); } SwapBuffers(); }
void Waveform::renderGL( wxPaintEvent& event ) { if(!mIsInitialized) { InitializeGLCanvas(); } if(!IsShownOnScreen()) return; SetCurrentGLContext(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if( mWindowResized ) { prepare2DViewport(0,0,mWindowWidth, mWindowHeight); } DrawWaveView(views[mCurrentWaveView]); glFlush(); SwapBuffers(); }
bool ModelPreview::StartDrawing(wxDouble pointSize) { if(!IsShownOnScreen()) return false; if(!mIsInitialized) { InitializeGLCanvas(); } mIsInitialized = true; mPointSize = pointSize; mIsDrawing = true; SetCurrentGLContext(); wxClientDC dc(this); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if( mWindowResized ) { prepare2DViewport(0,0,mWindowWidth, mWindowHeight); } glPointSize(translateToBacking(mPointSize)); glPushMatrix(); // Rotate Axis and tranlate glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glRotatef(180,0,0,1); glRotatef(180,0,1,0); currentPixelScaleFactor = 1.0; if (!allowSelected && virtualWidth > 0 && virtualHeight > 0 && (virtualWidth != mWindowWidth || virtualHeight != mWindowHeight)) { glTranslatef(0,-mWindowHeight,0); double scaleh= double(mWindowHeight) / double(virtualHeight); double scalew = double(mWindowWidth) / double(virtualWidth); glScalef(scalew, scaleh, 1.0); if (scalew < scaleh) { scaleh = scalew; } currentPixelScaleFactor = scaleh; glPointSize(calcPixelSize(mPointSize)); glColor3f(0.0, 0.0, 0.0); glBegin(GL_QUADS); glVertex2f(0, 0); glVertex2f(virtualWidth, 0); glVertex2f(virtualWidth, virtualHeight); glVertex2f(0, virtualHeight); glEnd(); } else if (virtualWidth == 0 && virtualHeight == 0) { glTranslatef(0, -mWindowHeight, 0); } else { glTranslatef(0, -virtualHeight, 0); glColor3f(0.0, 0.0, 0.0); glBegin(GL_QUADS); glVertex2f(0, 0); glVertex2f(virtualWidth, 0); glVertex2f(virtualWidth, virtualHeight); glVertex2f(0, virtualHeight); glEnd(); } if(mBackgroundImageExists) { if (image == NULL) { image = new Image(mBackgroundImage); sprite = new xLightsDrawable(image); } float intensity = mBackgroundBrightness*.01; glPushMatrix(); double scaleh= double(virtualHeight) / double(image->height); double scalew = double(virtualWidth) / double(image->width); if (scaleImage) { glScalef(scalew, scaleh, 1.0); } else { if (scalew < scaleh) { scaleh = scalew; } glScalef(scaleh, scaleh, 1.0); } glColor3f(intensity, intensity, intensity); glEnable(GL_TEXTURE_2D); // textures sprite->render(); glDisable(GL_TEXTURE_2D); // textures glPopMatrix(); } return true; }