NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GLContext.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2011, NVIDIA Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA Corporation nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "gpu/GLContext.hpp"
29 #include "gpu/Buffer.hpp"
30 #include "gui/Window.hpp"
31 #include "gui/Image.hpp"
32 
33 using namespace FW;
34 
35 //------------------------------------------------------------------------
36 
37 #define FW_MIN_TEMP_TEXTURES 16
38 #define FW_MAX_TEMP_TEXTURE_BYTES (64 << 20)
39 
40 //------------------------------------------------------------------------
41 
42 const char* const GLContext::s_defaultFontName = "Arial";
43 const S32 GLContext::s_defaultFontSize = 16;
44 const U32 GLContext::s_defaultFontStyle = FontStyle_Bold;
45 
46 bool GLContext::s_inited = false;
47 HWND GLContext::s_shareHWND = NULL;
48 HDC GLContext::s_shareHDC = NULL;
49 HGLRC GLContext::s_shareHGLRC = NULL;
50 GLContext* GLContext::s_headless = NULL;
51 GLContext* GLContext::s_current = NULL;
52 bool GLContext::s_stereoAvailable = false;
53 
54 GLContext::TempTexture GLContext::s_tempTextures = { &s_tempTextures, &s_tempTextures, 0, 0 };
55 Hash<Vec2i, GLContext::TempTexture*>* GLContext::s_tempTexHash = NULL;
56 S32 GLContext::s_tempTexBytes = 0;
57 Hash<String, GLContext::Program*>* GLContext::s_programs = NULL;
58 
59 //------------------------------------------------------------------------
60 
61 GLContext::Program::Program(const String& vertexSource, const String& fragmentSource)
62 {
63  init(vertexSource, 0, 0, 0, "", fragmentSource);
64 }
65 
66 //------------------------------------------------------------------------
67 
69  const String& vertexSource,
70  GLenum geomInputType, GLenum geomOutputType, int geomVerticesOut, const String& geometrySource,
71  const String& fragmentSource)
72 {
73  init(vertexSource, geomInputType, geomOutputType, geomVerticesOut, geometrySource, fragmentSource);
74 }
75 
76 //------------------------------------------------------------------------
77 
79 {
80  glDeleteProgram(m_glProgram);
81  glDeleteShader(m_glVertexShader);
82  glDeleteShader(m_glGeometryShader);
83  glDeleteShader(m_glFragmentShader);
84 }
85 
86 //------------------------------------------------------------------------
87 
89 {
90  return glGetAttribLocation(m_glProgram, name.getPtr());
91 }
92 
93 //------------------------------------------------------------------------
94 
96 {
97  return glGetUniformLocation(m_glProgram, name.getPtr());
98 }
99 
100 //------------------------------------------------------------------------
101 
103 {
104  glUseProgram(m_glProgram);
105 }
106 
107 //------------------------------------------------------------------------
108 
109 GLuint GLContext::Program::createGLShader(GLenum type, const String& typeStr, const String& source)
110 {
111  GLuint shader = glCreateShader(type);
112  const char* sourcePtr = source.getPtr();
113  int sourceLen = source.getLength();
114  glShaderSource(shader, 1, &sourcePtr, &sourceLen);
115  glCompileShader(shader);
116 
117  GLint status = 0;
118  glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
119  if (!status)
120  {
121  GLint infoLen = 0;
122  glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
123  if (!infoLen)
124  fail("glCompileShader(%s) failed!", typeStr.getPtr());
125 
126  Array<char> info(NULL, infoLen);
127  info[0] = '\0';
128  glGetShaderInfoLog(shader, infoLen, &infoLen, info.getPtr());
129  fail("glCompileShader(%s) failed!\n\n%s", typeStr.getPtr(), info.getPtr());
130  }
131 
133  return shader;
134 }
135 
136 //------------------------------------------------------------------------
137 
139 {
140  glLinkProgram(prog);
141  GLint status = 0;
142  glGetProgramiv(prog, GL_LINK_STATUS, &status);
143  if (!status)
144  {
145  GLint infoLen = 0;
146  glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &infoLen);
147  if (!infoLen)
148  fail("glLinkProgram() failed!");
149 
150  Array<char> info(NULL, infoLen);
151  info[0] = '\0';
152  glGetProgramInfoLog(prog, infoLen, &infoLen, info.getPtr());
153  fail("glLinkProgram() failed!\n\n%s", info.getPtr());
154  }
156 }
157 
158 //------------------------------------------------------------------------
159 
160 void GLContext::Program::init(
161  const String& vertexSource,
162  GLenum geomInputType, GLenum geomOutputType, int geomVerticesOut, const String& geometrySource,
163  const String& fragmentSource)
164 {
166  m_glProgram = glCreateProgram();
167 
168  // Setup vertex shader.
169 
170  m_glVertexShader = createGLShader(GL_VERTEX_SHADER, "GL_VERTEX_SHADER", vertexSource);
171  glAttachShader(m_glProgram, m_glVertexShader);
172 
173  // Setup geometry shader (GL_ARB_geometry_shader4).
174 
175  if (geometrySource.getLength() == 0)
176  m_glGeometryShader = 0;
177  else
178  {
179  m_glGeometryShader = createGLShader(GL_GEOMETRY_SHADER_ARB, "GL_GEOMETRY_SHADER_ARB", geometrySource);
180  glAttachShader(m_glProgram, m_glGeometryShader);
181 
182  if (!GL_FUNC_AVAILABLE(glProgramParameteriARB))
183  fail("glProgramParameteriARB() not available!");
184  glProgramParameteriARB(m_glProgram, GL_GEOMETRY_INPUT_TYPE_ARB, geomInputType);
185  glProgramParameteriARB(m_glProgram, GL_GEOMETRY_OUTPUT_TYPE_ARB, geomOutputType);
186  glProgramParameteriARB(m_glProgram, GL_GEOMETRY_VERTICES_OUT_ARB, geomVerticesOut);
187  }
188 
189  // Setup fragment shader.
190 
191  m_glFragmentShader = createGLShader(GL_FRAGMENT_SHADER, "GL_FRAGMENT_SHADER", fragmentSource);
192  glAttachShader(m_glProgram, m_glFragmentShader);
193 
194  // Link.
195 
196  linkGLProgram(m_glProgram);
197 }
198 
199 //------------------------------------------------------------------------
200 
201 GLContext::GLContext(HDC hdc, HGLRC hglrc)
202 {
203  FW_ASSERT(hdc && hglrc);
204  staticInit();
205  init(hdc, hglrc);
206 }
207 
208 //------------------------------------------------------------------------
209 
210 GLContext::GLContext(HDC hdc, const Config& config)
211 {
212  FW_ASSERT(hdc);
213  staticInit();
214  m_config = config;
215 
216  // Choose pixel format.
217 
218  int formatIdx;
219  if (!choosePixelFormat(formatIdx, hdc, config))
220  fail("No appropriate pixel format found!");
221 
222  // Apply pixel format.
223 
224  PIXELFORMATDESCRIPTOR pfd;
225  if (DescribePixelFormat(hdc, formatIdx, sizeof(pfd), &pfd) == 0)
226  failWin32Error("DescribePixelFormat");
227  if (!SetPixelFormat(hdc, formatIdx, &pfd))
228  failWin32Error("SetPixelFormat");
229 
230  // Create WGL context.
231 
232  HGLRC hglrc = wglCreateContext(hdc);
233  if (!hglrc)
234  fail("wglCreateContext() failed!");
235  if (!wglShareLists(s_shareHGLRC, hglrc))
236  fail("wglShareLists() failed!");
237 
238  // Initialize.
239 
240  init(hdc, hglrc);
241 }
242 
243 //------------------------------------------------------------------------
244 
246 {
247  DeleteObject(m_memdc);
248  DeleteObject(m_vgFont);
249 
250  if (s_current != s_headless)
251  {
252  if (s_current == this)
253  s_headless->makeCurrent();
254  wglDeleteContext(m_hglrc);
255  }
256 }
257 
258 //------------------------------------------------------------------------
259 
261 {
262  if (s_current != this)
263  {
264  checkErrors();
265 
266  if (!wglMakeCurrent(m_hdc, m_hglrc))
267  failWin32Error("wglMakeCurrent");
268  s_current = this;
269 
270  checkErrors();
271  }
272 }
273 
274 //------------------------------------------------------------------------
275 
277 {
278  glFinish();
279  checkErrors();
280  if (GL_FUNC_AVAILABLE(wglSwapIntervalEXT))
281  wglSwapIntervalEXT(0); // WGL_EXT_swap_control
282  SwapBuffers(m_hdc);
283 }
284 
285 //------------------------------------------------------------------------
286 
287 void GLContext::setView(const Vec2i& pos, const Vec2i& size)
288 {
289  FW_ASSERT(size.x > 0 && size.y > 0);
290  glViewport(pos.x, pos.y, size.x, size.y);
291  m_viewPos = pos;
292  m_viewSize = size;
293  m_viewScale = Vec2f(2.0f) / Vec2f(size);
294 }
295 
296 //------------------------------------------------------------------------
297 
298 Mat4f GLContext::xformMouseToUser(const Mat4f& userToClip) const
299 {
300  return
301  userToClip.inverted() *
302  Mat4f::scale(Vec3f(1.0f, -1.0f, 1.0f)) *
303  Mat4f::translate(Vec3f(-1.0f, -1.0f, 0.0f)) *
304  Mat4f::scale(Vec3f(m_viewScale, 1.0f)) *
305  Mat4f::translate(Vec3f(0.5f, 0.5f, 0.0f));
306 }
307 
308 //------------------------------------------------------------------------
309 
310 void GLContext::setAttrib(int loc, int size, GLenum type, int stride, Buffer* buffer, const void* pointer)
311 {
312  if (loc < 0)
313  return;
314 
315  glBindBuffer(GL_ARRAY_BUFFER, (buffer) ? buffer->getGLBuffer() : 0);
317  glVertexAttribPointer(loc, size, type, GL_FALSE, stride, pointer);
318  m_numAttribs = max(m_numAttribs, loc + 1);
319 }
320 
321 //------------------------------------------------------------------------
322 
324 {
326  for (int i = 0; i < m_numAttribs; i++)
328  m_numAttribs = 0;
329 }
330 
331 //------------------------------------------------------------------------
332 
333 void GLContext::strokeLine(const Vec4f& p0, const Vec4f& p1, U32 abgr)
334 {
335  Vec4f v0 = m_vgXform * p0;
336  Vec4f v1 = m_vgXform * p1;
337  Vec2f dir = (v1.getXY() / v1.w - v0.getXY() / v0.w).normalized();
338  Vec4f x0 = Vec4f(dir * m_viewScale * v0.w, 0.0f, 0.0f);
339  Vec4f y0 = Vec4f(dir.perpendicular() * m_viewScale * v0.w, 0.0f, 0.0f);
340  Vec4f x1 = Vec4f(dir * m_viewScale * v1.w, 0.0f, 0.0f);
341  Vec4f y1 = Vec4f(dir.perpendicular() * m_viewScale * v1.w, 0.0f, 0.0f);
342 
343  VGVertex vertices[] =
344  {
345  { v0, 1.0f }, { v0 - x0 - y0, 0.0f }, { v0 - x0 + y0, 0.0f },
346  { v0, 1.0f }, { v0 - x0 + y0, 0.0f }, { v1 + x1 + y1, 0.0f },
347  { v0, 1.0f }, { v0 - x0 - y0, 0.0f }, { v1, 1.0f },
348  { v1, 1.0f }, { v1 + x1 - y1, 0.0f }, { v1 + x1 + y1, 0.0f },
349  { v1, 1.0f }, { v1 + x1 - y1, 0.0f }, { v0 - x0 - y0, 0.0f },
350  { v1, 1.0f }, { v1 + x1 + y1, 0.0f }, { v0, 1.0f },
351  };
352  drawVG(vertices, FW_ARRAY_SIZE(vertices), abgr);
353 }
354 
355 //------------------------------------------------------------------------
356 
357 void GLContext::fillRect(const Vec4f& pos, const Vec2f& localSize, const Vec2f& screenSize, U32 abgr)
358 {
359  Vec4f v0 = m_vgXform * pos;
360  Vec4f x1 = Vec4f(Vec4f(m_vgXform.getCol(0)).getXY().normalized() * m_viewScale, 0.0f, 0.0f);
361  Vec4f y1 = Vec4f(Vec4f(m_vgXform.getCol(1)).getXY().normalized() * m_viewScale, 0.0f, 0.0f);
362  Vec4f x0 = (m_vgXform * Vec4f(localSize.x, 0.0f, 0.0f, 0.0f) + x1 * (screenSize.x - 1.0f)) * 0.5f;
363  Vec4f y0 = (m_vgXform * Vec4f(0.0f, localSize.y, 0.0f, 0.0f) + y1 * (screenSize.y - 1.0f)) * 0.5f;
364 
365  VGVertex vertices[] =
366  {
367  { v0 - x0 - y0, 1.0f }, { v0 - x0 - y0 - x1 - y1, 0.0f }, { v0 + x0 - y0, 1.0f },
368  { v0 + x0 - y0, 1.0f }, { v0 + x0 - y0 + x1 - y1, 0.0f }, { v0 + x0 + y0, 1.0f },
369  { v0 + x0 + y0, 1.0f }, { v0 + x0 + y0 + x1 + y1, 0.0f }, { v0 - x0 + y0, 1.0f },
370  { v0 - x0 + y0, 1.0f }, { v0 - x0 + y0 - x1 + y1, 0.0f }, { v0 - x0 - y0, 1.0f },
371  { v0 - x0 - y0, 1.0f }, { v0 - x0 - y0 - x1 - y1, 0.0f }, { v0 - x0 + y0 - x1 + y1, 0.0f },
372  { v0 + x0 - y0, 1.0f }, { v0 + x0 - y0 + x1 - y1, 0.0f }, { v0 - x0 - y0 - x1 - y1, 0.0f },
373  { v0 + x0 + y0, 1.0f }, { v0 + x0 + y0 + x1 + y1, 0.0f }, { v0 + x0 - y0 + x1 - y1, 0.0f },
374  { v0 - x0 + y0, 1.0f }, { v0 - x0 + y0 - x1 + y1, 0.0f }, { v0 + x0 + y0 + x1 + y1, 0.0f },
375  { v0 - x0 - y0, 1.0f }, { v0 + x0 - y0, 1.0f }, { v0 - x0 + y0, 1.0f },
376  { v0 + x0 - y0, 1.0f }, { v0 - x0 + y0, 1.0f }, { v0 + x0 + y0, 1.0f },
377  };
378  drawVG(vertices, FW_ARRAY_SIZE(vertices), abgr);
379 }
380 
381 //------------------------------------------------------------------------
382 
383 void GLContext::drawBox(const Vec3f& min, const Vec3f& max, U32 abgr)
384 {
385  VGVertex vertices[] =
386  {
387  // min x
388  { Vec4f(min.x, min.y, min.z, 1.0f), 1.0f },
389  { Vec4f(min.x, max.y, min.z, 1.0f), 1.0f },
390  { Vec4f(min.x, max.y, max.z, 1.0f), 1.0f },
391  { Vec4f(min.x, min.y, max.z, 1.0f), 1.0f },
392  // min y
393  { Vec4f(min.x, min.y, min.z, 1.0f), 1.0f },
394  { Vec4f(min.x, min.y, max.z, 1.0f), 1.0f },
395  { Vec4f(max.x, min.y, max.z, 1.0f), 1.0f },
396  { Vec4f(max.x, min.y, min.z, 1.0f), 1.0f },
397  // min z
398  { Vec4f(min.x, min.y, min.z, 1.0f), 1.0f },
399  { Vec4f(max.x, min.y, min.z, 1.0f), 1.0f },
400  { Vec4f(max.x, max.y, min.z, 1.0f), 1.0f },
401  { Vec4f(min.x, max.y, min.z, 1.0f), 1.0f },
402  // max x
403  { Vec4f(max.x, max.y, max.z, 1.0f), 1.0f },
404  { Vec4f(max.x, max.y, min.z, 1.0f), 1.0f },
405  { Vec4f(max.x, min.y, min.z, 1.0f), 1.0f },
406  { Vec4f(max.x, min.y, max.z, 1.0f), 1.0f },
407  // max y
408  { Vec4f(max.x, max.y, max.z, 1.0f), 1.0f },
409  { Vec4f(min.x, max.y, max.z, 1.0f), 1.0f },
410  { Vec4f(min.x, max.y, min.z, 1.0f), 1.0f },
411  { Vec4f(max.x, max.y, min.z, 1.0f), 1.0f },
412  // max z
413  { Vec4f(max.x, max.y, max.z, 1.0f), 1.0f },
414  { Vec4f(max.x, min.y, max.z, 1.0f), 1.0f },
415  { Vec4f(min.x, min.y, max.z, 1.0f), 1.0f },
416  { Vec4f(min.x, max.y, max.z, 1.0f), 1.0f },
417  };
418 
419  // Convert color.
420 
421  Vec4f color = Vec4f::fromABGR(abgr);
422  if (color.w <= 0.0f)
423  return;
424 
425  // Create program.
426 
427  static const char* progId = "GLContext::drawVG";
428  Program* prog = getProgram(progId);
429  if (!prog)
430  {
431  prog = new Program(
433  uniform mat4 view_matrix;
434  uniform vec4 color;
435  attribute vec4 pos;
436  attribute float alpha;
437  varying vec4 shadedColor;
438  void main()
439  {
440  gl_Position = view_matrix*pos;
441  shadedColor = vec4(color.rgb, color.a * alpha);
442  }
443  ),
445  varying vec4 shadedColor;
446  void main()
447  {
448  gl_FragColor = shadedColor;
449  }
450  ));
451  setProgram(progId, prog);
452  }
453 
454  // Setup state.
455 
456  glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
457  glEnable(GL_BLEND);
458  glBlendEquation(GL_FUNC_ADD);
459  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
460 
461  // Draw.
462 
463  prog->use();
464  setUniform(prog->getUniformLoc("view_matrix"), m_vgXform);
465  setUniform(prog->getUniformLoc("color"), color);
466  setAttrib(prog->getAttribLoc("pos"), 4, GL_FLOAT, sizeof(VGVertex), &vertices->pos);
467  setAttrib(prog->getAttribLoc("alpha"), 1, GL_FLOAT, sizeof(VGVertex), &vertices->alpha);
468  glDrawArrays(GL_QUADS, 0, FW_ARRAY_SIZE(vertices));
469  resetAttribs();
470 
471  // Clean up.
472 
473  glPopAttrib();
474  checkErrors();
475 }
476 
477 //------------------------------------------------------------------------
478 
479 void GLContext::drawBuffer(Buffer& buffer, GLenum mode, int offset, U32 abgr)
480 {
481  // Convert color.
482 
483  Vec4f color = Vec4f::fromABGR(abgr);
484  if (color.w <= 0.0f)
485  return;
486 
487  // Create program.
488 
489  static const char* progId = "GLContext::drawLines";
490  Program* prog = getProgram(progId);
491  if (!prog)
492  {
493  prog = new Program(
495  uniform mat4 view_matrix;
496  uniform vec4 color;
497  attribute vec4 pos;
498  varying vec4 shadedColor;
499  void main()
500  {
501  gl_Position = view_matrix*pos;
502  shadedColor = color.rgba;
503  }
504  ),
506  varying vec4 shadedColor;
507  void main()
508  {
509  gl_FragColor = shadedColor;
510  }
511  ));
512  setProgram(progId, prog);
513  }
514 
515  // Setup state.
516 
517  glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
518  //glDisable(GL_CULL_FACE); // Original, why is this needed?
519  glEnable(GL_BLEND);
520  glBlendEquation(GL_FUNC_ADD);
521  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
522 
523  // Draw.
524 
525  prog->use();
526  setUniform(prog->getUniformLoc("view_matrix"), m_vgXform);
527  setUniform(prog->getUniformLoc("color"), color);
528  setAttrib(prog->getAttribLoc("pos"), 4, GL_FLOAT, sizeof(Vec4f), buffer, offset);
529  glDrawArrays(mode, 0, (GLsizei)buffer.getSize());
530 
531  //Array<Vec4f> colors;
532  //colors.add(Vec4f(1.0f, 0.0f, 0.0f, 0.3f));
533  //colors.add(Vec4f(0.0f, 1.0f, 0.0f, 0.3f));
534  //colors.add(Vec4f(0.0f, 0.0f, 1.0f, 0.3f));
536  //colors.add(Vec4f(1.0f, 1.0f, 0.0f, 0.3f));
538  //colors.add(Vec4f(1.0f, 1.0f, 1.0f, 0.3f));
539  //int j = 0;
540  //for(int i = 0; i < buffer.getSize(); i+=8*4*4)
541  //{
542  // setUniform(prog->getUniformLoc("view_matrix"), m_vgXform);
543  // setUniform(prog->getUniformLoc("color"), colors[j%colors.getSize()]);
544  // setAttrib(prog->getAttribLoc("pos"), 4, GL_FLOAT, sizeof(Vec4f), buffer, offset);
545  // glDrawArrays(mode, i, i+8*4*4);
546  // j++;
547  //}
548  resetAttribs();
549 
550  // Clean up.
551 
552  glPopAttrib();
553  checkErrors();
554 }
555 
556 //------------------------------------------------------------------------
557 
559 {
560  // Create program.
561 
562  static const char* progId = "GLContext::drawColorBuffer";
563  Program* prog = getProgram(progId);
564  if (!prog)
565  {
566  prog = new Program(
568  uniform mat4 view_matrix;
569  attribute vec4 color;
570  attribute vec4 pos;
571  varying vec4 shadedColor;
572  void main()
573  {
574  gl_Position = view_matrix*pos;
575  shadedColor = color.rgba;
576  }
577  ),
579  varying vec4 shadedColor;
580  void main()
581  {
582  gl_FragColor = shadedColor;
583  }
584  ));
585  setProgram(progId, prog);
586  }
587 
588  // Setup state.
589 
590  glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
591  glEnable(GL_BLEND);
592  glBlendEquation(GL_FUNC_ADD);
593  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
594 
595  // Draw.
596 
597  prog->use();
598  setUniform(prog->getUniformLoc("view_matrix"), m_vgXform);
599  setAttrib(prog->getAttribLoc("color"), 4, GL_FLOAT, sizeof(Vec4f), color, offset);
600  setAttrib(prog->getAttribLoc("pos"), 4, GL_FLOAT, sizeof(Vec4f), buffer, offset);
601  glDrawArrays(mode, 0, (GLsizei)buffer.getSize());
602 
603  resetAttribs();
604 
605  // Clean up.
606 
607  glPopAttrib();
608  checkErrors();
609 }
610 
611 //------------------------------------------------------------------------
612 
613 void GLContext::strokeRect(const Vec4f& pos, const Vec2f& localSize, const Vec2f& screenSize, U32 abgr)
614 {
615  Vec4f v0 = m_vgXform * pos;
616  Vec4f x1 = Vec4f(Vec4f(m_vgXform.getCol(0)).getXY().normalized() * m_viewScale, 0.0f, 0.0f);
617  Vec4f y1 = Vec4f(Vec4f(m_vgXform.getCol(1)).getXY().normalized() * m_viewScale, 0.0f, 0.0f);
618  Vec4f x0 = (m_vgXform * Vec4f(localSize.x, 0.0f, 0.0f, 0.0f) + x1 * screenSize.x) * 0.5f;
619  Vec4f y0 = (m_vgXform * Vec4f(0.0f, localSize.y, 0.0f, 0.0f) + y1 * screenSize.y) * 0.5f;
620 
621  VGVertex vertices[] =
622  {
623  { v0 - x0 - y0, 1.0f }, { v0 - x0 - y0 - x1 - y1, 0.0f }, { v0 + x0 - y0, 1.0f },
624  { v0 + x0 - y0, 1.0f }, { v0 + x0 - y0 + x1 - y1, 0.0f }, { v0 + x0 + y0, 1.0f },
625  { v0 + x0 + y0, 1.0f }, { v0 + x0 + y0 + x1 + y1, 0.0f }, { v0 - x0 + y0, 1.0f },
626  { v0 - x0 + y0, 1.0f }, { v0 - x0 + y0 - x1 + y1, 0.0f }, { v0 - x0 - y0, 1.0f },
627  { v0 - x0 - y0, 1.0f }, { v0 - x0 - y0 - x1 - y1, 0.0f }, { v0 - x0 + y0 - x1 + y1, 0.0f },
628  { v0 + x0 - y0, 1.0f }, { v0 + x0 - y0 + x1 - y1, 0.0f }, { v0 - x0 - y0 - x1 - y1, 0.0f },
629  { v0 + x0 + y0, 1.0f }, { v0 + x0 + y0 + x1 + y1, 0.0f }, { v0 + x0 - y0 + x1 - y1, 0.0f },
630  { v0 - x0 + y0, 1.0f }, { v0 - x0 + y0 - x1 + y1, 0.0f }, { v0 + x0 + y0 + x1 + y1, 0.0f },
631  { v0 - x0 - y0, 1.0f }, { v0 - x0 - y0 + x1 + y1, 0.0f }, { v0 + x0 - y0, 1.0f },
632  { v0 + x0 - y0, 1.0f }, { v0 + x0 - y0 - x1 + y1, 0.0f }, { v0 + x0 + y0, 1.0f },
633  { v0 + x0 + y0, 1.0f }, { v0 + x0 + y0 - x1 - y1, 0.0f }, { v0 - x0 + y0, 1.0f },
634  { v0 - x0 + y0, 1.0f }, { v0 - x0 + y0 + x1 - y1, 0.0f }, { v0 - x0 - y0, 1.0f },
635  { v0 - x0 - y0, 1.0f }, { v0 - x0 - y0 + x1 + y1, 0.0f }, { v0 - x0 + y0 + x1 - y1, 0.0f },
636  { v0 + x0 - y0, 1.0f }, { v0 + x0 - y0 - x1 + y1, 0.0f }, { v0 - x0 - y0 + x1 + y1, 0.0f },
637  { v0 + x0 + y0, 1.0f }, { v0 + x0 + y0 - x1 - y1, 0.0f }, { v0 + x0 - y0 - x1 + y1, 0.0f },
638  { v0 - x0 + y0, 1.0f }, { v0 - x0 + y0 + x1 - y1, 0.0f }, { v0 + x0 + y0 - x1 - y1, 0.0f },
639  };
640  drawVG(vertices, FW_ARRAY_SIZE(vertices), abgr);
641 }
642 
643 //------------------------------------------------------------------------
644 
645 void GLContext::setFont(const String& name, int size, U32 style)
646 {
647  FW_ASSERT(size > 0);
648 
649  LOGFONT lf;
650  lf.lfHeight = size;
651  lf.lfWidth = 0;
652  lf.lfEscapement = 0;
653  lf.lfOrientation = 0;
654  lf.lfWeight = ((style & FontStyle_Bold) != 0) ? FW_BOLD : FW_NORMAL;
655  lf.lfItalic = ((style & FontStyle_Italic) != 0);
656  lf.lfUnderline = false;
657  lf.lfStrikeOut = false;
658  lf.lfCharSet = ANSI_CHARSET;
659  lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
660  lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
661  lf.lfQuality = PROOF_QUALITY;
662  lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
663  memcpy(lf.lfFaceName, name.getPtr(), name.getLength() + 1);
664 
665  HFONT font = CreateFontIndirect(&lf);
666  if (!font)
667  failWin32Error("CreateFontIndirect");
668 
669  setFont(font);
670 }
671 
672 //------------------------------------------------------------------------
673 
675 {
676  // Split the string into lines.
677 
678  Array<String> lines;
679  str.split('\n', lines, true);
680  while (lines.getSize() && !lines.getLast().getLength())
681  lines.removeLast();
682 
683  // Compute metrics.
684 
685  Vec2i strSize = 0;
686  for (int i = 0; i < lines.getSize(); i++)
687  {
688  if (!lines[i].getLength())
689  lines[i] = " "; // To avoid lineSize.y being zero.
690 
691  SIZE size;
692  if (!GetTextExtentPoint32(m_memdc, lines[i].getPtr(), lines[i].getLength(), &size))
693  failWin32Error("GetTextExtentPoint32");
694  Vec2i lineSize(size.cx + m_vgFontMetrics.tmOverhang, size.cy);
695  strSize.x = max(strSize.x, lineSize.x);
696  strSize.y += lineSize.y;
697 }
698 
699  return strSize;
700 }
701 
702 //------------------------------------------------------------------------
703 
704 Vec2i GLContext::drawLabel(const String& str, const Vec4f& pos, const Vec2f& align, U32 fgABGR, U32 bgABGR)
705 {
706  // Split the string into lines.
707 
708  Array<String> lines;
709  str.split('\n', lines, true);
710  while (lines.getSize() && !lines.getLast().getLength())
711  lines.removeLast();
712 
713  // Compute metrics.
714 
715  Vec2i strSize = 0;
716  for (int i = 0; i < lines.getSize(); i++)
717  {
718  if (!lines[i].getLength())
719  lines[i] = " "; // To avoid lineSize.y being zero.
720 
721  Vec2i lineSize = getStringSize(lines[i]);
722  strSize.x = max(strSize.x, lineSize.x);
723  strSize.y += lineSize.y;
724  }
725 
726  // Empty or fully transparent => skip.
727 
728  if (strSize.x <= 0 || strSize.y <= 0 || ((fgABGR | bgABGR) & 0xFF000000) == 0)
729  return strSize;
730 
731  // Initialize GL state.
732 
733  glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
734  glEnable(GL_BLEND);
735  glBlendEquation(GL_FUNC_ADD);
736  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
737 
738  // Draw each line.
739 
740  Vec4f fgColor = Vec4f::fromABGR(fgABGR);
741  Vec4f bgColor = Vec4f::fromABGR(bgABGR);
742  Vec2f linePos(0.0f, (F32)strSize.y);
743 
744  for (int i = 0; i < lines.getSize(); i++)
745  {
746  Vec2i lineSize = (lines.getSize() == 1) ? strSize : getStringSize(lines[i]);
747  if (lineSize.x <= 0 || lineSize.y <= 0)
748  continue;
749 
750  linePos.y -= (F32)lineSize.y;
751  const Vec2i& texSize = uploadString(lines[i], lineSize);
752 
753  Vec4f tpos = m_vgXform * pos;
754  Vec2f pixel = m_viewScale * tpos.w;
755  tpos.x += (linePos.x - align.x * (F32)lineSize.x) * pixel.x;
756  tpos.y += (linePos.y - align.y * (F32)strSize.y) * pixel.y;
757  tpos.x = floor((tpos.x + tpos.w) / pixel.x + 0.5f) * pixel.x - tpos.w;
758  tpos.y = floor((tpos.y + tpos.w) / pixel.y + 0.5f) * pixel.y - tpos.w;
759 
760  if (bgColor.w > 0.0f)
761  for (int j = -1; j <= 1; j++)
762  for (int k = -1; k <= 1; k++)
763  drawString(tpos + Vec4f(Vec2f((F32)j, (F32)k) * pixel, 0.0f, 0.0f), lineSize, texSize, bgColor);
764 
765  if (fgColor.w > 0.0f)
766  drawString(tpos, lineSize, texSize, fgColor);
767  }
768 
769  // Clean up.
770 
771  glPopAttrib();
772  checkErrors();
773  return strSize;
774 }
775 
776 //------------------------------------------------------------------------
777 
778 Vec2i GLContext::drawLabel(const String& str, const Vec4f& pos, const Vec2f& align, U32 abgr)
779 {
780  Vec4f bg(0.0f, 0.0f, 0.0f, sqr(Vec4f::fromABGR(abgr).w)); // alpha^2
781  return drawLabel(str, pos, align, abgr, bg.toABGR());
782 }
783 
784 //------------------------------------------------------------------------
785 
787 {
788  glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
789  glDrawBuffer(GL_BACK);
790  glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
791  glClear(GL_COLOR_BUFFER_BIT);
792  glDisable(GL_DEPTH_TEST);
793 
794  Mat4f oldXform = setVGXform(Mat4f());
795  HFONT oldFont = m_vgFont;
796  m_vgFont = NULL;
797  setFont("Arial", 32, GLContext::FontStyle_Normal);
798 
799  drawString(msg, Vec4f(Vec3f(0.0f), 1.0f), Vec2f(0.5f), 0xFFFFFFFF);
800 
801  setVGXform(oldXform);
802  setFont(oldFont);
803  glPopAttrib();
804 }
805 
806 //------------------------------------------------------------------------
807 
808 void GLContext::drawImage(const Image& image, const Vec4f& pos, const Vec2f& align, bool topToBottom)
809 {
810  const Vec2i& imgSize = image.getSize();
811  if (imgSize.min() <= 0)
812  return;
813 
814  Buffer& buf = image.getBuffer();
816  const ImageFormat::StaticFormat* sf = format.getStaticFormat();
817 
819  const Vec2i& texSize = bindTempTexture(imgSize);
820 
821  // Format is not supported by GL => convert and upload.
822 
823  if (image.getFormat() != format || image.getStride() != imgSize.x * format.getBPP())
824  {
825  Image converted(imgSize, format);
826  converted = image;
827  glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, imgSize.x, imgSize.y, sf->glFormat, sf->glType, converted.getPtr());
828  }
829 
830  // Data is already on the GPU => transfer to the texture.
831 
832  else if (buf.getOwner() == Buffer::GL || (buf.getOwner() == Buffer::Cuda && (buf.getHints() & Buffer::Hint_CudaGL) != 0))
833  {
835  glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, imgSize.x, imgSize.y, sf->glFormat, sf->glType, NULL);
837  }
838 
839  // Otherwise => upload.
840 
841  else
842  {
843  glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, imgSize.x, imgSize.y, sf->glFormat, sf->glType, buf.getPtr());
844  }
845 
846  // Determine orientation.
847 
848  Vec4f posLo = m_vgXform * pos;
849  Vec2f posRange = Vec2f(imgSize) * m_viewScale * posLo.w;
850  posLo -= Vec4f(align * posRange, 0.0f, 0.0f);
851  Vec2f posHi = posLo.getXY() + posRange;
852 
853  if (topToBottom)
854  swap(posLo.y, posHi.y);
855 
856  // Draw texture.
857 
858  glPushAttrib(GL_ENABLE_BIT);
859  glDisable(GL_CULL_FACE);
860  drawTexture(0, posLo, posHi, Vec2f(0.0f), Vec2f(imgSize) / Vec2f(texSize));
861  glPopAttrib();
862  checkErrors();
863 }
864 
865 //------------------------------------------------------------------------
866 
868 {
869  Program* const* prog = (s_programs) ? s_programs->search(id) : NULL;
870  return (prog) ? *prog : NULL;
871 }
872 
873 //------------------------------------------------------------------------
874 
875 void GLContext::setProgram(const String& id, Program* prog)
876 {
877  Program* old = getProgram(id);
878  if (old == prog)
879  return;
880 
881  if (old)
882  delete s_programs->remove(id);
883 
884  if (prog)
885  {
886  if (!s_programs)
887  s_programs = new Hash<String, Program*>;
888  s_programs->add(id, prog);
889  }
890 }
891 
892 //------------------------------------------------------------------------
893 
895 {
896  if (s_inited)
897  return;
898  s_inited = true;
899 
900  // Create window for the share context.
901 
902  s_shareHWND = Window::createHWND();
903  s_shareHDC = GetDC(s_shareHWND);
904  if (!s_shareHDC)
905  failWin32Error("GetDC");
906 
907  // Set pixel format.
908 
909  PIXELFORMATDESCRIPTOR pfd;
910  memset(&pfd, 0, sizeof(pfd));
911  pfd.nSize = sizeof(pfd);
912  pfd.nVersion = 1;
913  pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
914 
915  int formatIdx = ChoosePixelFormat(s_shareHDC, &pfd);
916  if (!formatIdx)
917  failWin32Error("ChoosePixelFormat");
918  if (!DescribePixelFormat(s_shareHDC, formatIdx, sizeof(pfd), &pfd))
919  failWin32Error("DescribePixelFormat");
920  if (!SetPixelFormat(s_shareHDC, formatIdx, &pfd))
921  failWin32Error("SetPixelFormat");
922 
923  // Create WGL context.
924 
925  s_shareHGLRC = wglCreateContext(s_shareHDC);
926  if (!s_shareHGLRC)
927  failWin32Error("wglCreateContext");
928  if (!wglMakeCurrent(s_shareHDC, s_shareHGLRC))
929  failWin32Error("wglMakeCurrent");
930 
931  // Check GL version.
932 
933  String glVersion = (const char*)glGetString(GL_VERSION);
934  int dotIdx = glVersion.indexOf('.');
935  if (dotIdx < 1 || glVersion[dotIdx - 1] < '2')
936  fail("OpenGL 2.0 or later is required!");
937 
938  // Import extension functions.
939 
940 #if FW_USE_GLEW
941  GLenum err = glewInit();
942  if (err != GLEW_OK)
943  fail("glewInit() failed: %s!", glewGetErrorString(err));
944 #endif
945 
946  initGLImports();
947 
948  // Create wrapper GLContext.
949 
950  FW_ASSERT(!s_headless);
951  s_headless = new GLContext(s_shareHDC, s_shareHGLRC);
952 
953  // Determine whether stereo is available.
954 
955  Config stereoConfig;
956  stereoConfig.isStereo = true;
957  s_stereoAvailable = s_headless->choosePixelFormat(formatIdx, s_shareHDC, stereoConfig);
958 }
959 
960 //------------------------------------------------------------------------
961 
963 {
964  if (!s_inited)
965  return;
966  s_inited = false;
967 
968  while (s_tempTextures.next != &s_tempTextures)
969  {
970  TempTexture* tex = s_tempTextures.next;
971  s_tempTextures.next = tex->next;
972  glDeleteTextures(1, &tex->handle);
973  delete tex;
974  }
975  delete s_tempTexHash;
976  s_tempTextures.prev = &s_tempTextures;
977  s_tempTexHash = NULL;
978 
979  if (s_programs)
980  {
981  for (int i = s_programs->firstSlot(); i != -1; i = s_programs->nextSlot(i))
982  delete s_programs->getSlot(i).value;
983  delete s_programs;
984  s_programs = NULL;
985  }
986 
987  FW_ASSERT(s_headless);
988  delete s_headless;
989  wglMakeCurrent(NULL, NULL);
990  wglDeleteContext(s_shareHGLRC);
991  ReleaseDC(s_shareHWND, s_shareHDC);
992  DestroyWindow(s_shareHWND);
993 
994  s_shareHWND = NULL;
995  s_shareHDC = NULL;
996  s_shareHGLRC = NULL;
997  s_headless = NULL;
998  s_current = NULL;
999 }
1000 
1001 //------------------------------------------------------------------------
1002 
1004 {
1005  if (!s_current)
1006  return;
1007 
1008  GLenum err = glGetError();
1009  const char* name;
1010  switch (err)
1011  {
1012  case GL_NO_ERROR: name = NULL; break;
1013  case GL_INVALID_ENUM: name = "GL_INVALID_ENUM"; break;
1014  case GL_INVALID_VALUE: name = "GL_INVALID_VALUE"; break;
1015  case GL_INVALID_OPERATION: name = "GL_INVALID_OPERATION"; break;
1016  case GL_STACK_OVERFLOW: name = "GL_STACK_OVERFLOW"; break;
1017  case GL_STACK_UNDERFLOW: name = "GL_STACK_UNDERFLOW"; break;
1018  case GL_OUT_OF_MEMORY: name = "GL_OUT_OF_MEMORY"; break;
1019  case GL_INVALID_FRAMEBUFFER_OPERATION: name = "GL_INVALID_FRAMEBUFFER_OPERATION"; break;
1020  default: name = "unknown"; break;
1021  }
1022 
1023  if (name)
1024  fail("Caught GL error 0x%04x (%s)!", err, name);
1025 }
1026 
1027 //------------------------------------------------------------------------
1028 
1029 bool GLContext::choosePixelFormat(int& formatIdx, HDC hdc, const Config& config)
1030 {
1031  // Requirements.
1032 
1033  Array<Vec2i> reqs; // token, value
1034  reqs.add(Vec2i(WGL_DRAW_TO_WINDOW_ARB, 1));
1036  reqs.add(Vec2i(WGL_SUPPORT_OPENGL_ARB, 1));
1037  reqs.add(Vec2i(WGL_DOUBLE_BUFFER_ARB, 1));
1039  reqs.add(Vec2i(WGL_DEPTH_BITS_ARB, 24));
1040  reqs.add(Vec2i(WGL_STENCIL_BITS_ARB, 8));
1041  reqs.add(Vec2i(WGL_STEREO_ARB, (config.isStereo) ? 1 : 0));
1042 
1043  if (config.numSamples > 1)
1044  reqs.add(Vec2i(WGL_SAMPLES_ARB, config.numSamples)); // WGL_ARB_multisample
1045 
1046  reqs.add(0);
1047 
1048  // Preferences.
1049 
1050  Array<Vec3i> prefs; // token, value, weight
1051  prefs.add(Vec3i(WGL_RED_BITS_ARB, 8, 8));
1052  prefs.add(Vec3i(WGL_GREEN_BITS_ARB, 8, 8));
1053  prefs.add(Vec3i(WGL_BLUE_BITS_ARB, 8, 8));
1054  prefs.add(Vec3i(WGL_ALPHA_BITS_ARB, 8, 0));
1055  prefs.add(Vec3i(WGL_ACCUM_BITS_ARB, 0, 16));
1056  prefs.add(Vec3i(WGL_AUX_BUFFERS_ARB, 0, 16));
1057  prefs.add(Vec3i(WGL_NUMBER_OVERLAYS_ARB, 0, 16));
1058  prefs.add(Vec3i(WGL_NUMBER_UNDERLAYS_ARB, 0, 16));
1059 
1060  // Query formats that fulfill the requirements.
1061 
1063  fail("wglChoosePixelFormatARB() not available!");
1064 
1065  UINT numFormats = 0;
1066  if (!wglChoosePixelFormatARB(hdc, &reqs[0].x, NULL, 0, NULL, &numFormats))
1067  failWin32Error("wglChoosePixelFormatARB");
1068  if (numFormats == 0)
1069  return false;
1070 
1071  Array<int> formats(NULL, numFormats);
1072  if (!wglChoosePixelFormatARB(hdc, &reqs[0].x, NULL, numFormats, formats.getPtr(), &numFormats))
1073  failWin32Error("wglChoosePixelFormatARB");
1074 
1075  // Choose format based on the preferences.
1076 
1077  S32 bestCost = FW_S32_MAX;
1078  for (int i = 0; i < (int)numFormats; i++)
1079  {
1080  S32 cost = 0;
1081  for (int j = 0; j < prefs.getSize(); j++)
1082  {
1083  int value = 0;
1084  if (!wglGetPixelFormatAttribivARB(hdc, formats[i], 0, 1, &prefs[j].x, &value))
1085  failWin32Error("wglGetPixelFormatAttribivARB");
1086  cost += abs(value - prefs[j].y) << prefs[j].z;
1087  }
1088 
1089  if (cost < bestCost)
1090  {
1091  formatIdx = formats[i];
1092  bestCost = cost;
1093  }
1094  }
1095  return true;
1096 }
1097 
1098 //------------------------------------------------------------------------
1099 
1100 void GLContext::init(HDC hdc, HGLRC hglrc)
1101 {
1102  FW_ASSERT(hdc && hglrc);
1103 
1104  // Initialize members.
1105 
1106  m_hdc = hdc;
1107  m_hglrc = hglrc;
1108 
1109  m_viewPos = 0;
1110  m_viewSize = 1;
1111  m_viewScale = 2.0f;
1112  m_numAttribs = 0;
1113 
1114  m_vgFont = NULL;
1115 
1116  // Setup text rendering.
1117 
1118  m_memdc = CreateCompatibleDC(m_hdc);
1119  if (!m_memdc)
1120  failWin32Error("CreateCompatibleDC");
1121 
1122  if (SetTextAlign(m_memdc, TA_TOP | TA_LEFT) == GDI_ERROR)
1123  failWin32Error("SetTextAlign");
1124 
1125  if (SetBkColor(m_memdc, RGB(0x00, 0x00, 0xFF)) == CLR_INVALID)
1126  failWin32Error("SetTextColor");
1127 
1128  if (SetTextColor(m_memdc, RGB(0xFF, 0xFF, 0x00)) == CLR_INVALID)
1129  failWin32Error("SetTextColor");
1130 
1131  setDefaultFont();
1132 
1133  // Initialize GL state.
1134 
1135  GLContext* oldContext = s_current;
1136  makeCurrent();
1137 
1138  glPixelStorei(GL_PACK_ALIGNMENT, 1);
1139  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
1140  checkErrors();
1141 
1142  if (oldContext)
1143  oldContext->makeCurrent();
1144 }
1145 
1146 //------------------------------------------------------------------------
1147 
1148 void GLContext::drawVG(const VGVertex* vertices, int numVertices, U32 abgr)
1149 {
1150  // Convert color.
1151 
1152  Vec4f color = Vec4f::fromABGR(abgr);
1153  if (color.w <= 0.0f)
1154  return;
1155 
1156  // Create program.
1157 
1158  static const char* progId = "GLContext::drawVG";
1159  Program* prog = getProgram(progId);
1160  if (!prog)
1161  {
1162  prog = new Program(
1164  uniform vec4 color;
1165  attribute vec4 pos;
1166  attribute float alpha;
1167  varying vec4 shadedColor;
1168  void main()
1169  {
1170  gl_Position = pos;
1171  shadedColor = vec4(color.rgb, color.a * alpha);
1172  }
1173  ),
1175  varying vec4 shadedColor;
1176  void main()
1177  {
1178  gl_FragColor = shadedColor;
1179  }
1180  ));
1181  setProgram(progId, prog);
1182  }
1183 
1184  // Setup state.
1185 
1186  glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
1187  glDisable(GL_CULL_FACE);
1188  glEnable(GL_BLEND);
1189  glBlendEquation(GL_FUNC_ADD);
1190  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1191 
1192  // Draw.
1193 
1194  prog->use();
1195  setUniform(prog->getUniformLoc("color"), color);
1196  setAttrib(prog->getAttribLoc("pos"), 4, GL_FLOAT, sizeof(VGVertex), &vertices->pos);
1197  setAttrib(prog->getAttribLoc("alpha"), 1, GL_FLOAT, sizeof(VGVertex), &vertices->alpha);
1198  glDrawArrays(GL_TRIANGLES, 0, numVertices);
1199  resetAttribs();
1200 
1201  // Clean up.
1202 
1203  glPopAttrib();
1204  checkErrors();
1205 }
1206 
1207 //------------------------------------------------------------------------
1208 
1209 void GLContext::setFont(HFONT font)
1210 {
1211  FW_ASSERT(font);
1212 
1213  DeleteObject(m_vgFont);
1214  m_vgFont = font;
1215 
1216  if (!SelectObject(m_memdc, m_vgFont))
1217  failWin32Error("SelectObject");
1218 
1219  if (!GetTextMetrics(m_memdc, &m_vgFontMetrics))
1220  failWin32Error("GetTextMetrics");
1221 }
1222 
1223 //------------------------------------------------------------------------
1224 
1225 const Vec2i& GLContext::uploadString(const String& str, const Vec2i& strSize)
1226 {
1227  // Create word-oriented DIB.
1228 
1229  U8 bmi[sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD)];
1230  BITMAPINFOHEADER* bmih = (BITMAPINFOHEADER*)bmi;
1231  DWORD* masks = (DWORD*)(bmih + 1);
1232 
1233  bmih->biSize = sizeof(BITMAPINFOHEADER);
1234  bmih->biWidth = strSize.x;
1235  bmih->biHeight = strSize.y;
1236  bmih->biPlanes = 1;
1237  bmih->biBitCount = 32;
1238  bmih->biCompression = BI_BITFIELDS;
1239  bmih->biSizeImage = 0;
1240  bmih->biXPelsPerMeter = 0;
1241  bmih->biYPelsPerMeter = 0;
1242  bmih->biClrUsed = 0;
1243  bmih->biClrImportant = 0;
1244  masks[0] = 0x00FF0000;
1245  masks[1] = 0x0000FF00;
1246  masks[2] = 0x000000FF;
1247 
1248  void* buffer;
1249  HBITMAP dib = CreateDIBSection(m_memdc, (BITMAPINFO*)bmi, DIB_RGB_COLORS, &buffer, NULL, 0);
1250  if (!dib)
1251  failWin32Error("CreateDIBSection");
1252 
1253  // Clear DIB.
1254 
1255  for (int i = strSize.x * strSize.y - 1; i >= 0; i--)
1256  ((U32*)buffer)[i] = 0x000000FF;
1257 
1258  // Draw string.
1259 
1260  if (!SelectObject(m_memdc, dib))
1261  failWin32Error("SelectObject");
1262 
1263  if (!TextOut(m_memdc, 0, 0, str.getPtr(), str.getLength()))
1264  failWin32Error("TextOut");
1265 
1266  // Upload to texture and destroy DIB.
1267 
1269  const Vec2i& texSize = bindTempTexture(strSize);
1270  glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, strSize.x, strSize.y, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
1271  DeleteObject(dib);
1272  return texSize;
1273 }
1274 
1275 //------------------------------------------------------------------------
1276 
1277 void GLContext::drawString(const Vec4f& pos, const Vec2i& strSize, const Vec2i& texSize, const Vec4f& color)
1278 {
1279  // Setup vertex arrays.
1280 
1281  Vec2f posLo = pos.getXY();
1282  Vec2f posHi = posLo + Vec2f(strSize) * m_viewScale * pos.w;
1283  Vec2f texHi = Vec2f(strSize) / Vec2f(texSize);
1284 
1285  F32 posAttrib[16] =
1286  {
1287  posLo.x, posLo.y, pos.z, pos.w,
1288  posHi.x, posLo.y, pos.z, pos.w,
1289  posLo.x, posHi.y, pos.z, pos.w,
1290  posHi.x, posHi.y, pos.z, pos.w,
1291  };
1292 
1293  F32 texAttrib[8] =
1294  {
1295  0.0f, 0.0f,
1296  texHi.x, 0.0f,
1297  0.0f, texHi.y,
1298  texHi.x, texHi.y,
1299  };
1300 
1301  // Create program.
1302 
1303  static const char* progId = "GLContext::drawString";
1304  GLContext::Program* prog = getProgram(progId);
1305  if (!prog)
1306  {
1307  prog = new GLContext::Program(
1309  attribute vec4 posAttrib;
1310  attribute vec2 texAttrib;
1311  varying vec2 texVarying;
1312 
1313  void main()
1314  {
1315  gl_Position = posAttrib;
1316  texVarying = texAttrib;
1317  }
1318  ),
1320  uniform sampler2D texSampler;
1321  uniform vec4 colorUniform;
1322  uniform float brightnessUniform;
1323  varying vec2 texVarying;
1324 
1325  void main()
1326  {
1327  vec4 tex = texture2D(texSampler, texVarying);
1328  float alpha = mix(1.0 - max(tex.x, tex.w), tex.y, brightnessUniform);
1329  gl_FragColor = vec4(colorUniform.xyz, colorUniform.w * alpha);
1330  }
1331  ));
1332  setProgram(progId, prog);
1333  }
1334 
1335  // Draw texture.
1336 
1337  prog->use();
1338  setUniform(prog->getUniformLoc("texSampler"), 0);
1339  setUniform(prog->getUniformLoc("colorUniform"), color);
1340  setUniform(prog->getUniformLoc("brightnessUniform"), (color.x + color.y + color.z) * (1.0f / 3.0f));
1341  setAttrib(prog->getAttribLoc("posAttrib"), 4, GL_FLOAT, 0, posAttrib);
1342  setAttrib(prog->getAttribLoc("texAttrib"), 2, GL_FLOAT, 0, texAttrib);
1343  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
1344  resetAttribs();
1345 }
1346 
1347 //------------------------------------------------------------------------
1348 
1349 const Vec2i& GLContext::bindTempTexture(const Vec2i& size)
1350 {
1351  // Round size.
1352 
1353  Vec2i rounded = 1;
1354  while (rounded.x < size.x)
1355  rounded.x *= 2;
1356  while (rounded.y < size.y)
1357  rounded.y *= 2;
1358  if (rounded.x >= 512 * 512 / rounded.y)
1359  rounded = size;
1360 
1361  // No hash => create one.
1362 
1363  if (!s_tempTexHash)
1364  s_tempTexHash = new Hash<Vec2i, TempTexture*>;
1365 
1366  // Exists => move to LRU head and bind.
1367 
1368  TempTexture** found = s_tempTexHash->search(rounded);
1369  if (found)
1370  {
1371  TempTexture* tex = *found;
1372  tex->prev->next = tex->next;
1373  tex->next->prev = tex->prev;
1374  tex->prev = &s_tempTextures;
1375  tex->next = s_tempTextures.next;
1376  tex->prev->next = tex;
1377  tex->next->prev = tex;
1378 
1379  glBindTexture(GL_TEXTURE_2D, tex->handle);
1380  return tex->size;
1381  }
1382 
1383  // Destroy old textures to satisfy FW_MAX_TEMP_TEXTURE_BYTES.
1384 
1385  while (s_tempTexBytes > FW_MAX_TEMP_TEXTURE_BYTES && s_tempTexHash->getSize() > FW_MIN_TEMP_TEXTURES)
1386  {
1387  TempTexture* tex = s_tempTextures.prev;
1388  glDeleteTextures(1, &tex->handle);
1389  tex->prev->next = tex->next;
1390  tex->next->prev = tex->prev;
1391  s_tempTexBytes -= tex->bytes;
1392  s_tempTexHash->remove(tex->size);
1393  delete tex;
1394  }
1395 
1396  // Create new texture.
1397 
1398  TempTexture* tex = new TempTexture;
1399  tex->size = rounded;
1400  tex->bytes = rounded.x * rounded.y * 4;
1401  glGenTextures(1, &tex->handle);
1402  glBindTexture(GL_TEXTURE_2D, tex->handle);
1403  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1404  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1405  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rounded.x, rounded.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
1406 
1407  // Add to LRU and hash.
1408 
1409  tex->prev = &s_tempTextures;
1410  tex->next = s_tempTextures.next;
1411  tex->prev->next = tex;
1412  tex->next->prev = tex;
1413  s_tempTexBytes += tex->bytes;
1414  s_tempTexHash->add(rounded, tex);
1415  return tex->size;
1416 }
1417 
1418 //------------------------------------------------------------------------
1419 
1420 void GLContext::drawTexture(int unit, const Vec4f& posLo, const Vec2f& posHi, const Vec2f& texLo, const Vec2f& texHi)
1421 {
1422  // Setup vertex attributes.
1423 
1424  F32 posAttrib[] =
1425  {
1426  posLo.x, posLo.y, posLo.z, posLo.w,
1427  posHi.x, posLo.y, posLo.z, posLo.w,
1428  posLo.x, posHi.y, posLo.z, posLo.w,
1429  posHi.x, posHi.y, posLo.z, posLo.w,
1430  };
1431 
1432  F32 texAttrib[] =
1433  {
1434  texLo.x, texLo.y,
1435  texHi.x, texLo.y,
1436  texLo.x, texHi.y,
1437  texHi.x, texHi.y,
1438  };
1439 
1440  // Create program.
1441 
1442  static const char* progId = "GLContext::drawTexture";
1443  GLContext::Program* prog = getProgram(progId);
1444  if (!prog)
1445  {
1446  prog = new GLContext::Program(
1448  attribute vec4 posAttrib;
1449  attribute vec2 texAttrib;
1450  varying vec2 texVarying;
1451  void main()
1452  {
1453  gl_Position = posAttrib;
1454  texVarying = texAttrib;
1455  }
1456  ),
1458  uniform sampler2D texSampler;
1459  varying vec2 texVarying;
1460  void main()
1461  {
1462  gl_FragColor = texture2D(texSampler, texVarying);
1463  }
1464  ));
1465  setProgram(progId, prog);
1466  }
1467 
1468  // Draw texture.
1469 
1470  prog->use();
1471  setUniform(prog->getUniformLoc("texSampler"), unit);
1472  setAttrib(prog->getAttribLoc("posAttrib"), 4, GL_FLOAT, 0, posAttrib);
1473  setAttrib(prog->getAttribLoc("texAttrib"), 2, GL_FLOAT, 0, texAttrib);
1474  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
1475  resetAttribs();
1476 }
1477 
1478 //------------------------------------------------------------------------
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int offset
Definition: DLLImports.inl:84
#define NULL
Definition: Defs.hpp:39
FW_CUDA_FUNC Vec2f getXY(void) const
Definition: Math.hpp:364
#define GL_GEOMETRY_VERTICES_OUT_ARB
Definition: DLLImports.hpp:167
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1
Definition: DLLImports.inl:353
const char * getPtr(void) const
Definition: String.hpp:51
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture glBindBuffer
Definition: DLLImports.inl:315
#define WGL_NUMBER_OVERLAYS_ARB
Definition: DLLImports.hpp:234
#define WGL_DRAW_TO_WINDOW_ARB
Definition: DLLImports.hpp:224
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage glCompileShader
Definition: DLLImports.inl:321
Mat4f setVGXform(const Mat4f &m)
Definition: GLContext.hpp:171
void setDefaultFont(void)
Definition: GLContext.hpp:188
#define GL_FUNC_AVAILABLE(NAME)
Definition: DLLImports.hpp:140
static void staticDeinit(void)
Definition: GLContext.cpp:962
int indexOf(char chr) const
Definition: String.hpp:78
#define GL_FRAGMENT_SHADER
Definition: DLLImports.hpp:160
#define GL_VERTEX_SHADER
Definition: DLLImports.hpp:188
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer
Definition: DLLImports.inl:315
#define GL_FUNC_ADD
Definition: DLLImports.hpp:162
#define FW_MAX_TEMP_TEXTURE_BYTES
Definition: GLContext.cpp:38
const StaticFormat * getStaticFormat(void) const
Definition: Image.cpp:102
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean normalized
Definition: DLLImports.inl:365
const char * name
Definition: DLLImports.cpp:42
void swapBuffers(void)
Definition: GLContext.cpp:276
#define FW_S32_MAX
Definition: Defs.hpp:113
#define GL_GEOMETRY_OUTPUT_TYPE_ARB
Definition: DLLImports.hpp:165
void setUniform(int loc, S32 v)
Definition: GLContext.hpp:160
#define WGL_SUPPORT_OPENGL_ARB
Definition: DLLImports.hpp:232
void strokeRect(const Vec4f &pos, const Vec2f &localSize, const Vec2f &screenSize, U32 abgr)
Definition: GLContext.cpp:613
Vec2i drawLabel(const String &str, const Vec4f &pos, const Vec2f &align, U32 fgABGR, U32 bgABGR)
Definition: GLContext.cpp:704
FW_CUDA_FUNC T sqr(const T &a)
Definition: Math.hpp:113
#define WGL_ALPHA_BITS_ARB
Definition: DLLImports.hpp:219
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z glVertexAttribPointer
Definition: DLLImports.inl:365
U32 toABGR(void) const
Definition: Math.cpp:45
static void checkErrors(void)
Definition: GLContext.cpp:1003
void failWin32Error(const char *funcName)
Definition: Defs.cpp:345
#define WGL_TYPE_RGBA_ARB
Definition: DLLImports.hpp:233
#define GL_ARRAY_BUFFER
Definition: DLLImports.hpp:152
FW_CUDA_FUNC F32 floor(F32 a)
Definition: Math.hpp:59
static FW_CUDA_FUNC S scale(const VectorBase< T, L-1, V > &v)
void setProgram(const String &id, Program *prog)
Definition: GLContext.cpp:875
S64 getSize(void) const
Definition: Buffer.hpp:69
void drawBuffer(Buffer &buffer, GLenum mode, int offset, U32 abgr)
Definition: GLContext.cpp:479
const U8 * getPtr(const Vec2i &pos=0) const
Definition: Image.hpp:150
#define GL_ELEMENT_ARRAY_BUFFER
Definition: DLLImports.hpp:159
Vec2i getStringSize(const String &str)
Definition: GLContext.cpp:674
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask GLuint GLenum GLuint mask GLsizei GLenum const GLvoid GLuint GLenum GLuint GLenum const GLfloat transformValues GLenum func GLenum GLenum GLint const GLfloat coeffs GLuint GLenum coverMode GLsizei GLenum const GLvoid GLuint GLenum GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLubyte commands GLuint GLfloat dashArray GLbitfield GLuint GLsizei GLsizei GLfloat metrics GLenum GLenum GLint value GLenum GLenum GLint value GLuint GLuint GLfloat GLfloat y GLuint GLsizei GLsizei numSegments wglChoosePixelFormatARB
Definition: DLLImports.inl:437
ID getGLFormat(void) const
Definition: Image.cpp:184
const U8 * getPtr(S64 ofs=0)
Definition: Buffer.hpp:106
GLContext(HDC hdc, const Config &config=Config())
Definition: GLContext.cpp:210
#define WGL_GREEN_BITS_ARB
Definition: DLLImports.hpp:226
#define WGL_DOUBLE_BUFFER_ARB
Definition: DLLImports.hpp:223
FW_CUDA_FUNC Vec2f perpendicular(void) const
Definition: Math.hpp:315
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat x
Definition: DLLImports.inl:363
static void linkGLProgram(GLuint prog)
Definition: GLContext.cpp:138
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers glDisableVertexAttribArray
Definition: DLLImports.inl:329
void drawColorBuffer(Buffer &buffer, Buffer &color, GLenum mode, int offset)
Definition: GLContext.cpp:558
void initGLImports(void)
Definition: DLLImports.cpp:122
#define WGL_AUX_BUFFERS_ARB
Definition: DLLImports.hpp:220
#define WGL_NUMBER_UNDERLAYS_ARB
Definition: DLLImports.hpp:235
U32 getHints(void) const
Definition: Buffer.hpp:70
GLint getUniformLoc(const String &name) const
Definition: GLContext.cpp:95
void drawImage(const Image &image, const Vec4f &pos, const Vec2f &align, bool topToBottom=true)
Definition: GLContext.cpp:808
float F32
Definition: Defs.hpp:89
#define WGL_DEPTH_BITS_ARB
Definition: DLLImports.hpp:222
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask GLuint GLenum GLuint mask GLsizei GLenum const GLvoid GLuint GLenum GLuint GLenum const GLfloat transformValues GLenum func GLenum GLenum GLint const GLfloat coeffs GLuint GLenum coverMode GLsizei GLenum const GLvoid GLuint GLenum GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLubyte commands GLuint GLfloat dashArray GLbitfield GLuint GLsizei GLsizei GLfloat metrics GLenum GLenum GLint value GLenum GLenum GLint value GLuint GLuint GLfloat GLfloat y GLuint GLsizei GLsizei numSegments HDC const int const FLOAT UINT int UINT nNumFormats wglGetPixelFormatAttribivARB
Definition: DLLImports.inl:439
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat y
Definition: DLLImports.inl:363
Program * getProgram(const String &id) const
Definition: GLContext.cpp:867
#define GL_LINK_STATUS
Definition: DLLImports.hpp:170
const T & getLast(void) const
static FW_CUDA_FUNC S translate(const VectorBase< T, L-1, V > &v)
int main(int argc, char *argv[])
Definition: Main.cpp:51
#define WGL_ACCUM_BITS_ARB
Definition: DLLImports.hpp:218
static GLuint createGLShader(GLenum type, const String &typeStr, const String &source)
Definition: GLContext.cpp:109
GLint getAttribLoc(const String &name) const
Definition: GLContext.cpp:88
void setAttrib(int loc, int size, GLenum type, int stride, Buffer *buffer, const void *pointer)
Definition: GLContext.cpp:310
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask GLuint GLenum GLuint mask GLsizei GLenum const GLvoid GLuint GLenum GLuint GLenum const GLfloat transformValues GLenum func GLenum GLenum GLint const GLfloat coeffs GLuint GLenum coverMode GLsizei GLenum const GLvoid GLuint GLenum GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLubyte commands GLuint GLfloat dashArray GLbitfield GLuint GLsizei GLsizei GLfloat metrics GLenum GLenum GLint value GLenum GLenum GLint value GLuint GLuint GLfloat GLfloat y GLuint GLsizei GLsizei numSegments HDC hdc
Definition: DLLImports.inl:437
#define WGL_STEREO_ARB
Definition: DLLImports.hpp:231
FW_CUDA_FUNC T min(const VectorBase< T, L, S > &v)
Definition: Math.hpp:461
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param glGetShaderiv
Definition: DLLImports.inl:343
FW_CUDA_FUNC T max(const VectorBase< T, L, S > &v)
Definition: Math.hpp:462
void setFont(const String &name, int size, U32 style)
Definition: GLContext.cpp:645
FW_CUDA_FUNC S32 abs(S32 a)
Definition: Math.hpp:41
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value glUseProgram
Definition: DLLImports.inl:361
#define FW_MIN_TEMP_TEXTURES
Definition: GLContext.cpp:37
#define FW_ASSERT(X)
Definition: Defs.hpp:67
signed int S32
Definition: Defs.hpp:88
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid * pointer
Definition: DLLImports.inl:365
int getLength(void) const
Definition: String.hpp:49
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat v0
Definition: DLLImports.inl:353
FW_CUDA_FUNC S inverted(void) const
Definition: Math.hpp:964
#define GL_INVALID_FRAMEBUFFER_OPERATION
Definition: DLLImports.hpp:169
void resetAttribs(void)
Definition: GLContext.cpp:323
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader glCreateShader
Definition: DLLImports.inl:323
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param glLinkProgram
Definition: DLLImports.inl:345
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data glGetProgramiv
Definition: DLLImports.inl:341
unsigned int U32
Definition: Defs.hpp:85
Buffer & getBuffer(void) const
Definition: Image.hpp:148
#define GL_GEOMETRY_INPUT_TYPE_ARB
Definition: DLLImports.hpp:164
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v glEnableVertexAttribArray
Definition: DLLImports.inl:331
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei stride
Definition: DLLImports.inl:365
Vec2i drawString(const String &str, const Vec4f &pos, const Vec2f &align, U32 abgr)
Definition: GLContext.hpp:192
const Vec2i & getSize(void) const
Definition: Image.hpp:143
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction f
Definition: DLLImports.inl:88
#define GL_GEOMETRY_SHADER_ARB
Definition: DLLImports.hpp:166
Mat4f xformMouseToUser(const Mat4f &userToClip) const
Definition: GLContext.cpp:298
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value
Definition: DLLImports.inl:84
void setView(const Vec2i &pos, const Vec2i &size)
Definition: GLContext.cpp:287
#define GL_INFO_LOG_LENGTH
Definition: DLLImports.hpp:168
const ImageFormat & getFormat(void) const
Definition: Image.hpp:144
S64 getStride(void) const
Definition: Image.hpp:146
Module getOwner(void) const
Definition: Buffer.hpp:103
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: DLLImports.inl:349
#define FW_ARRAY_SIZE(X)
Definition: Defs.hpp:79
#define WGL_FULL_ACCELERATION_ARB
Definition: DLLImports.hpp:225
unsigned char U8
Definition: Defs.hpp:83
static HWND createHWND(void)
Definition: Window.cpp:550
FW_CUDA_FUNC const Vector< T, L > & getCol(int c) const
Definition: Math.hpp:528
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device glActiveTexture
Definition: DLLImports.inl:313
FW_CUDA_FUNC S normalized(T len=(T) 1) const
Definition: Math.hpp:144
void drawBox(const Vec3f &min, const Vec3f &max, U32 abgr)
Definition: GLContext.cpp:383
void split(char chr, Array< String > &pieces, bool includeEmpty=false) const
Definition: String.cpp:157
static Vec4f fromABGR(U32 abgr)
Definition: Math.cpp:34
FW_CUDA_FUNC void swap(T &a, T &b)
Definition: Defs.hpp:183
#define WGL_SAMPLES_ARB
Definition: DLLImports.hpp:229
Program(const String &vertexSource, const String &fragmentSource)
Definition: GLContext.cpp:61
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers glGetAttribLocation
Definition: DLLImports.inl:337
GLuint getGLBuffer(void)
Definition: Buffer.hpp:107
#define FW_GL_SHADER_SOURCE(CODE)
Definition: GLContext.hpp:43
#define WGL_ACCELERATION_ARB
Definition: DLLImports.hpp:217
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type
Definition: DLLImports.inl:323
#define WGL_STENCIL_BITS_ARB
Definition: DLLImports.hpp:230
void strokeLine(const Vec4f &p0, const Vec4f &p1, U32 abgr)
Definition: GLContext.cpp:333
const T * getPtr(S idx=0) const
Definition: Array.hpp:202
void fail(const char *fmt,...)
Definition: Defs.cpp:304
#define WGL_BLUE_BITS_ARB
Definition: DLLImports.hpp:221
~GLContext(void)
Definition: GLContext.cpp:245
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void * image
Definition: DLLImports.inl:60
#define GL_TEXTURE0
Definition: DLLImports.hpp:180
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr size
Definition: DLLImports.inl:319
#define GL_COMPILE_STATUS
Definition: DLLImports.hpp:157
static void staticInit(void)
Definition: GLContext.cpp:894
int getBPP(void) const
Definition: Image.cpp:111
S32 getSize(void) const
FW_CUDA_FUNC T min(void) const
Definition: Math.hpp:146
#define GL_PIXEL_UNPACK_BUFFER
Definition: DLLImports.hpp:172
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint color
Definition: DLLImports.inl:367
#define WGL_RED_BITS_ARB
Definition: DLLImports.hpp:228
#define WGL_PIXEL_TYPE_ARB
Definition: DLLImports.hpp:227
void drawModalMessage(const String &msg)
Definition: GLContext.cpp:786
void makeCurrent(void)
Definition: GLContext.cpp:260
void fillRect(const Vec4f &pos, const Vec2f &localSize, const Vec2f &screenSize, U32 abgr)
Definition: GLContext.cpp:357
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader
Definition: DLLImports.inl:321