Blender  V3.3
app/opengl/shader.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 OpenGL Foundation */
3 
4 #pragma once
5 
6 #include "util/types.h"
7 
9 
10 class OpenGLShader {
11  public:
12  static constexpr const char *position_attribute_name = "pos";
13  static constexpr const char *tex_coord_attribute_name = "texCoord";
14 
15  OpenGLShader() = default;
16  virtual ~OpenGLShader() = default;
17 
18  /* Get attribute location for position and texture coordinate respectively.
19  * NOTE: The shader needs to be bound to have access to those. */
22 
23  void bind(int width, int height);
24  void unbind();
25 
26  protected:
28 
30  void destroy_shader();
31 
32  /* Cached values of various OpenGL resources. */
35 
39 
40  /* Shader compilation attempted. Which means, that if the shader program is 0 then compilation or
41  * linking has failed. Do not attempt to re-compile the shader. */
43 };
44 
unsigned int uint
Definition: BLI_sys_types.h:67
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
void create_shader_if_needed()
int get_position_attrib_location()
OpenGLShader()=default
static constexpr const char * position_attribute_name
virtual ~OpenGLShader()=default
int position_attribute_location_
bool shader_compile_attempted_
void bind(int width, int height)
int get_tex_coord_attrib_location()
int tex_coord_attribute_location_
static constexpr const char * tex_coord_attribute_name
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9