Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Win32Context.cpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #include <vlWin32/Win32Context.hpp>
33 #include <vlCore/Log.hpp>
34 #include <vlCore/Say.hpp>
35 
36 using namespace vl;
37 using namespace vlWin32;
38 
39 //-----------------------------------------------------------------------------
40 Win32Context::~Win32Context()
41 {
42 }
43 //-----------------------------------------------------------------------------
44 void Win32Context::shareOpenGLResources(HGLRC hGLRC)
45 {
46  if (hwnd() && mHDC && mHGLRC)
47  wglShareLists(hglrc(), hGLRC);
48 }
49 //-----------------------------------------------------------------------------
50 void Win32Context::makeCurrent()
51 {
52  if (mHDC && mHGLRC)
53  wglMakeCurrent(mHDC, mHGLRC);
54 }
55 //-----------------------------------------------------------------------------
56 void Win32Context::update()
57 {
58  if (hwnd())
59  PostMessage(hwnd(), WM_PAINT, 0, 0);
60 }
61 //-----------------------------------------------------------------------------
62 void Win32Context::quitApplication()
63 {
64  PostQuitMessage(0);
65 }
66 //-----------------------------------------------------------------------------
67 void Win32Context::setMouseVisible(bool visible)
68 {
69  mMouseVisible = visible;
70  if (visible)
71  while(ShowCursor(TRUE ) < 0) {}
72  else
73  while(ShowCursor(FALSE) >= 0) {}
74 }
75 //-----------------------------------------------------------------------------
76 void Win32Context::setPosition(int x, int y)
77 {
78  if (hwnd())
79  SetWindowPos(hwnd(), 0, x, y, 0, 0, SWP_NOSIZE );
80 }
81 //-----------------------------------------------------------------------------
82 void Win32Context::setSize(int w, int h)
83 {
84  if (hwnd())
85  {
86  RECT windowRect = { 0, 0, w, h };
87  AdjustWindowRectEx(&windowRect, (DWORD)GetWindowLongPtr(hwnd(), GWL_STYLE), 0, (DWORD)GetWindowLongPtr(hwnd(), GWL_EXSTYLE) );
88  // computes the actual window based on the client dimensions
89  int cx = windowRect.right - windowRect.left;
90  int cy = windowRect.bottom - windowRect.top;
91  SetWindowPos(hwnd(), 0, 0, 0, cx, cy, SWP_NOMOVE );
92  }
93 }
94 //-----------------------------------------------------------------------------
95 void Win32Context::setWindowSize(int w, int h)
96 {
97  // this are set by WM_SIZE event handler
98  // mFramebuffer->setWidth(w);
99  // mFramebuffer->setHeight(h);
100  SetWindowPos(hwnd(), 0, 0, 0, w, h, SWP_NOMOVE);
101 }
102 //-----------------------------------------------------------------------------
103 vl::ivec2 Win32Context::position() const
104 {
105  RECT r = {0,0,0,0};
106  if (hwnd())
107  GetWindowRect(hwnd(), &r);
108  return vl::ivec2(r.left,r.top);
109 }
110 //-----------------------------------------------------------------------------
111 vl::ivec2 Win32Context::windowSize() const
112 {
113  RECT r = {0,0,0,0};
114  if (hwnd())
115  GetWindowRect(hwnd(), &r);
116  return vl::ivec2(r.right - r.left, r.bottom - r.top);
117 }
118 //-----------------------------------------------------------------------------
119 vl::ivec2 Win32Context::size() const
120 {
121  RECT r = {0,0,0,0};
122  if (hwnd())
123  GetClientRect(hwnd(), &r);
124  return vl::ivec2(r.right - r.left, r.bottom - r.top);
125 // return vl::ivec2(width(), height());
126 }
127 //-----------------------------------------------------------------------------
128 void Win32Context::setWindowTitle(const String& title)
129 {
130  if (hwnd())
131  SetWindowText(hwnd(), (wchar_t*)title.ptr());
132 }
133 //-----------------------------------------------------------------------------
134 void Win32Context::show()
135 {
136  if (hwnd())
137  ShowWindow(hwnd(), SW_SHOW);
138 }
139 //-----------------------------------------------------------------------------
140 void Win32Context::hide()
141 {
142  if (hwnd())
143  ShowWindow(hwnd(), SW_HIDE);
144 }
145 //-----------------------------------------------------------------------------
146 void Win32Context::getFocus()
147 {
148  if (hwnd())
149  SetFocus(hwnd());
150 }
151 //-----------------------------------------------------------------------------
152 void Win32Context::setMousePosition(int x, int y)
153 {
154  if (hwnd())
155  {
156  POINT pt = {x, y};
157  ClientToScreen( hwnd(), &pt );
158  SetCursorPos(pt.x, pt.y);
159  }
160 }
161 //-----------------------------------------------------------------------------
162 void Win32Context::swapBuffers()
163 {
164  if(hwnd() && hdc())
165  SwapBuffers(hdc());
166 }
167 //-----------------------------------------------------------------------------
168 bool Win32Context::setFullscreen(bool fullscreen_on)
169 {
170  if (!hwnd())
171  return false;
172 
173  if (fullscreen_on == fullscreen())
174  return true;
175 
176  if (!fullscreen_on)
177  {
178  SetWindowLongPtr(hwnd(), GWL_STYLE, mNormFlags/*swl_style*/);
179 
180  if (!((mNormFlags & WS_MAXIMIZE) || (mNormFlags & WS_MINIMIZE)))
181  {
182  setPosition(mNormPosit.x(),mNormPosit.y());
183  setSize(mNormSize.x(), mNormSize.y());
184  }
185 
186  SetWindowPos(hwnd(), 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE);
187 
188  // restores display settings
189  ChangeDisplaySettings(NULL, 0);
190  }
191  else
192  {
193  DEVMODE devmode;
194  EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&devmode);
195 
196  // devmode.dmPelsWidth = ... leave current width
197  // devmode.dmPelsHeight = ... leave current height
198  // change color depth
199  devmode.dmBitsPerPel = openglContextInfo().bitsPerPixel();
200  devmode.dmFields |= DM_BITSPERPEL;
201 
202  mNormFlags = (unsigned int)GetWindowLongPtr(hwnd(), GWL_STYLE);
203  mNormPosit = position();
204  mNormSize = size();
205 
206  switch( ChangeDisplaySettings(&devmode, CDS_FULLSCREEN) )
207  {
208  case DISP_CHANGE_SUCCESSFUL:
209  {
210  RECT windowRect = { 0, 0, devmode.dmPelsWidth, devmode.dmPelsHeight };
211  /*mStyle = */SetWindowLongPtr(hwnd(), GWL_STYLE, WS_POPUP | WS_VISIBLE );
212  AdjustWindowRectEx(&windowRect, (DWORD)GetWindowLongPtr(hwnd(), GWL_STYLE), 0, (DWORD)GetWindowLongPtr(hwnd(), GWL_EXSTYLE) );
213  SetWindowPos(hwnd(), HWND_TOP, windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_FRAMECHANGED );
214  break;
215  }
216  #if(_WIN32_WINNT >= 0x0501)
217  case DISP_CHANGE_BADDUALVIEW:
218  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_BADDUALVIEW", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
219  return false;
220  #endif
221  case DISP_CHANGE_BADFLAGS:
222  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_BADFLAGS", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
223  return false;
224  case DISP_CHANGE_BADMODE:
225  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_BADMODE", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
226  return false;
227  case DISP_CHANGE_BADPARAM:
228  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_BADPARAM", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
229  return false;
230  case DISP_CHANGE_FAILED:
231  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_FAILED", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
232  return false;
233  case DISP_CHANGE_NOTUPDATED:
234  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_NOTUPDATED", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
235  return false;
236  case DISP_CHANGE_RESTART:
237  MessageBox(NULL, L"Full-screen mode switch failed: DISP_CHANGE_RESTART", L"Win32Context::setFullscreen() error!", MB_OK | MB_ICONEXCLAMATION);
238  return false;
239  default:
240  return false;
241  }
242  }
243 
244  mFullscreen = fullscreen_on;
245  update();
246  return true;
247 }
248 //-----------------------------------------------------------------------------
249 bool Win32Context::initWin32GLContext(HGLRC share_context, const vl::String& title, const vl::OpenGLContextFormat& fmt, int x, int y, int width, int height)
250 {
251  class InOutContract
252  {
253  Win32Context* mContext;
254 
255  public:
256  bool mOK;
257 
258  InOutContract(Win32Context* context): mContext(context), mOK(true)
259  {
260  cleanup();
261  }
262 
263  ~InOutContract()
264  {
265  if (!mOK)
266  cleanup();
267  }
268 
269  void cleanup()
270  {
271  // delete HDC
272  if (mContext->mHDC)
273  {
274  DeleteDC(mContext->mHDC);
275  mContext->mHDC = NULL;
276  }
277 
278  // delete HGLRC
279  if (mContext->mHGLRC)
280  {
281  if ( wglDeleteContext(mContext->mHGLRC) == FALSE )
282  {
283  MessageBox(NULL, L"OpenGL context cleanup failed.\n"
284  L"The handle either doesn't specify a valid context or the context is being used by another thread.",
285  L"Win32Context::init() error!", MB_OK);
286  mOK = false;
287  }
288  mContext->mHGLRC = NULL;
289  }
290  }
291  } contract(this);
292 
293  if (!contract.mOK)
294  return false;
295 
296  framebuffer()->setWidth(width);
297  framebuffer()->setHeight(height);
298 
299  if (!hwnd())
300  {
301  MessageBox(NULL, L"Cannot create OpenGL context: null HWND.", L"Win32Context::init() error!", MB_OK);
302  return contract.mOK = false;
303  }
304 
305  setWindowTitle(title);
306 
307  VL_CHECK(mHDC == NULL);
308  mHDC = ::GetDC(hwnd());
309  if (!mHDC)
310  {
311  MessageBox(NULL, L"Device context acquisition failed.", L"Win32Context::init() error!", MB_OK);
312  return contract.mOK = false;
313  }
314 
315  int pixel_format_index = vlWin32::choosePixelFormat(fmt);
316  if (pixel_format_index == -1)
317  {
318  MessageBox(NULL, L"No suitable pixel fmt found.", L"Win32Context::init() error!", MB_OK);
319  return contract.mOK = false;
320  }
321 
322  if (SetPixelFormat(mHDC, pixel_format_index, NULL) == FALSE)
323  {
324  MessageBox(NULL, L"Pixel fmt setup failed.", L"Win32Context::init() error!", MB_OK);
325  return contract.mOK = false;
326  }
327 
328  // OpenGL rendering context creation
329 
330  if (wglCreateContextAttribsARB && mContextAttribs.size() > 1)
331  {
332  // must be 0-terminated list
333  VL_CHECK(mContextAttribs.back() == 0);
334  // Creates an OpenGL 3.x / 4.x context with the specified attributes.
335  mHGLRC = wglCreateContextAttribsARB(mHDC, 0, &mContextAttribs[0]);
336  }
337  else
338  {
339  // Creates default OpenGL context
340  mHGLRC = wglCreateContext(mHDC);
341  }
342 
343  if (!mHGLRC)
344  {
345  MessageBox(NULL, L"OpenGL rendering context creation failed.", L"Win32Context::init() error!", MB_OK);
346  return contract.mOK = false;
347  }
348 
349  // init GL context and makes it current
350  if( ! initGLContext() )
351  return contract.mOK = false;
352 
353  if (fmt.multisample() && !Has_GL_ARB_multisample)
354  vl::Log::error("WGL_ARB_multisample not supported.\n");
355 
356  dispatchInitEvent();
357 
358  setPosition(x, y);
359 
360  setSize(width, height);
361 
362  if (Has_GL_EXT_swap_control)
363  wglSwapIntervalEXT( fmt.vSync() ? 1 : 0 );
364 
365  if (share_context)
366  shareOpenGLResources(share_context);
367 
368  if (fmt.fullscreen())
369  setFullscreen(true);
370 
371  return contract.mOK = true;
372 }
373 //-----------------------------------------------------------------------------
374 void Win32Context::setContextAttribs(const int* attribs, int size)
375 {
376  mContextAttribs.resize(size);
377  for(int i = 0; i < size; ++i)
378  mContextAttribs[ i ] = attribs[ i ];
379 }
380 //-----------------------------------------------------------------------------
381 namespace vlWin32
382 {
383  extern bool registerClass();
384  extern const wchar_t* gWin32WindowClassName;
385 }
386 //-----------------------------------------------------------------------------
388 {
389  if (!registerClass())
390  return false;
391 
392  // this is true only under Win32
393  // VL_CHECK( sizeof(wchar_t) == sizeof(short int) )
394 
395  HWND hWnd = CreateWindowEx(
396  WS_EX_APPWINDOW | WS_EX_ACCEPTFILES,
398  L"Temp GL Window",
399  WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
400  CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
401  NULL, NULL, GetModuleHandle(NULL), NULL);
402 
403  if (!hWnd)
404  {
405  if (verbose) MessageBox(NULL, L"choosePixelFormat() critical failure: could not create window.", L"Visualization Library error", MB_OK);
406  return -1;
407  }
408 
409  HDC hDC = GetDC(hWnd);
410  if (!hDC)
411  {
412  if (verbose) MessageBox(NULL, L"choosePixelFormat() critical failure: could not create HDC.", L"Visualization Library error", MB_OK);
413  DestroyWindow(hWnd);
414  return -1;
415  }
416 
417  PIXELFORMATDESCRIPTOR pfd;
418  memset(&pfd, 0, sizeof(pfd));
419  pfd.nSize = sizeof(pfd);
420  pfd.nVersion = 1;
421  pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
422  pfd.dwFlags |= fmt.doubleBuffer() ? PFD_DOUBLEBUFFER : 0;
423  pfd.dwFlags |= fmt.stereo() ? PFD_STEREO : 0;
424  pfd.iPixelType = PFD_TYPE_RGBA;
425  pfd.cColorBits = 0;
426  pfd.cRedBits = (BYTE)fmt.rgbaBits().r();
427  pfd.cGreenBits = (BYTE)fmt.rgbaBits().g();
428  pfd.cBlueBits = (BYTE)fmt.rgbaBits().b();
429  pfd.cAlphaBits = (BYTE)fmt.rgbaBits().a();
430  pfd.cAccumRedBits = (BYTE)fmt.accumRGBABits().r();
431  pfd.cAccumGreenBits = (BYTE)fmt.accumRGBABits().g();
432  pfd.cAccumBlueBits = (BYTE)fmt.accumRGBABits().b();
433  pfd.cAccumAlphaBits = (BYTE)fmt.accumRGBABits().a();
434  pfd.cDepthBits = (BYTE)fmt.depthBufferBits();
435  pfd.cStencilBits = (BYTE)fmt.stencilBufferBits();
436  pfd.iLayerType = PFD_MAIN_PLANE;
437 
438  int pixel_format_index = ChoosePixelFormat(hDC, &pfd);
439 
440  if (pixel_format_index == 0)
441  {
442  if (verbose) MessageBox(NULL, L"choosePixelFormat() critical failure: could not choose temporary format.", L"Visualization Library error", MB_OK);
443  DeleteDC(hDC);
444  DestroyWindow(hWnd);
445  return -1;
446  }
447 
448  if (SetPixelFormat(hDC, pixel_format_index, &pfd) == FALSE)
449  {
450  if (verbose) MessageBox(NULL, L"choosePixelFormat() critical failure: could not set temporary format.", L"Visualization Library error", MB_OK);
451  DeleteDC(hDC);
452  DestroyWindow(hWnd);
453  return -1;
454  }
455 
456  // OpenGL Rendering Context
457  HGLRC hGLRC = wglCreateContext(hDC);
458  if (!hGLRC)
459  {
460  if (verbose) MessageBox(NULL, L"choosePixelFormat() critical failure: could not create temporary OpenGL context.", L"Visualization Library error", MB_OK);
461  DeleteDC(hDC);
462  DestroyWindow(hWnd);
463  return -1;
464  }
465 
466  wglMakeCurrent(hDC, hGLRC);
467 
468  if (!initializeOpenGL())
469  {
470  fprintf(stderr, "Error initializing OpenGL!\n");
471  DeleteDC(hDC);
472  DestroyWindow(hWnd);
473  return -1;
474  }
475 
476  // if this is not supported we use the current 'pixel_format_index' returned by ChoosePixelFormat above.
477 
478  int samples = 0;
479  if(Has_WGL_ARB_pixel_format && fmt.multisample())
480  {
481  float fAttributes[] = { 0, 0 };
482  int iAttributes[] =
483  {
484  // multi sampling
485  WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
486  WGL_SAMPLES_ARB, -1, // this is set below
487  // generic
488  WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
489  WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
490  WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
491  // color buffer
492  WGL_RED_BITS_ARB, pfd.cRedBits,
493  WGL_GREEN_BITS_ARB, pfd.cGreenBits,
494  WGL_BLUE_BITS_ARB, pfd.cBlueBits,
495  WGL_ALPHA_BITS_ARB, pfd.cAlphaBits,
496  // accumulation buffer
497  WGL_ACCUM_RED_BITS_ARB, pfd.cAccumRedBits,
498  WGL_ACCUM_GREEN_BITS_ARB, pfd.cAccumGreenBits,
499  WGL_ACCUM_BLUE_BITS_ARB, pfd.cAccumBlueBits,
500  WGL_ACCUM_ALPHA_BITS_ARB, pfd.cAccumAlphaBits,
501  // depth buffer
502  WGL_DEPTH_BITS_ARB, pfd.cDepthBits,
503  WGL_DOUBLE_BUFFER_ARB, fmt.doubleBuffer() ? GL_TRUE : GL_FALSE,
504  // stencil buffer
505  WGL_STENCIL_BITS_ARB, pfd.cStencilBits,
506  // stereo
507  WGL_STEREO_ARB, fmt.stereo() ? GL_TRUE : GL_FALSE,
508  0,0
509  };
510 
511  for(samples = fmt.multisampleSamples(); samples > 1; samples/=2)
512  {
513  // sets WGL_SAMPLES_ARB value
514  iAttributes[3] = samples;
515  pixel_format_index = -1;
516  UINT num_formats = 0;
517  if ( wglChoosePixelFormatARB(hDC,iAttributes,fAttributes,1,&pixel_format_index,&num_formats) && num_formats >= 1 )
518  break;
519  else
520  pixel_format_index = -1;
521  }
522  }
523 
524  // destroy temporary HWND, HDC, HGLRC
525  if ( wglDeleteContext(hGLRC) == FALSE )
526  if (verbose) MessageBox(NULL, L"Error deleting temporary OpenGL context, wglDeleteContext(hGLRC) failed.", L"Visualization Library error", MB_OK);
527  DeleteDC(hDC);
528  DestroyWindow(hWnd);
529 
530  if (verbose)
531  {
532  if(pixel_format_index == -1)
533  vl::Log::error("No suitable pixel format found.\n");
534  else
535  {
536  // check the returned pixel format
537  #if defined(DEBUG) || !defined(NDEBUG)
538  DescribePixelFormat(hDC, pixel_format_index, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
539  vl::Log::debug(" --- vlWin32::choosePixelFormat() ---\n");
540  // This one returns "not supported" even when its supported...
541  // vl::Log::print( vl::Say(" OpenGL = %s\n") << (pfd.dwFlags & PFD_SUPPORT_OPENGL ? "Supported" : "Not supported") );
542  vl::Log::debug( vl::Say("RGBA Bits = %n %n %n %n\n") << pfd.cRedBits << pfd.cGreenBits << pfd.cBlueBits << pfd.cAlphaBits);
543  vl::Log::debug( vl::Say("Depth Bits = %n\n") << pfd.cDepthBits );
544  vl::Log::debug( vl::Say("Stencil Bits = %n \n") << pfd.cStencilBits);
545  vl::Log::debug( vl::Say("Double Buffer = %s\n") << (pfd.dwFlags & PFD_DOUBLEBUFFER ? "Yes" : "No") );
546  vl::Log::debug( vl::Say("Stereo = %s\n") << (pfd.dwFlags & PFD_STEREO ? "Yes" : "No") );
547  vl::Log::debug( vl::Say("Samples = %n\n") << samples );
548  vl::Log::debug("\n");
549  #endif
550  }
551  }
552 
553  return pixel_format_index;
554 }
555 //-----------------------------------------------------------------------------
static void debug(const String &message)
Use this function to provide extra information useful to investigate and solve problems.
Definition: Log.cpp:145
Vector2< int > ivec2
A 2 components vector with int precision.
Definition: Vector2.hpp:278
A simple String formatting class.
Definition: Say.hpp:124
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Definition: String.hpp:62
int multisampleSamples() const
const T_Scalar & r() const
Definition: Vector4.hpp:111
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
Definition: Log.cpp:165
const wchar_t * ptr() const
Returns the 0-terminated utf16 string.
Definition: String.hpp:127
Visualization Library main namespace.
const T_Scalar & g() const
Definition: Vector4.hpp:112
The OpenGLContextFormat class encapsulates the settings of an OpenGL rendering context.
const ivec4 & rgbaBits() const
VLGRAPHICS_EXPORT bool initializeOpenGL()
To test whether OpenGL has been initialized at least once check vl::Is_OpenGL_Initialized.
Definition: OpenGL.cpp:304
const ivec4 & accumRGBABits() const
VLWIN32_EXPORT int choosePixelFormat(const vl::OpenGLContextFormat &fmt, bool verbose=true)
const T_Scalar & b() const
Definition: Vector4.hpp:113
The Win32Context class implements an OpenGLContext using the Win32 API.
#define NULL
Definition: OpenGLDefs.hpp:81
bool registerClass()
Definition: Win32Window.cpp:44
#define VL_CHECK(expr)
Definition: checks.hpp:73
The Win32 bindings namespace.
const wchar_t * gWin32WindowClassName
Definition: Win32Window.cpp:42
const T_Scalar & a() const
Definition: Vector4.hpp:114