Blender  V2.93
GHOST_Test.cpp
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) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
28 #include <iostream>
29 #include <math.h>
30 #include <string>
31 
32 #if defined(WIN32) || defined(__APPLE__)
33 # ifdef WIN32
34 # include <atlbase.h>
35 # include <windows.h>
36 
37 # include <GL/gl.h>
38 # else // WIN32 \
39  // __APPLE__ is defined
40 # include <AGL/gl.h>
41 # endif // WIN32
42 #else // defined(WIN32) || defined(__APPLE__)
43 # include <GL/gl.h>
44 #endif // defined(WIN32) || defined(__APPLE__)
45 
46 #include "GHOST_Rect.h"
47 
48 #include "GHOST_IEvent.h"
49 #include "GHOST_IEventConsumer.h"
50 #include "GHOST_ISystem.h"
51 
52 #define LEFT_EYE 0
53 #define RIGHT_EYE 1
54 
55 static bool nVidiaWindows; // very dirty but hey, it's for testing only
56 
58 
59 static class Application *fApp;
60 static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
61 static GLfloat fAngle = 0.0;
62 static GHOST_ISystem *fSystem = 0;
63 
64 void StereoProjection(float left,
65  float right,
66  float bottom,
67  float top,
68  float nearplane,
69  float farplane,
70  float zero_plane,
71  float dist,
72  float eye);
73 
75 {
76  std::cout << "timer1, time=" << (int)time << "\n";
77 }
78 
79 static void gearGL(
80  GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
81 {
82  GLint i;
83  GLfloat r0, r1, r2;
84  GLfloat angle, da;
85  GLfloat u, v, len;
86 
87  r0 = inner_radius;
88  r1 = outer_radius - tooth_depth / 2.0;
89  r2 = outer_radius + tooth_depth / 2.0;
90 
91  const double pi = 3.14159264;
92  da = 2.0 * pi / teeth / 4.0;
93 
94  glShadeModel(GL_FLAT);
95  glNormal3f(0.0, 0.0, 1.0);
96 
97  /* draw front face */
98  glBegin(GL_QUAD_STRIP);
99  for (i = 0; i <= teeth; i++) {
100  angle = i * 2.0 * pi / teeth;
101  glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
102  glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
103  glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
104  glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
105  }
106  glEnd();
107 
108  /* draw front sides of teeth */
109  glBegin(GL_QUADS);
110  da = 2.0 * pi / teeth / 4.0;
111  for (i = 0; i < teeth; i++) {
112  angle = i * 2.0 * pi / teeth;
113  glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
114  glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
115  glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
116  glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
117  }
118  glEnd();
119 
120  glNormal3f(0.0, 0.0, -1.0);
121 
122  /* draw back face */
123  glBegin(GL_QUAD_STRIP);
124  for (i = 0; i <= teeth; i++) {
125  angle = i * 2.0 * pi / teeth;
126  glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
127  glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
128  glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
129  glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
130  }
131  glEnd();
132 
133  /* draw back sides of teeth */
134  glBegin(GL_QUADS);
135  da = 2.0 * pi / teeth / 4.0;
136  for (i = 0; i < teeth; i++) {
137  angle = i * 2.0 * pi / teeth;
138  glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
139  glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
140  glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
141  glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
142  }
143  glEnd();
144 
145  /* draw outward faces of teeth */
146  glBegin(GL_QUAD_STRIP);
147  for (i = 0; i < teeth; i++) {
148  angle = i * 2.0 * pi / teeth;
149  glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
150  glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
151  u = r2 * cos(angle + da) - r1 * cos(angle);
152  v = r2 * sin(angle + da) - r1 * sin(angle);
153  len = sqrt(u * u + v * v);
154  u /= len;
155  v /= len;
156  glNormal3f(v, -u, 0.0);
157  glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
158  glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
159  glNormal3f(cos(angle), sin(angle), 0.0);
160  glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
161  glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
162  u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
163  v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
164  glNormal3f(v, -u, 0.0);
165  glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
166  glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
167  glNormal3f(cos(angle), sin(angle), 0.0);
168  }
169  glVertex3f(r1 * cos(0.0), r1 * sin(0.0), width * 0.5);
170  glVertex3f(r1 * cos(0.0), r1 * sin(0.0), -width * 0.5);
171  glEnd();
172 
173  glShadeModel(GL_SMOOTH);
174 
175  /* draw inside radius cylinder */
176  glBegin(GL_QUAD_STRIP);
177  for (i = 0; i <= teeth; i++) {
178  angle = i * 2.0 * pi / teeth;
179  glNormal3f(-cos(angle), -sin(angle), 0.0);
180  glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
181  glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
182  }
183  glEnd();
184 }
185 
186 static void drawGearGL(int id)
187 {
188  static GLfloat pos[4] = {5.0f, 5.0f, 10.0f, 1.0f};
189  static GLfloat ared[4] = {0.8f, 0.1f, 0.0f, 1.0f};
190  static GLfloat agreen[4] = {0.0f, 0.8f, 0.2f, 1.0f};
191  static GLfloat ablue[4] = {0.2f, 0.2f, 1.0f, 1.0f};
192 
193  glLightfv(GL_LIGHT0, GL_POSITION, pos);
194  glEnable(GL_CULL_FACE);
195  glEnable(GL_LIGHTING);
196  glEnable(GL_LIGHT0);
197  glEnable(GL_DEPTH_TEST);
198 
199  switch (id) {
200  case 1:
201  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ared);
202  gearGL(1.0f, 4.0f, 1.0f, 20, 0.7f);
203  break;
204  case 2:
205  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, agreen);
206  gearGL(0.5f, 2.0f, 2.0f, 10, 0.7f);
207  break;
208  case 3:
209  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ablue);
210  gearGL(1.3f, 2.0f, 0.5f, 10, 0.7f);
211  break;
212  default:
213  break;
214  }
215  glEnable(GL_NORMALIZE);
216 }
217 
219 {
220  glRotatef(view_rotx, 1.0, 0.0, 0.0);
221  glRotatef(view_roty, 0.0, 1.0, 0.0);
222  glRotatef(view_rotz, 0.0, 0.0, 1.0);
223 }
224 
226 {
227  glPushMatrix();
228  glTranslatef(-3.0, -2.0, 0.0);
229  glRotatef(fAngle, 0.0, 0.0, 1.0);
230  drawGearGL(1);
231  glPopMatrix();
232 
233  glPushMatrix();
234  glTranslatef(3.1f, -2.0f, 0.0f);
235  glRotatef(-2.0 * fAngle - 9.0, 0.0, 0.0, 1.0);
236  drawGearGL(2);
237  glPopMatrix();
238 
239  glPushMatrix();
240  glTranslatef(-3.1f, 2.2f, -1.8f);
241  glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
242  glRotatef(2.0 * fAngle - 2.0, 0.0, 0.0, 1.0);
243  drawGearGL(3);
244  glPopMatrix();
245 }
246 
247 static void View(GHOST_IWindow *window, bool stereo, int eye = 0)
248 {
249  window->activateDrawingContext();
250  GHOST_Rect bnds;
251  int noOfScanlines = 0, lowerScanline = 0;
252  /* hard coded for testing purposes, display device dependent */
253  int verticalBlankingInterval = 32;
254  float left, right, bottom, top;
255  float nearplane, farplane, zeroPlane, distance;
256  float eyeSeparation = 0.62f;
257  window->getClientBounds(bnds);
258 
259  // viewport
260  if (stereo) {
261  if (nVidiaWindows) {
262  // handled by nVidia driver so act as normal (explicitly put here since
263  // it -is- stereo)
264  glViewport(0, 0, bnds.getWidth(), bnds.getHeight());
265  }
266  else { // generic cross platform above-below stereo
267  noOfScanlines = (bnds.getHeight() - verticalBlankingInterval) / 2;
268  switch (eye) {
269  case LEFT_EYE:
270  // upper half of window
271  lowerScanline = bnds.getHeight() - noOfScanlines;
272  break;
273  case RIGHT_EYE:
274  // lower half of window
275  lowerScanline = 0;
276  break;
277  }
278  }
279  }
280  else {
281  noOfScanlines = bnds.getHeight();
282  lowerScanline = 0;
283  }
284 
285  glViewport(0, lowerScanline, bnds.getWidth(), noOfScanlines);
286 
287  // projection
288  left = -6.0;
289  right = 6.0;
290  bottom = -4.8f;
291  top = 4.8f;
292  nearplane = 5.0;
293  farplane = 60.0;
294 
295  if (stereo) {
296  zeroPlane = 0.0;
297  distance = 14.5;
298  switch (eye) {
299  case LEFT_EYE:
301  right,
302  bottom,
303  top,
304  nearplane,
305  farplane,
306  zeroPlane,
307  distance,
308  -eyeSeparation / 2.0);
309  break;
310  case RIGHT_EYE:
312  right,
313  bottom,
314  top,
315  nearplane,
316  farplane,
317  zeroPlane,
318  distance,
319  eyeSeparation / 2.0);
320  break;
321  }
322  }
323  else {
324  // left = -w;
325  // right = w;
326  // bottom = -h;
327  // top = h;
328  glMatrixMode(GL_PROJECTION);
329  glLoadIdentity();
330  glFrustum(left, right, bottom, top, 5.0, 60.0);
331  glMatrixMode(GL_MODELVIEW);
332  glLoadIdentity();
333  glTranslatef(0.0, 0.0, -40.0);
334  }
335 
336  glClearColor(.2f, 0.0f, 0.0f, 0.0f);
337 }
338 
340  float right,
341  float bottom,
342  float top,
343  float nearplane,
344  float farplane,
345  float zero_plane,
346  float dist,
347  float eye)
348 /* Perform the perspective projection for one eye's subfield.
349  * The projection is in the direction of the negative z axis.
350  *
351  * -6.0, 6.0, -4.8, 4.8,
352  * left, right, bottom, top = the coordinate range, in the plane of zero
353  * parallax setting, which will be displayed on the screen. The
354  * ratio between (right-left) and (top-bottom) should equal the aspect
355  * ratio of the display.
356  *
357  * 6.0, -6.0,
358  * near, far = the z-coordinate values of the clipping planes.
359  *
360  * 0.0,
361  * zero_plane = the z-coordinate of the plane of zero parallax setting.
362  *
363  * 14.5,
364  * dist = the distance from the center of projection to the plane
365  * of zero parallax.
366  *
367  * -0.31
368  * eye = half the eye separation; positive for the right eye subfield,
369  * negative for the left eye subfield.
370  */
371 {
372  float xmid, ymid, clip_near, clip_far, topw, bottomw, leftw, rightw, dx, dy, n_over_d;
373 
374  dx = right - left;
375  dy = top - bottom;
376 
377  xmid = (right + left) / 2.0;
378  ymid = (top + bottom) / 2.0;
379 
380  clip_near = dist + zero_plane - nearplane;
381  clip_far = dist + zero_plane - farplane;
382 
383  n_over_d = clip_near / dist;
384 
385  topw = n_over_d * dy / 2.0;
386  bottomw = -topw;
387  rightw = n_over_d * (dx / 2.0 - eye);
388  leftw = n_over_d * (-dx / 2.0 - eye);
389 
390  /* Need to be in projection mode for this. */
391  glLoadIdentity();
392  glFrustum(leftw, rightw, bottomw, topw, clip_near, clip_far);
393 
394  glTranslatef(-xmid - eye, -ymid, -zero_plane - dist);
395  return;
396 } /* stereoproj */
397 
399  public:
400  Application(GHOST_ISystem *system);
401  ~Application(void);
402  virtual bool processEvent(GHOST_IEvent *event);
403 
411 
412  bool stereo;
413 };
414 
416  : m_system(system),
417  m_mainWindow(0),
418  m_secondaryWindow(0),
419  m_fullScreenWindow(0),
420  m_gearsTimer(0),
421  m_testTimer(0),
423  m_exitRequested(false),
424  stereo(false)
425 {
426  GHOST_GLSettings glSettings = {0};
427  fApp = this;
428 
429  // Create the main window
430  m_mainWindow = system->createWindow("gears - main window",
431  10,
432  64,
433  320,
434  200,
437  glSettings);
438 
439  if (!m_mainWindow) {
440  std::cout << "could not create main window\n";
441  exit(-1);
442  }
443 
444  // Create a secondary window
445  m_secondaryWindow = system->createWindow("gears - secondary window",
446  340,
447  64,
448  320,
449  200,
452  glSettings);
453  if (!m_secondaryWindow) {
454  std::cout << "could not create secondary window\n";
455  exit(-1);
456  }
457 
458  // Install a timer to have the gears running
459  m_gearsTimer = system->installTimer(0 /*delay*/, 20 /*interval*/, gearsTimerProc, m_mainWindow);
460 }
461 
463 {
464  // Dispose windows
467  }
470  }
471 }
472 
474 {
475  GHOST_IWindow *window = event->getWindow();
476  bool handled = true;
477 
478  switch (event->getType()) {
479 #if 0
480  case GHOST_kEventUnknown:
481  break;
482  case GHOST_kEventCursorButton:
483  std::cout << "GHOST_kEventCursorButton";
484  break;
486  std::cout << "GHOST_kEventCursorMove";
487  break;
488 #endif
489  case GHOST_kEventWheel: {
490  GHOST_TEventWheelData *wheelData = (GHOST_TEventWheelData *)event->getData();
491  if (wheelData->z > 0) {
492  view_rotz += 5.f;
493  }
494  else {
495  view_rotz -= 5.f;
496  }
497  } break;
498 
499  case GHOST_kEventKeyUp:
500  break;
501 
502  case GHOST_kEventKeyDown: {
503  GHOST_TEventKeyData *keyData = (GHOST_TEventKeyData *)event->getData();
504  switch (keyData->key) {
505  case GHOST_kKeyC: {
506  int cursor = m_cursor;
507  cursor++;
508  if (cursor >= GHOST_kStandardCursorNumCursors) {
510  }
512  window->setCursorShape(m_cursor);
513  } break;
514 
515  case GHOST_kKeyE: {
516  int x = 200, y = 200;
518  break;
519  }
520 
521  case GHOST_kKeyF:
522  if (!m_system->getFullScreen()) {
523  // Begin fullscreen mode
524  GHOST_DisplaySetting setting;
525 
526  setting.bpp = 16;
527  setting.frequency = 50;
528  setting.xPixels = 640;
529  setting.yPixels = 480;
530  m_system->beginFullScreen(setting, &m_fullScreenWindow, false /* stereo flag */);
531  }
532  else {
534  m_fullScreenWindow = 0;
535  }
536  break;
537 
538  case GHOST_kKeyH:
539  window->setCursorVisibility(!window->getCursorVisibility());
540  break;
541 
542  case GHOST_kKeyM: {
543  bool down = false;
545  if (down) {
546  std::cout << "left shift down\n";
547  }
549  if (down) {
550  std::cout << "right shift down\n";
551  }
553  if (down) {
554  std::cout << "left Alt down\n";
555  }
557  if (down) {
558  std::cout << "right Alt down\n";
559  }
561  if (down) {
562  std::cout << "left control down\n";
563  }
565  if (down) {
566  std::cout << "right control down\n";
567  }
568  } break;
569 
570  case GHOST_kKeyQ:
571  if (m_system->getFullScreen()) {
573  m_fullScreenWindow = 0;
574  }
575  m_exitRequested = true;
576  break;
577 
578  case GHOST_kKeyS: // toggle mono and stereo
579  if (stereo)
580  stereo = false;
581  else
582  stereo = true;
583  break;
584 
585  case GHOST_kKeyT:
586  if (!m_testTimer) {
588  }
589 
590  else {
592  m_testTimer = 0;
593  }
594 
595  break;
596 
597  case GHOST_kKeyW:
598  if (m_mainWindow) {
599  std::string title = m_mainWindow->getTitle();
600  title += "-";
601  m_mainWindow->setTitle(title);
602  }
603  break;
604 
605  default:
606  break;
607  }
608  } break;
609 
611  GHOST_IWindow *window2 = event->getWindow();
612  if (window2 == m_mainWindow) {
613  m_exitRequested = true;
614  }
615  else {
616  m_system->disposeWindow(window2);
617  }
618  } break;
619 
621  handled = false;
622  break;
623 
625  handled = false;
626  break;
627 
629  GHOST_IWindow *window2 = event->getWindow();
630  if (!m_system->validWindow(window2))
631  break;
632 
633  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
634 
635  if (stereo) {
636  View(window2, stereo, LEFT_EYE);
637  glPushMatrix();
638  RenderCamera();
639  RenderScene();
640  glPopMatrix();
641 
642  View(window2, stereo, RIGHT_EYE);
643  glPushMatrix();
644  RenderCamera();
645  RenderScene();
646  glPopMatrix();
647  }
648  else {
649  View(window2, stereo);
650  glPushMatrix();
651  RenderCamera();
652  RenderScene();
653  glPopMatrix();
654  }
655  window2->swapBuffers();
656  } break;
657 
658  default:
659  handled = false;
660  break;
661  }
662  return handled;
663 }
664 
665 int main(int /*argc*/, char ** /*argv*/)
666 {
667  nVidiaWindows = false;
668  // nVidiaWindows = true;
669 
670 #ifdef WIN32
671  /* Set a couple of settings in the registry for the nVidia detonator driver.
672  * So this is very specific...
673  */
674  if (nVidiaWindows) {
675  LONG lresult;
676  HKEY hkey = 0;
677  DWORD dwd = 0;
678  // unsigned char buffer[128];
679 
680  CRegKey regkey;
681  // DWORD keyValue;
682  // lresult = regkey.Open(
683  // HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable");
684  lresult = regkey.Open(HKEY_LOCAL_MACHINE,
685  "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable",
686  KEY_ALL_ACCESS);
687 
688  if (lresult == ERROR_SUCCESS)
689  printf("Successfully opened key\n");
690 # if 0
691  lresult = regkey.QueryValue(&keyValue, "StereoEnable");
692  if (lresult == ERROR_SUCCESS)
693  printf("Successfully queried key\n");
694 # endif
695  lresult = regkey.SetValue(
696  HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable", "1");
697  if (lresult == ERROR_SUCCESS)
698  printf("Successfully set value for key\n");
699  regkey.Close();
700  if (lresult == ERROR_SUCCESS)
701  printf("Successfully closed key\n");
702  // regkey.Write("2");
703  }
704 #endif // WIN32
705 
706  // Create the system
709 
710  if (fSystem) {
711  // Create an application object
712  Application app(fSystem);
713 
714  // Add the application as event consumer
715  fSystem->addEventConsumer(&app);
716 
717  // Enter main loop
718  while (!app.m_exitRequested) {
719  // printf("main: loop\n");
720  fSystem->processEvents(true);
722  }
723 
724  // Remove so ghost doesn't do a double free
726  }
727 
728  // Dispose the system
730 
731  return 0;
732 }
733 
735 {
736  fAngle += 2.0;
737  view_roty += 1.0;
738  GHOST_IWindow *window = (GHOST_IWindow *)task->getUserData();
739  if (fApp->m_fullScreenWindow) {
740  // Running full screen
742  }
743  else {
744  if (fSystem->validWindow(window)) {
745  window->invalidate();
746  }
747  }
748 }
sqrt(x)+1/max(0
static GLfloat fAngle
Definition: GHOST_Test.cpp:61
static GHOST_ISystem * fSystem
Definition: GHOST_Test.cpp:62
int main(int, char **)
Definition: GHOST_Test.cpp:665
void RenderScene()
Definition: GHOST_Test.cpp:225
static void gearsTimerProc(GHOST_ITimerTask *task, GHOST_TUns64 time)
Definition: GHOST_Test.cpp:734
static GLfloat view_roty
Definition: GHOST_Test.cpp:60
static GLfloat view_rotz
Definition: GHOST_Test.cpp:60
void StereoProjection(float left, float right, float bottom, float top, float nearplane, float farplane, float zero_plane, float dist, float eye)
Definition: GHOST_Test.cpp:339
static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
Definition: GHOST_Test.cpp:79
#define RIGHT_EYE
Definition: GHOST_Test.cpp:53
void RenderCamera()
Definition: GHOST_Test.cpp:218
static bool nVidiaWindows
Definition: GHOST_Test.cpp:55
static void testTimerProc(GHOST_ITimerTask *, GHOST_TUns64 time)
Definition: GHOST_Test.cpp:74
#define LEFT_EYE
Definition: GHOST_Test.cpp:52
static GLfloat view_rotx
Definition: GHOST_Test.cpp:60
static void drawGearGL(int id)
Definition: GHOST_Test.cpp:186
static void View(GHOST_IWindow *window, bool stereo, int eye=0)
Definition: GHOST_Test.cpp:247
static class Application * fApp
Definition: GHOST_Test.cpp:59
@ GHOST_kWindowStateNormal
Definition: GHOST_Types.h:145
GHOST_TStandardCursor
Definition: GHOST_Types.h:222
@ GHOST_kStandardCursorFirstCursor
Definition: GHOST_Types.h:223
@ GHOST_kStandardCursorNumCursors
Definition: GHOST_Types.h:264
unsigned long long GHOST_TUns64
Definition: GHOST_Types.h:86
@ GHOST_kEventWindowClose
Definition: GHOST_Types.h:197
@ GHOST_kEventWheel
Mouse button event.
Definition: GHOST_Types.h:183
@ GHOST_kEventCursorMove
Definition: GHOST_Types.h:180
@ GHOST_kEventWindowActivate
Definition: GHOST_Types.h:198
@ GHOST_kEventWindowUpdate
Definition: GHOST_Types.h:200
@ GHOST_kEventWindowDeactivate
Definition: GHOST_Types.h:199
@ GHOST_kEventKeyDown
Trackpad event.
Definition: GHOST_Types.h:191
@ GHOST_kEventUnknown
Definition: GHOST_Types.h:178
@ GHOST_kEventKeyUp
Definition: GHOST_Types.h:192
@ GHOST_kKeyT
Definition: GHOST_Types.h:319
@ GHOST_kKeyW
Definition: GHOST_Types.h:322
@ GHOST_kKeyC
Definition: GHOST_Types.h:302
@ GHOST_kKeyQ
Definition: GHOST_Types.h:316
@ GHOST_kKeyF
Definition: GHOST_Types.h:305
@ GHOST_kKeyM
Definition: GHOST_Types.h:312
@ GHOST_kKeyS
Definition: GHOST_Types.h:318
@ GHOST_kKeyH
Definition: GHOST_Types.h:307
@ GHOST_kKeyE
Definition: GHOST_Types.h:304
@ GHOST_kDrawingContextTypeOpenGL
Definition: GHOST_Types.h:158
@ GHOST_kModifierKeyRightControl
Definition: GHOST_Types.h:139
@ GHOST_kModifierKeyLeftControl
Definition: GHOST_Types.h:138
@ GHOST_kModifierKeyRightAlt
Definition: GHOST_Types.h:137
@ GHOST_kModifierKeyRightShift
Definition: GHOST_Types.h:135
@ GHOST_kModifierKeyLeftAlt
Definition: GHOST_Types.h:136
@ GHOST_kModifierKeyLeftShift
Definition: GHOST_Types.h:134
_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 glEnable
_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 right
_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 top
_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 bottom
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
GHOST_IWindow * m_secondaryWindow
Definition: GHOST_Test.cpp:406
Application(GHOST_ISystem *system)
Definition: GHOST_Test.cpp:415
~Application(void)
Definition: GHOST_Test.cpp:462
GHOST_TStandardCursor m_cursor
Definition: GHOST_Test.cpp:409
virtual bool processEvent(GHOST_IEvent *event)
Definition: GHOST_Test.cpp:473
GHOST_ITimerTask * m_testTimer
Definition: GHOST_Test.cpp:408
GHOST_IWindow * m_fullScreenWindow
Definition: GHOST_Test.cpp:407
GHOST_IWindow * m_mainWindow
Definition: GHOST_Test.cpp:405
bool m_exitRequested
Definition: GHOST_Test.cpp:410
GHOST_ITimerTask * m_gearsTimer
Definition: GHOST_Test.cpp:408
GHOST_ISystem * m_system
Definition: GHOST_Test.cpp:404
virtual GHOST_TEventDataPtr getData()=0
virtual GHOST_TEventType getType()=0
static GHOST_ISystem * getSystem()
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual, const bool alphaBackground=0)=0
virtual bool validWindow(GHOST_IWindow *window)=0
virtual GHOST_IWindow * createWindow(const char *title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parentWindow=NULL)=0
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer)=0
virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask)=0
static GHOST_TSuccess disposeSystem()
virtual bool getFullScreen(void)=0
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)=0
static GHOST_TSuccess createSystem()
virtual void dispatchEvents()=0
virtual GHOST_ITimerTask * installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=NULL)=0
virtual GHOST_TSuccess endFullScreen(void)=0
virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const =0
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window)=0
virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer)=0
virtual bool processEvents(bool waitForEvent)=0
virtual void setTitle(const char *title)=0
virtual void getClientBounds(GHOST_Rect &bounds) const =0
virtual GHOST_TSuccess activateDrawingContext()=0
virtual std::string getTitle() const =0
virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape)=0
virtual GHOST_TSuccess setCursorVisibility(bool visible)=0
virtual bool getCursorVisibility() const =0
virtual GHOST_TSuccess invalidate()=0
virtual GHOST_TSuccess swapBuffers()=0
virtual GHOST_TInt32 getWidth() const
Definition: GHOST_Rect.h:182
virtual GHOST_TInt32 getHeight() const
Definition: GHOST_Rect.h:187
double time
#define glBegin
Definition: gl-deprecated.h:34
#define glMaterialfv
#define glTranslatef
#define glPopMatrix
#define glFrustum
#define glVertex3f
#define glMatrixMode
#define glRotatef
#define glPushMatrix
#define glShadeModel
#define glNormal3f
#define glEnd
#define glLightfv
#define glLoadIdentity
uint pos
static int left
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:311
struct blender::compositor::@172::@174 task
GHOST_TUns32 bpp
Definition: GHOST_Types.h:584
GHOST_TUns32 xPixels
Definition: GHOST_Types.h:580
GHOST_TUns32 frequency
Definition: GHOST_Types.h:586
GHOST_TUns32 yPixels
Definition: GHOST_Types.h:582
ccl_device_inline float distance(const float2 &a, const float2 &b)
uint len