| 394 | |
| 395 | |
| 396 | ChannelManagerForBatches* getChannelManager() { |
| 397 | |
| 398 | if (GLAD_GL_VERSION_2_0) |
| 399 | { |
| 400 | bool useGLSL = getVertexShader() != 0; |
| 401 | if (useGLSL) |
| 402 | return new SCSChannelManagerGLSLProgram; |
| 403 | } |
| 404 | |
| 405 | // The ARB vertex program path has the following problem: |
| 406 | // With Nouveau drivers on Linux and an NVidia GTX 710, the ARB_position_invariant |
| 407 | // option appears to be buggy sometimes, and this causes z-buffer artifacts. |
| 408 | // On the other hand, historical Intel drives failed to work for |
| 409 | // fixed-function vertex setup together with ARB vertex programs. |
| 410 | if ( OPENCSG_HAS_EXT(ARB_vertex_program) |
| 411 | && OPENCSG_HAS_EXT(ARB_fragment_program) |
| 412 | ) { |
| 413 | std::string vendor; |
| 414 | if (const char * v = (const char*)glGetString(GL_VENDOR)) |
| 415 | vendor = v; |
| 416 | bool isIntel = vendor.find("Intel") == 0; |
| 417 | |
| 418 | ProjTextureSetup setup = isIntel ? ARBShader : FixedFunction; |
| 419 | return new SCSChannelManagerARBProgram(setup); |
| 420 | } |
| 421 | |
| 422 | // The fallback path, using fixed function OpenGL, has its own problems: |
| 423 | // Obviously, it does not support more than 255 primitives. More importantly, |
| 424 | // due to the alpha test and the GL_EQUAL alpha function used here, due |
| 425 | // to accuracy problems, the alpha test for some IDs may incorrectly fail. |
| 426 | // Then, some primitives of the CSG share are completely missing. |
| 427 | return new SCSChannelManagerAlphaOnly; |
| 428 | } |
| 429 | |
| 430 | |
| 431 | class IDGenerator { |
no test coverage detected