File: os_gl.h

package info (click to toggle)
pymol 2.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 43,312 kB
  • sloc: cpp: 480,106; python: 79,860; ansic: 28,343; javascript: 6,792; sh: 47; makefile: 30; csh: 8
file content (98 lines) | stat: -rw-r--r-- 2,106 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef _H_os_gl
#define _H_os_gl

#include"os_predef.h"
#include"os_proprietary.h"

// hardcode either true, or (x)
#define ALWAYS_IMMEDIATE_OR(x) true

#if 1
  #define _PYMOL_NO_AA_SHADERS
#endif

#ifndef PURE_OPENGL_ES_2
  #define _PYMOL_ARB_SHADERS
#endif

#if !defined(GL_GLEXT_PROTOTYPES) && !defined(_WIN32)
#define GL_GLEXT_PROTOTYPES
#endif

#ifndef GLEW_NO_GLU
#define GLEW_NO_GLU
#endif

#ifndef PURE_OPENGL_ES_2
#include <GL/glew.h>
#endif

#ifdef PURE_OPENGL_ES_2
#include "os_gl_es.h"
#elif defined(_PYMOL_OSX)
#import <OpenGL/gl.h>
#import <OpenGL/glext.h>
#else
#include <GL/gl.h>
#endif

#include "os_gl_glut.h"

void PyMOLReadPixels(GLint x,
                     GLint y,
                     GLsizei width,
                     GLsizei height, GLenum format, GLenum type, GLvoid * pixels);

void PyMOLDrawPixels(GLsizei width,
                     GLsizei height, GLenum format, GLenum type, const GLvoid * pixels);

int PyMOLCheckOpenGLErr(const char *pos);

#if defined(_PYMOL_IOS) && !defined(_WEBGL)
#define GL_C_INT_TYPE ushort
#define GL_C_INT_ENUM GL_UNSIGNED_SHORT
#define SceneGLClearColor(red,green,blue,alpha) if (!SceneGetBackgroundColorAlreadySet(G)) glClearColor(red,green,blue,alpha);
#else
#define GL_C_INT_TYPE uint
#define GL_C_INT_ENUM GL_UNSIGNED_INT
#define SceneGLClearColor(red,green,blue,alpha) glClearColor(red,green,blue,alpha);
#endif

#ifndef GL_FRAGMENT_PROGRAM_ARB
#define GL_FRAGMENT_PROGRAM_ARB                         0x8804
#endif

#ifndef GLAPIENTRY
#define GLAPIENTRY
#endif

#define hasFrameBufferBinding() false

#ifndef PURE_OPENGL_ES_2
#define GL_DEBUG_PUSH(title) \
  GLEW_KHR_debug ? glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, title) : (void)0

#define GL_DEBUG_POP() \
  GLEW_KHR_debug ? glPopDebugGroup() : (void)0

#ifdef __cplusplus

class glDebugBlock {
public:
  explicit glDebugBlock(char const* title) {
    GL_DEBUG_PUSH(title);
  }
  ~glDebugBlock() {
    GL_DEBUG_POP();
  }
};

#define GL_DEBUG_FUN() \
  glDebugBlock glDebugBlockVariable(__FUNCTION__)

#endif /* __cplusplus */
#else
#define GL_DEBUG_FUN()
#endif

#endif