Skip to content

Commit

Permalink
+ fix various rendering problems
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Nov 4, 2014
1 parent 3507e30 commit fa3a2a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/Gui/GLPainter.cpp
Expand Up @@ -261,8 +261,10 @@ void Rubberband::paintGL()
SbVec2s size = vp.getViewportSizePixels();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, size[0], size[1], 0, 0, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Expand Down Expand Up @@ -372,8 +374,10 @@ void Polyline::paintGL()
SbVec2s size = vp.getViewportSizePixels();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, size[0], size[1], 0, 0, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/MouseSelection.cpp
Expand Up @@ -261,7 +261,7 @@ void PolyPickerSelection::initialize()
polyline.setColor(0.0,0.0,1.0,1.0);

_pcView3D->addGraphicsItem(&polyline);
_pcView3D->setRenderType(View3DInventorViewer::Framebuffer);
_pcView3D->setRenderType(View3DInventorViewer::Image);
_pcView3D->redraw();
}

Expand Down
6 changes: 5 additions & 1 deletion src/Gui/View3DInventorViewer.cpp
Expand Up @@ -1321,11 +1321,14 @@ void View3DInventorViewer::renderGLImage()
glViewport(0, 0, size[0], size[1]);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, size[0], 0, size[1], 0, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);

glDisable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT);

glRasterPos2f(0,0);
glDrawPixels(glImage.width(),glImage.height(),GL_RGBA,GL_UNSIGNED_BYTE,glImage.bits());

printDimension();
Expand Down Expand Up @@ -1359,6 +1362,7 @@ void View3DInventorViewer::renderScene(void)
const QColor col = this->backgroundColor();
glClearColor(col.redF(), col.greenF(), col.blueF(), 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);

#if defined(ENABLE_GL_DEPTH_RANGE)
// using 90% of the z-buffer for the background and the main node
Expand Down
6 changes: 2 additions & 4 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -752,9 +752,7 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
rubberband->setWorking(false);

//disable framebuffer drawing in viewer
if (Gui::Application::Instance->activeDocument()->getActiveView()) {
static_cast<Gui::View3DInventor *>(Gui::Application::Instance->activeDocument()->getActiveView())->getViewer()->setRenderType(Gui::View3DInventorViewer::Native);
}
const_cast<Gui::View3DInventorViewer *>(viewer)->setRenderType(Gui::View3DInventorViewer::Native);

// a redraw is required in order to clear the rubberband
draw(true);
Expand Down Expand Up @@ -1085,7 +1083,7 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
case STATUS_SKETCH_StartRubberBand: {
Mode = STATUS_SKETCH_UseRubberBand;
rubberband->setWorking(true);
viewer->setRenderType(Gui::View3DInventorViewer::Framebuffer);
viewer->setRenderType(Gui::View3DInventorViewer::Image);
return true;
}
case STATUS_SKETCH_UseRubberBand: {
Expand Down

0 comments on commit fa3a2a0

Please sign in to comment.