vtk_glew.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtk_glew.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #ifndef vtk_glew_h
16 #define vtk_glew_h
17 
18 /* Use the glew library configured for VTK. */
19 #define VTK_MODULE_USE_EXTERNAL_vtkglew 0
20 
21 #define GLEW_NO_GLU
22 #define VTK_OPENGL_ES_VERSION 30
23 
24 /* Mobile device support. */
25 #define VTK_MODULE_vtkglew_GLES3 0
26 
27 #ifdef __APPLE__
28 #define GLES_SILENCE_DEPRECATION
29 #include "TargetConditionals.h"
30 #endif
31 
32 #define VTK_GLEW_SHARED 1
33 #if !VTK_GLEW_SHARED && !defined(GLEW_STATIC)
34 #define GLEW_STATIC
35 #endif
36 
37 #if VTK_MODULE_vtkglew_GLES3
38 #include <GLES3/gl3.h>
39 #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
40 #include <OpenGLES/ES3/gl.h>
41 #elif VTK_MODULE_USE_EXTERNAL_vtkglew
42 #include <GL/glew.h>
43 #ifdef _WIN32
44 #include <GL/wglew.h>
45 #endif
46 #else
47 #include <vtkglew/include/GL/glew.h>
48 #ifdef _WIN32
49 #include <vtkglew/include/GL/wglew.h>
50 #endif
51 #endif
52 
53 /* some fixes for both ES 2 and 3 */
54 #ifdef GL_ES_VERSION_3_0
55 #define GL_BACK_LEFT 0
56 #define GL_BACK_RIGHT 0
57 #define GL_FRONT_LEFT 0
58 #define GL_FRONT_RIGHT 0
59 
60 /* this sends all the data each time as opposed to allowing a subset */
61 #define glMultiDrawElements(mode, counts, type, indicies, primcount) \
62  for (size_t eCount = 0; eCount < primcount; ++eCount) \
63  { \
64  glDrawElements(mode, *(counts + eCount), type, (GLvoid*)(indicies[eCount])); \
65  }
66 #endif
67 
68 /*** deal with some GLES 3.0 specific issues ***/
69 #ifdef GL_ES_VERSION_3_0
70 #define GLEW_ARB_vertex_array_object 1
71 #define GLEW_ARB_instanced_arrays 1
72 #endif
73 
74 #endif