------------------------------------------------------------------------------
| 898 | |
| 899 | //------------------------------------------------------------------------------ |
| 900 | void vtkOpenGLRenderWindow::OpenGLInitContext() |
| 901 | { |
| 902 | this->ContextCreationTime.Modified(); |
| 903 | |
| 904 | // When a new OpenGL context is created, force an update |
| 905 | if (!this->Initialized) |
| 906 | { |
| 907 | #if defined(GLAD_GL) |
| 908 | if (this->SymbolLoader.LoadFunction != nullptr) |
| 909 | { |
| 910 | this->Initialized = |
| 911 | gladLoadGLUserPtr(this->SymbolLoader.LoadFunction, this->SymbolLoader.UserData) > 0; |
| 912 | } |
| 913 | else |
| 914 | { |
| 915 | this->Initialized = gladLoaderLoadGL() > 0; |
| 916 | } |
| 917 | if (!this->Initialized) |
| 918 | { |
| 919 | vtkWarningMacro(<< "Failed to initialize OpenGL functions!"); |
| 920 | return; |
| 921 | } |
| 922 | int major = 0; |
| 923 | int minor = 0; |
| 924 | glGetIntegerv(GL_MAJOR_VERSION, &major); |
| 925 | glGetIntegerv(GL_MINOR_VERSION, &minor); |
| 926 | // Require at least OpenGL 3.2 |
| 927 | if (major < 3 || (major == 3 && minor < 2)) |
| 928 | { |
| 929 | vtkWarningMacro(<< "Unable to find a valid OpenGL 3.2 or later implementation. " |
| 930 | << "(" << major << "." << minor |
| 931 | << " found). " |
| 932 | "Please update your video card driver to the latest version. " |
| 933 | "If you are using Mesa please make sure you have version 11.2 or " |
| 934 | "later and make sure your driver in Mesa supports OpenGL 3.2 such " |
| 935 | "as llvmpipe or openswr. If you are on windows and using Microsoft " |
| 936 | "remote desktop note that it only supports OpenGL 3.2 with nvidia " |
| 937 | "quadro cards. You can use other remoting software such as nomachine " |
| 938 | "to avoid this issue."); |
| 939 | return; |
| 940 | } |
| 941 | #else // gles |
| 942 | this->Initialized = true; |
| 943 | #endif |
| 944 | // Enable debug output if OpenGL version supports attaching debug callbacks. |
| 945 | #if defined(VTK_REPORT_OPENGL_ERRORS) && defined(GLAD_GL) |
| 946 | if (GLAD_GL_ARB_debug_output) |
| 947 | { |
| 948 | glEnable(GL_DEBUG_OUTPUT); |
| 949 | glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); |
| 950 | glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); |
| 951 | glDebugMessageCallback(vtkOpenGLMessageHandler, this); |
| 952 | } |
| 953 | #endif |
| 954 | // get this system's supported maximum line width |
| 955 | // we do it here and store it to avoid repeated glGet |
| 956 | // calls when the result should not change |
| 957 | this->MaximumHardwareLineWidth = 1.0; |
no test coverage detected