Blender  V2.93
gl_primitive.hh
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2020 Blender Foundation.
17  * All rights reserved.
18  */
19 
26 #pragma once
27 
28 #include "BLI_assert.h"
29 
30 #include "GPU_primitive.h"
31 
32 #include "glew-mx.h"
33 
34 namespace blender::gpu {
35 
36 static inline GLenum to_gl(GPUPrimType prim_type)
37 {
38  BLI_assert(prim_type != GPU_PRIM_NONE);
39  switch (prim_type) {
40  default:
41  case GPU_PRIM_POINTS:
42  return GL_POINTS;
43  case GPU_PRIM_LINES:
44  return GL_LINES;
46  return GL_LINE_STRIP;
47  case GPU_PRIM_LINE_LOOP:
48  return GL_LINE_LOOP;
49  case GPU_PRIM_TRIS:
50  return GL_TRIANGLES;
51  case GPU_PRIM_TRI_STRIP:
52  return GL_TRIANGLE_STRIP;
53  case GPU_PRIM_TRI_FAN:
54  return GL_TRIANGLE_FAN;
55 
56  case GPU_PRIM_LINES_ADJ:
57  return GL_LINES_ADJACENCY;
59  return GL_LINE_STRIP_ADJACENCY;
60  case GPU_PRIM_TRIS_ADJ:
61  return GL_TRIANGLES_ADJACENCY;
62  };
63 }
64 
65 } // namespace blender::gpu
#define BLI_assert(a)
Definition: BLI_assert.h:58
GPUPrimType
Definition: GPU_primitive.h:34
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:41
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:39
@ GPU_PRIM_LINE_STRIP_ADJ
Definition: GPU_primitive.h:45
@ GPU_PRIM_TRIS_ADJ
Definition: GPU_primitive.h:44
@ GPU_PRIM_NONE
Definition: GPU_primitive.h:47
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:35
@ GPU_PRIM_LINES_ADJ
Definition: GPU_primitive.h:43
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:38
@ GPU_PRIM_TRI_STRIP
Definition: GPU_primitive.h:40
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:37
static GLenum to_gl(const GPUAttachmentType type)