The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

700 lines
22KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. BEGIN_JUCE_NAMESPACE
  19. //==============================================================================
  20. void OpenGLHelpers::resetErrorState()
  21. {
  22. while (glGetError() != GL_NO_ERROR) {}
  23. }
  24. void* OpenGLHelpers::getExtensionFunction (const char* functionName)
  25. {
  26. #if JUCE_WINDOWS
  27. return (void*) wglGetProcAddress (functionName);
  28. #elif JUCE_MAC
  29. static void* handle = dlopen (nullptr, RTLD_LAZY);
  30. return dlsym (handle, functionName);
  31. #elif JUCE_LINUX
  32. return (void*) glXGetProcAddress ((const GLubyte*) functionName);
  33. #endif
  34. }
  35. #if ! JUCE_OPENGL_ES
  36. namespace
  37. {
  38. bool isExtensionSupportedV3 (const char* extensionName)
  39. {
  40. #ifndef GL_NUM_EXTENSIONS
  41. enum { GL_NUM_EXTENSIONS = 0x821d };
  42. #endif
  43. JUCE_DECLARE_GL_EXTENSION_FUNCTION (glGetStringi, const GLubyte*, (GLenum, GLuint))
  44. if (glGetStringi == nullptr)
  45. glGetStringi = (type_glGetStringi) OpenGLHelpers::getExtensionFunction ("glGetStringi");
  46. if (glGetStringi != nullptr)
  47. {
  48. GLint numExtensions = 0;
  49. glGetIntegerv (GL_NUM_EXTENSIONS, &numExtensions);
  50. for (int i = 0; i < numExtensions; ++i)
  51. if (strcmp (extensionName, (const char*) glGetStringi (GL_EXTENSIONS, i)) == 0)
  52. return true;
  53. }
  54. return false;
  55. }
  56. }
  57. #endif
  58. bool OpenGLHelpers::isExtensionSupported (const char* const extensionName)
  59. {
  60. jassert (extensionName != nullptr); // you must supply a genuine string for this.
  61. jassert (isContextActive()); // An OpenGL context will need to be active before calling this.
  62. #if ! JUCE_OPENGL_ES
  63. const GLubyte* version = glGetString (GL_VERSION);
  64. if (version != nullptr && version[0] >= '3')
  65. {
  66. return isExtensionSupportedV3 (extensionName);
  67. }
  68. else
  69. #endif
  70. {
  71. const char* extensions = (const char*) glGetString (GL_EXTENSIONS);
  72. jassert (extensions != nullptr); // Perhaps you didn't activate an OpenGL context before calling this?
  73. for (;;)
  74. {
  75. const char* found = strstr (extensions, extensionName);
  76. if (found == nullptr)
  77. break;
  78. extensions = found + strlen (extensionName);
  79. if (extensions[0] == ' ' || extensions[0] == 0)
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. void OpenGLHelpers::clear (const Colour& colour)
  86. {
  87. glClearColor (colour.getFloatRed(), colour.getFloatGreen(),
  88. colour.getFloatBlue(), colour.getFloatAlpha());
  89. glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  90. }
  91. void OpenGLHelpers::setColour (const Colour& colour)
  92. {
  93. glColor4f (colour.getFloatRed(), colour.getFloatGreen(),
  94. colour.getFloatBlue(), colour.getFloatAlpha());
  95. }
  96. void OpenGLHelpers::prepareFor2D (const int width, const int height)
  97. {
  98. glMatrixMode (GL_PROJECTION);
  99. glLoadIdentity();
  100. #if JUCE_OPENGL_ES
  101. glOrthof (0.0f, (GLfloat) width, 0.0f, (GLfloat) height, 0.0f, 1.0f);
  102. #else
  103. glOrtho (0.0, width, 0.0, height, 0, 1);
  104. #endif
  105. glViewport (0, 0, width, height);
  106. }
  107. void OpenGLHelpers::setPerspective (double fovy, double aspect, double zNear, double zFar)
  108. {
  109. glLoadIdentity();
  110. #if JUCE_OPENGL_ES
  111. const GLfloat ymax = (GLfloat) (zNear * tan (fovy * double_Pi / 360.0));
  112. const GLfloat ymin = -ymax;
  113. glFrustumf (ymin * (GLfloat) aspect, ymax * (GLfloat) aspect, ymin, ymax, (GLfloat) zNear, (GLfloat) zFar);
  114. #else
  115. const double ymax = zNear * tan (fovy * double_Pi / 360.0);
  116. const double ymin = -ymax;
  117. glFrustum (ymin * aspect, ymax * aspect, ymin, ymax, zNear, zFar);
  118. #endif
  119. }
  120. void OpenGLHelpers::applyTransform (const AffineTransform& t)
  121. {
  122. const GLfloat m[] = { t.mat00, t.mat10, 0, 0,
  123. t.mat01, t.mat11, 0, 0,
  124. 0, 0, 1, 0,
  125. t.mat02, t.mat12, 0, 1 };
  126. glMultMatrixf (m);
  127. }
  128. void OpenGLHelpers::enableScissorTest (const Rectangle<int>& clip)
  129. {
  130. glEnable (GL_SCISSOR_TEST);
  131. glScissor (clip.getX(), clip.getY(), clip.getWidth(), clip.getHeight());
  132. }
  133. void OpenGLHelpers::drawQuad2D (float x1, float y1,
  134. float x2, float y2,
  135. float x3, float y3,
  136. float x4, float y4,
  137. const Colour& colour)
  138. {
  139. const GLfloat vertices[] = { x1, y1, x2, y2, x4, y4, x3, y3 };
  140. const GLfloat textureCoords[] = { 0, 0, 1.0f, 0, 0, 1.0f, 1.0f, 1.0f };
  141. setColour (colour);
  142. glEnableClientState (GL_VERTEX_ARRAY);
  143. glVertexPointer (2, GL_FLOAT, 0, vertices);
  144. glEnableClientState (GL_TEXTURE_COORD_ARRAY);
  145. glTexCoordPointer (2, GL_FLOAT, 0, textureCoords);
  146. glDisableClientState (GL_COLOR_ARRAY);
  147. glDisableClientState (GL_NORMAL_ARRAY);
  148. glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
  149. }
  150. void OpenGLHelpers::drawQuad3D (float x1, float y1, float z1,
  151. float x2, float y2, float z2,
  152. float x3, float y3, float z3,
  153. float x4, float y4, float z4,
  154. const Colour& colour)
  155. {
  156. const GLfloat vertices[] = { x1, y1, z1, x2, y2, z2, x4, y4, z4, x3, y3, z3 };
  157. const GLfloat textureCoords[] = { 0, 0, 1.0f, 0, 0, 1.0f, 1.0f, 1.0f };
  158. setColour (colour);
  159. glEnableClientState (GL_VERTEX_ARRAY);
  160. glVertexPointer (3, GL_FLOAT, 0, vertices);
  161. glEnableClientState (GL_TEXTURE_COORD_ARRAY);
  162. glTexCoordPointer (2, GL_FLOAT, 0, textureCoords);
  163. glDisableClientState (GL_COLOR_ARRAY);
  164. glDisableClientState (GL_NORMAL_ARRAY);
  165. glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
  166. }
  167. //==============================================================================
  168. void OpenGLHelpers::fillRectWithColour (const Rectangle<int>& rect, const Colour& colour)
  169. {
  170. glEnableClientState (GL_VERTEX_ARRAY);
  171. glDisableClientState (GL_TEXTURE_COORD_ARRAY);
  172. glDisableClientState (GL_COLOR_ARRAY);
  173. glDisableClientState (GL_NORMAL_ARRAY);
  174. setColour (colour);
  175. fillRect (rect);
  176. }
  177. void OpenGLHelpers::fillRect (const Rectangle<int>& rect)
  178. {
  179. const GLfloat vertices[] = { (GLfloat) rect.getX(), (GLfloat) rect.getY(),
  180. (GLfloat) rect.getRight(), (GLfloat) rect.getY(),
  181. (GLfloat) rect.getX(), (GLfloat) rect.getBottom(),
  182. (GLfloat) rect.getRight(), (GLfloat) rect.getBottom() };
  183. glVertexPointer (2, GL_FLOAT, 0, vertices);
  184. glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
  185. }
  186. //==============================================================================
  187. struct OpenGLEdgeTableRenderer
  188. {
  189. OpenGLEdgeTableRenderer (float r_, float g_, float b_) noexcept
  190. : r (r_), g (g_), b (b_), lastAlpha (-1)
  191. {
  192. }
  193. void draw (const EdgeTable& et)
  194. {
  195. glDisableClientState (GL_TEXTURE_COORD_ARRAY);
  196. glEnableClientState (GL_VERTEX_ARRAY);
  197. glVertexPointer (2, GL_FLOAT, 0, vertices);
  198. et.iterate (*this);
  199. }
  200. void setEdgeTableYPos (const int y) noexcept
  201. {
  202. vertices[1] = vertices[5] = (GLfloat) y;
  203. vertices[3] = vertices[7] = (GLfloat) (y + 1);
  204. }
  205. void handleEdgeTablePixel (const int x, const int alphaLevel) noexcept
  206. {
  207. drawHorizontal (x, 1, alphaLevel);
  208. }
  209. void handleEdgeTablePixelFull (const int x) noexcept
  210. {
  211. drawHorizontal (x, 1, 255);
  212. }
  213. void handleEdgeTableLine (const int x, const int width, const int alphaLevel) noexcept
  214. {
  215. drawHorizontal (x, width, alphaLevel);
  216. }
  217. void handleEdgeTableLineFull (const int x, const int width) noexcept
  218. {
  219. drawHorizontal (x, width, 255);
  220. }
  221. private:
  222. GLfloat vertices[8];
  223. const float r, g, b;
  224. int lastAlpha;
  225. void drawHorizontal (int x, const int w, const int alphaLevel) noexcept
  226. {
  227. vertices[0] = vertices[2] = (GLfloat) x;
  228. vertices[4] = vertices[6] = (GLfloat) (x + w);
  229. if (lastAlpha != alphaLevel)
  230. {
  231. lastAlpha = alphaLevel;
  232. glColor4f (r, g, b, alphaLevel / 255.0f);
  233. }
  234. glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
  235. }
  236. JUCE_DECLARE_NON_COPYABLE (OpenGLEdgeTableRenderer);
  237. };
  238. void OpenGLHelpers::fillEdgeTable (const EdgeTable& edgeTable,
  239. float red, float green, float blue)
  240. {
  241. OpenGLEdgeTableRenderer etr (red, green, blue);
  242. etr.draw (edgeTable);
  243. }
  244. //==============================================================================
  245. // This breaks down a path into a series of horizontal strips of trapezoids..
  246. class TriangulatedPath::TrapezoidedPath
  247. {
  248. public:
  249. TrapezoidedPath (const Path& p, const AffineTransform& transform)
  250. : firstSlice (nullptr),
  251. windingMask (p.isUsingNonZeroWinding() ? -1 : 1)
  252. {
  253. for (PathFlatteningIterator iter (p, transform); iter.next();)
  254. addLine (floatToInt (iter.x1), floatToInt (iter.y1),
  255. floatToInt (iter.x2), floatToInt (iter.y2));
  256. }
  257. ~TrapezoidedPath()
  258. {
  259. for (HorizontalSlice* s = firstSlice; s != nullptr;)
  260. {
  261. const ScopedPointer<HorizontalSlice> deleter (s);
  262. s = s->next;
  263. }
  264. }
  265. template <class Consumer>
  266. void iterate (Consumer& consumer) const
  267. {
  268. for (HorizontalSlice* s = firstSlice; s != nullptr; s = s->next)
  269. s->iterate (consumer, windingMask);
  270. }
  271. private:
  272. void addLine (int x1, int y1, int x2, int y2)
  273. {
  274. int winding = 1;
  275. if (y2 < y1)
  276. {
  277. std::swap (x1, x2);
  278. std::swap (y1, y2);
  279. winding = -1;
  280. }
  281. HorizontalSlice* last = nullptr;
  282. HorizontalSlice* s = firstSlice;
  283. while (y2 > y1)
  284. {
  285. if (s == nullptr)
  286. {
  287. insert (last, new HorizontalSlice (nullptr, x1, y1, x2, y2, winding));
  288. break;
  289. }
  290. if (s->y2 > y1)
  291. {
  292. if (y1 < s->y1)
  293. {
  294. if (y2 <= s->y1)
  295. {
  296. insert (last, new HorizontalSlice (s, x1, y1, x2, y2, winding));
  297. break;
  298. }
  299. else
  300. {
  301. const int newX = x1 + (int) ((s->y1 - y1) * (int64) (x2 - x1) / (y2 - y1));
  302. HorizontalSlice* const newSlice = new HorizontalSlice (s, x1, y1, newX, s->y1, winding);
  303. insert (last, newSlice);
  304. last = newSlice;
  305. x1 = newX;
  306. y1 = s->y1;
  307. continue;
  308. }
  309. }
  310. else if (y1 > s->y1)
  311. {
  312. s->split (y1);
  313. s = s->next;
  314. jassert (s != nullptr);
  315. }
  316. jassert (y1 == s->y1);
  317. if (y2 > s->y2)
  318. {
  319. const int newY = s->y2;
  320. const int newX = x1 + (int) ((newY - y1) * (int64) (x2 - x1) / (y2 - y1));
  321. s->addLine (x1, newX, winding);
  322. x1 = newX;
  323. y1 = newY;
  324. }
  325. else
  326. {
  327. if (y2 < s->y2)
  328. s->split (y2);
  329. jassert (y2 == s->y2);
  330. s->addLine (x1, x2, winding);
  331. break;
  332. }
  333. }
  334. last = s;
  335. s = s->next;
  336. }
  337. }
  338. struct HorizontalSlice
  339. {
  340. HorizontalSlice (const HorizontalSlice& other, HorizontalSlice* const next_, int y1_, int y2_)
  341. : next (next_), y1 (y1_), y2 (y2_), segments (other.segments)
  342. {
  343. }
  344. HorizontalSlice (HorizontalSlice* const next_, int x1, int y1_, int x2, int y2_, int winding)
  345. : next (next_), y1 (y1_), y2 (y2_)
  346. {
  347. jassert (next != this);
  348. jassert (y2 > y1);
  349. segments.ensureStorageAllocated (32);
  350. segments.add (LineSegment (x1, x2, winding));
  351. }
  352. void addLine (const int x1, const int x2, int winding)
  353. {
  354. const int dy = y2 - y1;
  355. for (int i = 0; i < segments.size(); ++i)
  356. {
  357. const LineSegment& l = segments.getReference (i);
  358. const int diff1 = l.x1 - x1;
  359. const int diff2 = l.x2 - x2;
  360. if ((diff1 < 0) == (diff2 > 0))
  361. {
  362. const int dx1 = l.x2 - l.x1;
  363. const int dx2 = x2 - x1;
  364. const int dxDiff = dx2 - dx1;
  365. if (dxDiff != 0)
  366. {
  367. const int intersectionY = (int) ((dy * (int64) diff1) / dxDiff);
  368. if (intersectionY > 0 && intersectionY < dy)
  369. {
  370. const int intersectionX = x1 + (intersectionY * dx2) / dy;
  371. split (intersectionY + y1);
  372. next->addLine (intersectionX, x2, winding);
  373. addLine (x1, intersectionX, winding);
  374. return;
  375. }
  376. }
  377. }
  378. if (diff1 + diff2 > 0)
  379. {
  380. segments.insert (i, LineSegment (x1, x2, winding));
  381. return;
  382. }
  383. }
  384. segments.add (LineSegment (x1, x2, winding));
  385. }
  386. void split (const int newY)
  387. {
  388. jassert (newY > y1 && newY < y2);
  389. const int dy1 = newY - y1;
  390. const int dy2 = y2 - y1;
  391. next = new HorizontalSlice (*this, next, newY, y2);
  392. y2 = newY;
  393. LineSegment* const oldSegments = segments.getRawDataPointer();
  394. LineSegment* const newSegments = next->segments.getRawDataPointer();
  395. for (int i = 0; i < segments.size(); ++i)
  396. {
  397. LineSegment& l = oldSegments[i];
  398. const int newX = l.x1 + (int) (dy1 * (int64) (l.x2 - l.x1) / dy2);
  399. newSegments[i].x1 = newX;
  400. l.x2 = newX;
  401. }
  402. }
  403. template <class Consumer>
  404. void iterate (Consumer& consumer, const int windingMask)
  405. {
  406. jassert (segments.size() > 0);
  407. const float fy1 = intToFloat (y1);
  408. const float fy2 = intToFloat (y2);
  409. const LineSegment* s1 = segments.getRawDataPointer();
  410. const LineSegment* s2 = s1;
  411. int winding = s1->winding;
  412. for (int i = segments.size(); --i > 0;)
  413. {
  414. ++s2;
  415. winding += s2->winding;
  416. if ((winding & windingMask) == 0)
  417. {
  418. const float ax1 = intToFloat (s1->x1);
  419. const float ax2 = intToFloat (s1->x2);
  420. if (s1->x1 == s2->x1)
  421. consumer.addTriangle (ax1, fy1, ax2, fy2, intToFloat (s2->x2), fy2);
  422. else if (s1->x2 == s2->x2)
  423. consumer.addTriangle (ax1, fy1, intToFloat (s2->x1), fy1, ax2, fy2);
  424. else
  425. consumer.addTrapezoid (fy1, fy2, ax1, ax2, intToFloat (s2->x1), intToFloat (s2->x2));
  426. s1 = s2 + 1;
  427. }
  428. }
  429. }
  430. HorizontalSlice* next;
  431. int y1, y2;
  432. private:
  433. struct LineSegment
  434. {
  435. inline LineSegment (int x1_, int x2_, int winding_) noexcept
  436. : x1 (x1_), x2 (x2_), winding (winding_) {}
  437. int x1, x2;
  438. int winding;
  439. };
  440. Array<LineSegment> segments;
  441. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HorizontalSlice);
  442. };
  443. HorizontalSlice* firstSlice;
  444. const int windingMask;
  445. inline void insert (HorizontalSlice* const last, HorizontalSlice* const newOne) noexcept
  446. {
  447. if (last == nullptr)
  448. firstSlice = newOne;
  449. else
  450. last->next = newOne;
  451. }
  452. enum { factor = 128 };
  453. static inline int floatToInt (const float n) noexcept { return roundToInt (n * (float) factor); }
  454. static inline float intToFloat (const int n) noexcept { return n * (1.0f / (float) factor); }
  455. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TrapezoidedPath);
  456. };
  457. //==============================================================================
  458. struct TriangulatedPath::TriangleBlock
  459. {
  460. TriangleBlock() noexcept
  461. : numVertices (0),
  462. triangles (maxVerticesPerBlock)
  463. {}
  464. void draw() const
  465. {
  466. glVertexPointer (2, GL_FLOAT, 0, triangles);
  467. glDrawArrays (GL_TRIANGLES, 0, numVertices / 2);
  468. }
  469. inline GLfloat* getNextTriangle() noexcept { return triangles + numVertices; }
  470. void optimiseStorage() { triangles.realloc (numVertices); }
  471. // Some GL implementations can't take very large triangle lists, so store
  472. // the list as a series of blocks containing this max number of triangles.
  473. enum { maxVerticesPerBlock = 256 * 6 };
  474. unsigned int numVertices;
  475. HeapBlock<GLfloat> triangles;
  476. };
  477. TriangulatedPath::TriangulatedPath (const Path& path, const AffineTransform& transform)
  478. {
  479. startNewBlock();
  480. TrapezoidedPath (path, transform).iterate (*this);
  481. }
  482. TriangulatedPath::~TriangulatedPath() {}
  483. void TriangulatedPath::draw (const int oversamplingLevel) const
  484. {
  485. glColor4f (1.0f, 1.0f, 1.0f, 1.0f / (oversamplingLevel * oversamplingLevel));
  486. glPushMatrix();
  487. glTranslatef (-0.5f, -0.5f, 0.0f);
  488. const float inc = 1.0f / oversamplingLevel;
  489. for (int y = oversamplingLevel; --y >= 0;)
  490. {
  491. for (int x = oversamplingLevel; --x >= 0;)
  492. {
  493. glTranslatef (inc, 0.0f, 0.0f);
  494. for (int i = 0; i < blocks.size(); ++i)
  495. blocks.getUnchecked(i)->draw();
  496. }
  497. glTranslatef (-1.0f, inc, 0.0f);
  498. }
  499. glPopMatrix();
  500. }
  501. void TriangulatedPath::optimiseStorage()
  502. {
  503. currentBlock->optimiseStorage();
  504. }
  505. void TriangulatedPath::startNewBlock()
  506. {
  507. currentBlock = new TriangleBlock();
  508. blocks.add (currentBlock);
  509. }
  510. void TriangulatedPath::addTriangle (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, GLfloat x3, GLfloat y3)
  511. {
  512. if (currentBlock->numVertices >= TriangleBlock::maxVerticesPerBlock)
  513. startNewBlock();
  514. GLfloat* t = currentBlock->getNextTriangle();
  515. *t++ = x1; *t++ = y1; *t++ = x2; *t++ = y2; *t++ = x3; *t++ = y3;
  516. currentBlock->numVertices += 6;
  517. }
  518. void TriangulatedPath::addTrapezoid (GLfloat y1, GLfloat y2, GLfloat x1, GLfloat x2, GLfloat x3, GLfloat x4)
  519. {
  520. if (currentBlock->numVertices >= TriangleBlock::maxVerticesPerBlock - 6)
  521. startNewBlock();
  522. GLfloat* t = currentBlock->getNextTriangle();
  523. *t++ = x1; *t++ = y1; *t++ = x2; *t++ = y2; *t++ = x3; *t++ = y1;
  524. *t++ = x4; *t++ = y2; *t++ = x2; *t++ = y2; *t++ = x3; *t++ = y1;
  525. currentBlock->numVertices += 12;
  526. }
  527. //==============================================================================
  528. OpenGLTextureFromImage::OpenGLTextureFromImage (const Image& image)
  529. : width (image.getWidth()),
  530. height (image.getHeight())
  531. {
  532. OpenGLFrameBufferImage* glImage = dynamic_cast <OpenGLFrameBufferImage*> (image.getSharedImage());
  533. if (glImage != nullptr)
  534. {
  535. textureID = glImage->frameBuffer.getTextureID();
  536. }
  537. else
  538. {
  539. if (OpenGLTexture::isValidSize (width, height))
  540. {
  541. texture = new OpenGLTexture();
  542. texture->load (image);
  543. textureID = texture->getTextureID();
  544. }
  545. else
  546. {
  547. frameBuffer = new OpenGLFrameBuffer();
  548. frameBuffer->initialise (image);
  549. textureID = frameBuffer->getTextureID();
  550. }
  551. }
  552. }
  553. OpenGLTextureFromImage::~OpenGLTextureFromImage() {}
  554. //==============================================================================
  555. OpenGLRenderingTarget::OpenGLRenderingTarget() {}
  556. OpenGLRenderingTarget::~OpenGLRenderingTarget() {}
  557. void OpenGLRenderingTarget::prepareFor2D()
  558. {
  559. OpenGLHelpers::prepareFor2D (getRenderingTargetWidth(),
  560. getRenderingTargetHeight());
  561. }
  562. END_JUCE_NAMESPACE