Commit f2510db3 authored by Ken Martin's avatar Ken Martin Committed by David E. DeMarle

add an executable to do opengl detection

Added an executable that is always built regardless
of if testing is on that checkes for OpenGL2 support.
This can be used to help diagnose problems when users
have a build using VTK that is not working and testing
is off as it is by default.

(cherry picked from commit 9eba3269)
parent 0bbbfac9
......@@ -366,6 +366,9 @@ if (APPLE_IOS)
vtk_module_link_libraries(${vtk-module} LINK_PUBLIC "-framework UIKit")
endif()
VTK_ADD_EXECUTABLE(vtkProbeOpenGLVersion vtkProbeOpenGLVersion.cxx)
target_link_libraries(vtkProbeOpenGLVersion ${vtk-module})
if (WIN32 AND ( NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR) )
VTK_ADD_EXECUTABLE(vtkTestOpenGLVersion vtkTestOpenGLVersion.cxx)
set_target_properties(vtkTestOpenGLVersion
......
/*=========================================================================
Program: Visualization Toolkit
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkAutoInit.h"
VTK_MODULE_INIT(vtkRenderingOpenGL2);
#include "vtkNew.h"
#include "vtkRenderer.h"
#include "vtkOpenGLRenderWindow.h"
#include "vtkOutputWindow.h"
#include <sstream>
int main(int , char* /* argv */[])
{
int result = 0;
vtkNew<vtkRenderer> renderer;
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
std::ostringstream toString;
toString << "Class: " << renderWindow->GetClassName();
if (!renderWindow->SupportsOpenGL())
{
toString << " failed to find a working OpenGL\n\n";
toString << vtkOpenGLRenderWindow::SafeDownCast(renderWindow)->GetOpenGLSupportMessage();
result = 1;
}
else
{
toString << " succeeded in finding a working OpenGL\n\n";
}
renderWindow->Render();
toString << renderWindow->ReportCapabilities();
vtkOutputWindow::GetInstance()->PromptUserOn();
vtkOutputWindow::GetInstance()->DisplayText(toString.str().c_str());
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment