Blender  V3.3
window.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 #include "app/opengl/window.h"
8 
9 #include "util/string.h"
10 #include "util/thread.h"
11 #include "util/time.h"
12 #include "util/version.h"
13 
14 #include <GL/glew.h>
15 #include <SDL.h>
16 
18 
19 /* structs */
20 
21 struct Window {
22  WindowInitFunc initf = nullptr;
23  WindowExitFunc exitf = nullptr;
28 
29  bool first_display = true;
30  bool redraw = false;
31 
32  int mouseX = 0, mouseY = 0;
33  int mouseBut0 = 0, mouseBut2 = 0;
34 
35  int width = 0, height = 0;
36 
37  SDL_Window *window = nullptr;
38  SDL_GLContext gl_context = nullptr;
40 } V;
41 
42 /* public */
43 
44 static void window_display_text(int x, int y, const char *text)
45 {
46 /* Not currently supported, need to add text rendering support. */
47 #if 0
48  const char *c;
49 
50  glRasterPos3f(x, y, 0);
51  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
52 
53  printf("display %s\n", text);
54 
55  for (c = text; *c != '\0'; c++) {
56  const uint8_t *bitmap = helvetica10_character_map[*c];
57  glBitmap(bitmap[0],
58  helvetica10_height,
59  helvetica10_x_offset,
60  helvetica10_y_offset,
61  bitmap[0],
62  0.0f,
63  bitmap + 1);
64  }
65 #else
66  static string last_text = "";
67 
68  if (text != last_text) {
69  printf("%s\n", text);
70  last_text = text;
71  }
72 #endif
73 }
74 
75 void window_display_info(const char *info)
76 {
77  const int height = 20;
78 
79 #if 0
80  glEnable(GL_BLEND);
81  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
82  glColor4f(0.1f, 0.1f, 0.1f, 0.8f);
83  glRectf(0.0f, V.height - height, V.width, V.height);
84  glDisable(GL_BLEND);
85 
86  glColor3f(0.5f, 0.5f, 0.5f);
87 #endif
88 
89  window_display_text(10, 7 + V.height - height, info);
90 
91 #if 0
92  glColor3f(1.0f, 1.0f, 1.0f);
93 #endif
94 }
95 
97 {
98  const int w = (int)((float)V.width / 1.15f);
99  const int h = (int)((float)V.height / 1.15f);
100 
101  const int x1 = (V.width - w) / 2;
102 #if 0
103  const int x2 = x1 + w;
104 #endif
105 
106  const int y1 = (V.height - h) / 2;
107  const int y2 = y1 + h;
108 
109 #if 0
110  glEnable(GL_BLEND);
111  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
112  glColor4f(0.5f, 0.5f, 0.5f, 0.8f);
113  glRectf(x1, y1, x2, y2);
114  glDisable(GL_BLEND);
115 
116  glColor3f(0.8f, 0.8f, 0.8f);
117 #endif
118 
119  string info = string("Cycles Renderer ") + CYCLES_VERSION_STRING;
120 
121  window_display_text(x1 + 20, y2 - 20, info.c_str());
122  window_display_text(x1 + 20, y2 - 40, "(C) 2011-2016 Blender Foundation");
123  window_display_text(x1 + 20, y2 - 80, "Controls:");
124  window_display_text(x1 + 20, y2 - 100, "h: Info/Help");
125  window_display_text(x1 + 20, y2 - 120, "r: Reset");
126  window_display_text(x1 + 20, y2 - 140, "p: Pause");
127  window_display_text(x1 + 20, y2 - 160, "esc: Cancel");
128  window_display_text(x1 + 20, y2 - 180, "q: Quit program");
129 
130  window_display_text(x1 + 20, y2 - 210, "i: Interactive mode");
131  window_display_text(x1 + 20, y2 - 230, "Left mouse: Move camera");
132  window_display_text(x1 + 20, y2 - 250, "Right mouse: Rotate camera");
133  window_display_text(x1 + 20, y2 - 270, "W/A/S/D: Move camera");
134  window_display_text(x1 + 20, y2 - 290, "0/1/2/3: Set max bounces");
135 
136 #if 0
137  glColor3f(1.0f, 1.0f, 1.0f);
138 #endif
139 }
140 
141 static void window_display()
142 {
143  if (V.first_display) {
144  if (V.initf) {
145  V.initf();
146  }
147  if (V.exitf) {
148  atexit(V.exitf);
149  }
150 
151  V.first_display = false;
152  }
153 
155 
156  glViewport(0, 0, V.width, V.height);
157 
158  glMatrixMode(GL_PROJECTION);
159  glLoadIdentity();
160 
161  glMatrixMode(GL_MODELVIEW);
162  glLoadIdentity();
163 
164  glClearColor(0.05f, 0.05f, 0.05f, 0.0f);
165  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
166 
167  glMatrixMode(GL_PROJECTION);
168  glLoadIdentity();
169  glOrtho(0, V.width, 0, V.height, -1, 1);
170 
171  glMatrixMode(GL_MODELVIEW);
172  glLoadIdentity();
173 
174  glRasterPos3f(0, 0, 0);
175 
176  if (V.display)
177  V.display();
178 
179  SDL_GL_SwapWindow(V.window);
181 }
182 
183 static void window_reshape(int width, int height)
184 {
185  if (V.width != width || V.height != height) {
186  if (V.resize) {
187  V.resize(width, height);
188  }
189  }
190 
191  V.width = width;
192  V.height = height;
193 }
194 
195 static bool window_keyboard(unsigned char key)
196 {
197  if (V.keyboard)
198  V.keyboard(key);
199 
200  if (key == 'q') {
201  if (V.exitf)
202  V.exitf();
203  return true;
204  }
205 
206  return false;
207 }
208 
209 static void window_mouse(int button, int state, int x, int y)
210 {
211  if (button == SDL_BUTTON_LEFT) {
212  if (state == SDL_MOUSEBUTTONDOWN) {
213  V.mouseX = x;
214  V.mouseY = y;
215  V.mouseBut0 = 1;
216  }
217  else if (state == SDL_MOUSEBUTTONUP) {
218  V.mouseBut0 = 0;
219  }
220  }
221  else if (button == SDL_BUTTON_RIGHT) {
222  if (state == SDL_MOUSEBUTTONDOWN) {
223  V.mouseX = x;
224  V.mouseY = y;
225  V.mouseBut2 = 1;
226  }
227  else if (state == SDL_MOUSEBUTTONUP) {
228  V.mouseBut2 = 0;
229  }
230  }
231 }
232 
233 static void window_motion(int x, int y)
234 {
235  const int but = V.mouseBut0 ? 0 : 2;
236  const int distX = x - V.mouseX;
237  const int distY = y - V.mouseY;
238 
239  if (V.motion)
240  V.motion(distX, distY, but);
241 
242  V.mouseX = x;
243  V.mouseY = y;
244 }
245 
247 {
248  V.gl_context_mutex.lock();
249  SDL_GL_MakeCurrent(V.window, V.gl_context);
250  return true;
251 }
252 
254 {
255  SDL_GL_MakeCurrent(V.window, nullptr);
256  V.gl_context_mutex.unlock();
257 }
258 
259 void window_main_loop(const char *title,
260  int width,
261  int height,
263  WindowExitFunc exitf,
264  WindowResizeFunc resize,
265  WindowDisplayFunc display,
266  WindowKeyboardFunc keyboard,
267  WindowMotionFunc motion)
268 {
269  V.width = width;
270  V.height = height;
271  V.first_display = true;
272  V.redraw = false;
273  V.initf = initf;
274  V.exitf = exitf;
275  V.resize = resize;
276  V.display = display;
277  V.keyboard = keyboard;
278  V.motion = motion;
279 
280  SDL_Init(SDL_INIT_VIDEO);
281  SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
282  SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
283  V.window = SDL_CreateWindow(title,
284  SDL_WINDOWPOS_UNDEFINED,
285  SDL_WINDOWPOS_UNDEFINED,
286  width,
287  height,
288  SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
289  if (V.window == nullptr) {
290  fprintf(stderr, "Failed to create window: %s\n", SDL_GetError());
291  return;
292  }
293 
294  SDL_RaiseWindow(V.window);
295 
296  V.gl_context = SDL_GL_CreateContext(V.window);
297  glewInit();
298  SDL_GL_MakeCurrent(V.window, nullptr);
299 
301  window_display();
302 
303  while (true) {
304  bool quit = false;
305  SDL_Event event;
306  while (!quit && SDL_PollEvent(&event)) {
307  if (event.type == SDL_TEXTINPUT) {
308  quit = window_keyboard(event.text.text[0]);
309  }
310  else if (event.type == SDL_MOUSEMOTION) {
311  window_motion(event.motion.x, event.motion.y);
312  }
313  else if (event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP) {
314  window_mouse(event.button.button, event.button.state, event.button.x, event.button.y);
315  }
316  else if (event.type == SDL_WINDOWEVENT) {
317  if (event.window.event == SDL_WINDOWEVENT_RESIZED ||
318  event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
319  window_reshape(event.window.data1, event.window.data2);
320  }
321  }
322  else if (event.type == SDL_QUIT) {
323  if (V.exitf) {
324  V.exitf();
325  }
326  quit = true;
327  }
328  }
329 
330  if (quit) {
331  break;
332  }
333 
334  if (V.redraw) {
335  V.redraw = false;
336  window_display();
337  }
338 
339  SDL_WaitEventTimeout(NULL, 100);
340  }
341 
342  SDL_GL_DeleteContext(V.gl_context);
343  SDL_DestroyWindow(V.window);
344  SDL_Quit();
345 }
346 
348 {
349  V.redraw = true;
350 }
351 
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
#define glEnable
_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 y
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_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
#define glDisable
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
#define glRasterPos3f
#define glColor3f
Definition: gl-deprecated.h:40
#define glColor4f
Definition: gl-deprecated.h:72
#define glOrtho
#define glMatrixMode
#define glBitmap
Definition: gl-deprecated.h:20
#define glRectf
#define glLoadIdentity
const int state
static int initf
static unsigned c
Definition: RandGen.cpp:83
unsigned char uint8_t
Definition: stdint.h:78
WindowKeyboardFunc keyboard
Definition: window.cpp:26
WindowResizeFunc resize
Definition: window.cpp:24
int mouseBut2
Definition: window.cpp:33
WindowMotionFunc motion
Definition: window.cpp:27
WindowDisplayFunc display
Definition: window.cpp:25
WindowExitFunc exitf
Definition: window.cpp:23
SDL_GLContext gl_context
Definition: window.cpp:38
thread_mutex gl_context_mutex
Definition: window.cpp:39
int mouseY
Definition: window.cpp:32
WindowInitFunc initf
Definition: window.cpp:22
bool redraw
Definition: window.cpp:30
int mouseBut0
Definition: window.cpp:33
int mouseX
Definition: window.cpp:32
bool first_display
Definition: window.cpp:29
SDL_Window * window
Definition: window.cpp:37
int height
Definition: window.cpp:35
int width
Definition: window.cpp:35
CCL_NAMESPACE_BEGIN typedef std::mutex thread_mutex
Definition: thread.h:27
#define CYCLES_VERSION_STRING
Definition: version.h:17
void window_main_loop(const char *title, int width, int height, WindowInitFunc initf, WindowExitFunc exitf, WindowResizeFunc resize, WindowDisplayFunc display, WindowKeyboardFunc keyboard, WindowMotionFunc motion)
Definition: window.cpp:259
void window_opengl_context_disable()
Definition: window.cpp:253
static void window_reshape(int width, int height)
Definition: window.cpp:183
bool window_opengl_context_enable()
Definition: window.cpp:246
void window_display_info(const char *info)
Definition: window.cpp:75
static void window_display()
Definition: window.cpp:141
static void window_mouse(int button, int state, int x, int y)
Definition: window.cpp:209
static void window_display_text(int x, int y, const char *text)
Definition: window.cpp:44
CCL_NAMESPACE_BEGIN struct Window V
void window_redraw()
Definition: window.cpp:347
static bool window_keyboard(unsigned char key)
Definition: window.cpp:195
void window_display_help()
Definition: window.cpp:96
static void window_motion(int x, int y)
Definition: window.cpp:233
void(* WindowKeyboardFunc)(unsigned char key)
Definition: window.h:15
void(* WindowExitFunc)()
Definition: window.h:12
CCL_NAMESPACE_BEGIN typedef void(* WindowInitFunc)()
Definition: window.h:11
void(* WindowDisplayFunc)()
Definition: window.h:14
void(* WindowMotionFunc)(int x, int y, int button)
Definition: window.h:16
void(* WindowResizeFunc)(int width, int height)
Definition: window.h:13