Blender V4.3
gl_primitive.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#pragma once
12
13#include "BLI_assert.h"
14
15#include "GPU_primitive.hh"
16
17namespace blender::gpu {
18
19static inline GLenum to_gl(GPUPrimType prim_type)
20{
21 BLI_assert(prim_type != GPU_PRIM_NONE);
22 switch (prim_type) {
23 default:
24 case GPU_PRIM_POINTS:
25 return GL_POINTS;
26 case GPU_PRIM_LINES:
27 return GL_LINES;
29 return GL_LINE_STRIP;
31 return GL_LINE_LOOP;
32 case GPU_PRIM_TRIS:
33 return GL_TRIANGLES;
35 return GL_TRIANGLE_STRIP;
37 return GL_TRIANGLE_FAN;
38
40 return GL_LINES_ADJACENCY;
42 return GL_LINE_STRIP_ADJACENCY;
44 return GL_TRIANGLES_ADJACENCY;
45 };
46}
47
48} // namespace blender::gpu
#define BLI_assert(a)
Definition BLI_assert.h:50
GPUPrimType
@ GPU_PRIM_TRI_FAN
@ GPU_PRIM_LINE_LOOP
@ GPU_PRIM_LINE_STRIP_ADJ
@ GPU_PRIM_TRIS_ADJ
@ GPU_PRIM_NONE
@ GPU_PRIM_LINES
@ GPU_PRIM_POINTS
@ GPU_PRIM_LINES_ADJ
@ GPU_PRIM_LINE_STRIP
@ GPU_PRIM_TRI_STRIP
@ GPU_PRIM_TRIS
static GLenum to_gl(const GPUAttachmentType type)