Commit 95b3c6e1 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

opengl1: remove conditional code for the OpenGL1 backend

parent a04696ff
......@@ -154,21 +154,11 @@ int TestMultipleScalarsToColors(int , char * [])
// down to there. For now disable is < OpenGL 2, should fix Mesa segfaults.
renwin->Render();
#if defined(VTK_OPENGL2)
bool openGL2Backend = true;
#else
bool openGL2Backend = false;
#endif
if (openGL2Backend || actor->GetContext()->GetDevice()->IsA("vtkOpenGL2ContextDevice2D"))
if (actor->GetContext()->GetDevice()->IsA("vtkOpenGL2ContextDevice2D"))
{
iren->Initialize();
iren->Start();
}
else
{
cout << "GL version 2 or higher is required." << endl;
}
return EXIT_SUCCESS;
}
......@@ -77,21 +77,11 @@ int TestScalarsToColors(int , char * [])
// Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(1);
#if defined(VTK_OPENGL2)
bool openGL2Backend = true;
#else
bool openGL2Backend = false;
#endif
if (openGL2Backend || view->GetContext()->GetDevice()->IsA("vtkOpenGL2ContextDevice2D"))
if (view->GetContext()->GetDevice()->IsA("vtkOpenGL2ContextDevice2D"))
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
else
{
cout << "GL version 2 or higher is required." << endl;
}
return EXIT_SUCCESS;
}
......@@ -2512,10 +2512,6 @@
</class>
</class>
</class>
<class id="vtkPainterDeviceAdapter" library="Rendering">
<class id="vtkOpenGLPainterDeviceAdapter" library="Rendering">
</class>
</class>
<class id="vtkProperty" library="Rendering">
<class id="vtkRIBProperty" library="Hybrid">
</class>
......
......@@ -1056,8 +1056,6 @@
</node>
<node id="vtkOpenGLScalarsToColorsPainter">
</node>
<node id="vtkPainterDeviceAdapter">
</node>
<node id="vtkOpenGLPainterDeviceAdapter">
</node>
<node id="vtkProperty">
......
......@@ -2512,10 +2512,6 @@
</class>
</class>
</class>
<class id="vtkPainterDeviceAdapter" library="Rendering">
<class id="vtkOpenGLPainterDeviceAdapter" library="Rendering">
</class>
</class>
<class id="vtkProperty" library="Rendering">
<class id="vtkRIBProperty" library="Hybrid">
</class>
......
......@@ -1056,8 +1056,6 @@
</node>
<node id="vtkOpenGLScalarsToColorsPainter">
</node>
<node id="vtkPainterDeviceAdapter">
</node>
<node id="vtkOpenGLPainterDeviceAdapter">
</node>
<node id="vtkProperty">
......
......@@ -18,9 +18,7 @@
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
#ifdef VTK_OPENGL2
#include "vtk_glew.h"
#endif
#include "QVTKGraphicsItem.h"
#include <QGLFramebufferObject>
......@@ -31,9 +29,6 @@
#include "QVTKInteractorAdapter.h"
#include "vtkGenericOpenGLRenderWindow.h"
#include "vtkEventQtSlotConnect.h"
#ifndef VTK_OPENGL2
#include "vtkgl.h"
#endif
#include "vtkOpenGLError.h"
QVTKGraphicsItem::QVTKGraphicsItem(QGLContext* ctx, QGraphicsItem* p)
......@@ -83,17 +78,10 @@ void QVTKGraphicsItem::SetRenderWindow(vtkGenericOpenGLRenderWindow* win)
{
mWin->SetMapped(1);
mWin->SetDoubleBuffer(0);
#ifdef VTK_OPENGL2
mWin->SetFrontBuffer(GL_COLOR_ATTACHMENT0);
mWin->SetFrontLeftBuffer(GL_COLOR_ATTACHMENT0);
mWin->SetBackBuffer(GL_COLOR_ATTACHMENT0);
mWin->SetBackLeftBuffer(GL_COLOR_ATTACHMENT0);
#else
mWin->SetFrontBuffer(vtkgl::COLOR_ATTACHMENT0_EXT);
mWin->SetFrontLeftBuffer(vtkgl::COLOR_ATTACHMENT0_EXT);
mWin->SetBackBuffer(vtkgl::COLOR_ATTACHMENT0_EXT);
mWin->SetBackLeftBuffer(vtkgl::COLOR_ATTACHMENT0_EXT);
#endif
mConnect->Connect(mWin, vtkCommand::StartEvent, this, SLOT(Start()));
mConnect->Connect(mWin, vtkCommand::WindowMakeCurrentEvent, this, SLOT(MakeCurrent()));
......
......@@ -514,9 +514,7 @@ QGLFormat QVTKWidget2::GetDefaultVTKFormat(vtkGenericOpenGLRenderWindow* w)
QGLFormat format;
format.setDepth(true);
#ifdef VTK_OPENGL2
format.setVersion(3, 2);
#endif
if (w)
{
......
......@@ -58,19 +58,10 @@ int RGrid( int argc, char *argv[] )
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
#ifdef VTK_OPENGL1
if (strcmp(renWin->GetRenderingBackend(),"OpenGL1"))
{
return vtkTesting::FAILED;
}
#endif
#ifdef VTK_OPENGL2
if (strcmp(renWin->GetRenderingBackend(),"OpenGL2"))
{
return vtkTesting::FAILED;
}
#endif
vtkFloatArray *xCoords = vtkFloatArray::New();
for (i=0; i<47; i++) xCoords->InsertNextValue(x[i]);
......
......@@ -17,11 +17,7 @@
#include "vtkCamera.h"
#include "vtkCompositeDataSet.h"
#include "vtkRenderingOpenGLConfigure.h"
#ifdef VTK_OPENGL2
#include "vtkCompositeDataDisplayAttributes.h"
#else
#include "vtkCompositeDataDisplayAttributesLegacy.h"
#endif
#include "vtkCompositePolyDataMapper2.h"
#include "vtkCullerCollection.h"
#include "vtkInformation.h"
......@@ -64,13 +60,8 @@ int TestCompositePolyDataMapper2(int argc, char* argv[])
vtkSmartPointer<vtkCompositePolyDataMapper2> mapper =
vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
#ifdef VTK_OPENGL2
vtkNew<vtkCompositeDataDisplayAttributes> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#else
vtkNew<vtkCompositeDataDisplayAttributesLegacy> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#endif
#ifdef syntheticData
......
......@@ -17,11 +17,7 @@
#include "vtkCamera.h"
#include "vtkCompositeDataSet.h"
#include "vtkRenderingOpenGLConfigure.h"
#ifdef VTK_OPENGL2
#include "vtkCompositeDataDisplayAttributes.h"
#else
#include "vtkCompositeDataDisplayAttributesLegacy.h"
#endif
#include "vtkCompositePolyDataMapper2.h"
#include "vtkCullerCollection.h"
#include "vtkInformation.h"
......@@ -64,13 +60,8 @@ int TestCompositePolyDataMapper2CellScalars(int argc, char* argv[])
vtkSmartPointer<vtkCompositePolyDataMapper2> mapper =
vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
#ifdef VTK_OPENGL2
vtkNew<vtkCompositeDataDisplayAttributes> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#else
vtkNew<vtkCompositeDataDisplayAttributesLegacy> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#endif
int resolution = 18;
vtkNew<vtkCylinderSource> cyl;
......
......@@ -17,11 +17,7 @@
#include "vtkCamera.h"
#include "vtkCompositeDataSet.h"
#include "vtkRenderingOpenGLConfigure.h"
#ifdef VTK_OPENGL2
#include "vtkCompositeDataDisplayAttributes.h"
#else
#include "vtkCompositeDataDisplayAttributesLegacy.h"
#endif
#include "vtkCompositePolyDataMapper2.h"
#include "vtkCullerCollection.h"
#include "vtkInformation.h"
......@@ -67,13 +63,8 @@ int TestCompositePolyDataMapper2MixedGeometryCellScalars(int argc, char* argv[])
vtkSmartPointer<vtkCompositePolyDataMapper2> mapper =
vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
#ifdef VTK_OPENGL2
vtkNew<vtkCompositeDataDisplayAttributes> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#else
vtkNew<vtkCompositeDataDisplayAttributesLegacy> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#endif
int resolution = 18;
vtkNew<vtkCylinderSource> cyl;
......
......@@ -17,11 +17,7 @@
#include "vtkCamera.h"
#include "vtkCompositeDataSet.h"
#include "vtkRenderingOpenGLConfigure.h"
#ifdef VTK_OPENGL2
#include "vtkCompositeDataDisplayAttributes.h"
#else
#include "vtkCompositeDataDisplayAttributesLegacy.h"
#endif
#include "vtkCompositePolyDataMapper2.h"
#include "vtkCullerCollection.h"
#include "vtkInformation.h"
......@@ -67,13 +63,8 @@ int TestCompositePolyDataMapper2MixedGeometryEdges(int argc, char* argv[])
vtkSmartPointer<vtkCompositePolyDataMapper2> mapper =
vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
#ifdef VTK_OPENGL2
vtkNew<vtkCompositeDataDisplayAttributes> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#else
vtkNew<vtkCompositeDataDisplayAttributesLegacy> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#endif
int resolution = 18;
vtkNew<vtkCylinderSource> cyl;
......
......@@ -17,11 +17,7 @@
#include "vtkCamera.h"
#include "vtkCompositeDataSet.h"
#include "vtkRenderingOpenGLConfigure.h"
#ifdef VTK_OPENGL2
#include "vtkCompositeDataDisplayAttributes.h"
#else
#include "vtkCompositeDataDisplayAttributesLegacy.h"
#endif
#include "vtkCompositePolyDataMapper2.h"
#include "vtkCullerCollection.h"
#include "vtkInformation.h"
......@@ -61,13 +57,8 @@ int TestCompositePolyDataMapper2Scalars(int argc, char* argv[])
vtkSmartPointer<vtkCompositePolyDataMapper2> mapper =
vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
#ifdef VTK_OPENGL2
vtkNew<vtkCompositeDataDisplayAttributes> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#else
vtkNew<vtkCompositeDataDisplayAttributesLegacy> cdsa;
mapper->SetCompositeDataDisplayAttributes(cdsa.GetPointer());
#endif
int resolution = 18;
vtkNew<vtkCylinderSource> cyl;
......
......@@ -33,19 +33,6 @@
#include "vtkUnsignedCharArray.h"
// on the old OpenGL this test fails on Mesa
// so we just return true in that case
#ifndef VTK_OPENGL2
#include "vtkOpenGLRenderWindow.h"
#include "vtkOpenGLExtensionManager.h"
bool IsDriverMesa(vtkRenderWindow *renwin)
{
vtkOpenGLRenderWindow *context
= vtkOpenGLRenderWindow::SafeDownCast(renwin);
return context->GetExtensionManager()->DriverIsMesa();
}
#endif
int TestEdgeFlags(int argc, char *argv[])
{
vtkNew<vtkPoints> pts;
......@@ -159,17 +146,6 @@ int TestEdgeFlags(int argc, char *argv[])
renWin->Render();
// on the old OpenGL this test fails on Mesa
// so we just return true in that case
#ifndef VTK_OPENGL2
if (IsDriverMesa(renWin))
{
// Mesa support for edge flags is buggy.
std::cout << "Mesa detected. Skip the test." << std::endl;
return !vtkRegressionTester::PASSED;
}
#endif
// Compare image
int retVal = vtkRegressionTestImage(renWin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
......
......@@ -35,10 +35,6 @@
#define ID_OFFSET 1
#ifdef VTK_OPENGL1
#include "vtkPainterDeviceAdapter.h"
#endif
//----------------------------------------------------------------------------
namespace
{
......@@ -379,38 +375,6 @@ void vtkHardwareSelector::BeginRenderProp()
//cout << "In BeginRenderProp" << endl;
//glFinish();
#ifdef VTK_OPENGL1
if (this->CurrentPass == ACTOR_PASS)
{
int propid = this->PropID;
if (propid >= 0xfffffe)
{
vtkErrorMacro("Too many props. Currently only " << 0xfffffe
<< " props are supported.");
return;
}
float color[3];
// Since 0 is reserved for nothing selected, we offset propid by 1.
propid = propid + 1;
vtkHardwareSelector::Convert(propid, color);
renWin->GetPainterDeviceAdapter()->SendAttribute(
vtkDataSetAttributes::SCALARS, 3, VTK_FLOAT, color);
}
else if (this->CurrentPass == PROCESS_PASS)
{
float color[3];
// Since 0 is reserved for nothing selected, we offset propid by 1.
vtkHardwareSelector::Convert(this->ProcessID + 1, color);
renWin->GetPainterDeviceAdapter()->SendAttribute(
vtkDataSetAttributes::SCALARS, 3, VTK_FLOAT, color);
}
else
{
float color[3] = {0, 0, 0};
renWin->GetPainterDeviceAdapter()->SendAttribute(
vtkDataSetAttributes::SCALARS, 3, VTK_FLOAT, color);
}
#endif
}
//----------------------------------------------------------------------------
......@@ -441,18 +405,6 @@ void vtkHardwareSelector::RenderCompositeIndex(unsigned int index)
return;
}
#ifdef VTK_OPENGL1
index += ID_OFFSET;
//glFinish();
if (this->CurrentPass == COMPOSITE_INDEX_PASS)
{
float color[3];
vtkHardwareSelector::Convert(static_cast<int>(0xffffff & index), color);
this->Renderer->GetRenderWindow()->GetPainterDeviceAdapter()->SendAttribute(
vtkDataSetAttributes::SCALARS, 3, VTK_FLOAT, color);
}
#endif
}
//----------------------------------------------------------------------------
......@@ -473,25 +425,6 @@ void vtkHardwareSelector::RenderAttributeId(vtkIdType attribid)
{
return;
}
#ifdef VTK_OPENGL1
// 0 is reserved.
attribid += ID_OFFSET;
for (int cc=0; cc < 3; cc++)
{
int words24 = (0xffffff & attribid);
attribid = attribid >> 24;
if ((this->CurrentPass - ID_LOW24) == cc)
{
float color[3];
vtkHardwareSelector::Convert(words24, color);
this->Renderer->GetRenderWindow()->GetPainterDeviceAdapter()->SendAttribute(
vtkDataSetAttributes::SCALARS, 3, VTK_FLOAT, color);
break;
}
}
#endif
}
//----------------------------------------------------------------------------
......@@ -504,14 +437,6 @@ void vtkHardwareSelector::RenderProcessId(unsigned int processid)
vtkErrorMacro("Invalid id: " << processid);
return;
}
#ifdef VTK_OPENGL1
float color[3];
vtkHardwareSelector::Convert(
static_cast<int>(processid + 1), color);
this->Renderer->GetRenderWindow()->GetPainterDeviceAdapter()->SendAttribute(
vtkDataSetAttributes::SCALARS, 3, VTK_FLOAT, color);
#endif
}
}
......
......@@ -30,14 +30,6 @@
#include <cmath>
#ifndef VTK_LEGACY_REMOVE
#ifdef VTK_OPENGL2
class vtkPainterDeviceAdapter : public vtkObject {};
#else
#include "vtkPainterDeviceAdapter.h"
#endif
#endif
//----------------------------------------------------------------------------
// Use the vtkAbstractObjectFactoryNewMacro to allow the object factory overrides.
vtkAbstractObjectFactoryNewMacro(vtkRenderWindow)
......@@ -87,10 +79,6 @@ vtkRenderWindow::vtkRenderWindow()
this->AnaglyphColorMask[0] = 4; // red
this->AnaglyphColorMask[1] = 3; // cyan
#ifndef VTK_LEGACY_REMOVE
this->PainterDeviceAdapter = nullptr;
#endif
this->AbortCheckTime = 0.0;
this->CapturingGL2PSSpecialProps = 0;
this->MultiSamples = 0;
......@@ -135,13 +123,6 @@ vtkRenderWindow::~vtkRenderWindow()
this->Renderers->Delete();
}
#ifndef VTK_LEGACY_REMOVE
if (this->PainterDeviceAdapter)
{
this->PainterDeviceAdapter->Delete();
}
#endif
}
//----------------------------------------------------------------------------
......@@ -923,19 +904,6 @@ void vtkRenderWindow::PrintSelf(ostream& os, vtkIndent indent)
<< this->AnaglyphColorMask[0] << " , "
<< this->AnaglyphColorMask[1] << "\n";
#ifndef VTK_LEGACY_REMOVE
os << indent << "PainterDeviceAdapter: ";
if (this->PainterDeviceAdapter)
{
os << endl;
this->PainterDeviceAdapter->PrintSelf(os, indent.GetNextIndent());
}
else
{
os << "(none)" << endl;
}
#endif
os << indent << "MultiSamples: " << this->MultiSamples << "\n";
os << indent << "StencilCapable: " <<
(this->StencilCapable ? "True" : "False") << endl;
......@@ -1475,12 +1443,6 @@ const char *vtkRenderWindow::GetStereoTypeAsString()
//----------------------------------------------------------------------------
#if !defined(VTK_LEGACY_REMOVE)
vtkPainterDeviceAdapter *vtkRenderWindow::GetPainterDeviceAdapter()
{
VTK_LEGACY_BODY(vtkRenderWindow::GetPainterDeviceAdapter, "VTK 8.1");
return this->PainterDeviceAdapter;
}
int vtkRenderWindow::GetAAFrames()
{
VTK_LEGACY_BODY(vtkRenderWindow::GetAAFrames, "VTK 8.1");
......
......@@ -46,9 +46,6 @@
#include "vtkNew.h" // For vtkNew
class vtkFloatArray;
#ifndef VTK_LEGACY_REMOVE
class vtkPainterDeviceAdapter;
#endif
class vtkProp;
class vtkCollection;
class vtkRenderTimerLog;
......@@ -670,15 +667,6 @@ public:
*/
virtual int GetColorBufferSizes(int *rgba) = 0;
//@{
/**
* Get the vtkPainterDeviceAdapter which can be used to paint on
* this render window. Note the old OpenGL backend requires this
* method.
*/
VTK_LEGACY(vtkPainterDeviceAdapter *GetPainterDeviceAdapter());
//@}
//@{
/**
* Set / Get the number of multisamples to use for hardware antialiasing.
......@@ -744,9 +732,6 @@ protected:
virtual void DoFDRender();
virtual void DoAARender();
#ifndef VTK_LEGACY_REMOVE
vtkPainterDeviceAdapter* PainterDeviceAdapter;
#endif
vtkRendererCollection *Renderers;
vtkNew<vtkRenderTimerLog> RenderTimer;
int Borders;
......
......@@ -14,10 +14,6 @@
=========================================================================*/
#include "vtkExternalOpenGLCamera.h"
#ifndef VTK_OPENGL2
#include "vtkgluPickMatrix.h"
#endif
#include "vtkMatrix4x4.h"
#include "vtkObjectFactory.h"
#include "vtkOpenGLError.h"
......@@ -128,64 +124,6 @@ void vtkExternalOpenGLCamera::Render(vtkRenderer *ren)
glEnable(GL_SCISSOR_TEST);
glScissor(lowerLeft[0], lowerLeft[1], usize, vsize);
#ifndef VTK_OPENGL2
// some renderer subclasses may have more complicated computations for the
// aspect ratio. So take that into account by computing the difference
// between our simple aspect ratio and what the actual renderer is reporting.
double aspect[2];
ren->ComputeAspect();
ren->GetAspect(aspect);
double aspect2[2];
ren->vtkViewport::ComputeAspect();
ren->vtkViewport::GetAspect(aspect2);
double aspectModification = aspect[0] * aspect2[1] / (aspect[1] * aspect2[0]);
vtkMatrix4x4 *matrix = vtkMatrix4x4::New();
glMatrixMode(GL_PROJECTION);
if (usize && vsize)
{
matrix->DeepCopy(this->GetProjectionTransformMatrix(
aspectModification * usize / vsize, -1, 1));
matrix->Transpose();
}
if (ren->GetIsPicking())
{
int size[2] = {usize, vsize};
glLoadIdentity();
vtkgluPickMatrix(ren->GetPickX(), ren->GetPickY(),
ren->GetPickWidth(), ren->GetPickHeight(),
lowerLeft, size);
glMultMatrixd(matrix->Element[0]);
}
else
{
// insert camera view transformation
glLoadMatrixd(matrix->Element[0]);
}
// push the model view matrix onto the stack, make sure we
// adjust the mode first
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
matrix->DeepCopy(this->GetViewTransformMatrix());
matrix->Transpose();
// insert camera view transformation
if(this->UserProvidedViewTransform)
<