MCPcopy Create free account
hub / github.com/DISTRHO/DPF / drawOpenGLImage

Function drawOpenGLImage

dgl/src/OpenGL2.cpp:363–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363static void drawOpenGLImage(const OpenGLImage& image, const Point<int>& pos, const GLuint textureId, bool& setupCalled)
364{
365 if (textureId == 0 || image.isInvalid())
366 return;
367
368 if (! setupCalled)
369 {
370 setupOpenGLImage(image, textureId);
371 setupCalled = true;
372 }
373
374 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
375
376 glEnable(GL_TEXTURE_2D);
377 glBindTexture(GL_TEXTURE_2D, textureId);
378
379 glBegin(GL_QUADS);
380
381 {
382 const int x = pos.getX();
383 const int y = pos.getY();
384 const int w = static_cast<int>(image.getWidth());
385 const int h = static_cast<int>(image.getHeight());
386
387 glTexCoord2f(0.0f, 0.0f);
388 glVertex2d(x, y);
389
390 glTexCoord2f(1.0f, 0.0f);
391 glVertex2d(x+w, y);
392
393 glTexCoord2f(1.0f, 1.0f);
394 glVertex2d(x+w, y+h);
395
396 glTexCoord2f(0.0f, 1.0f);
397 glVertex2d(x, y+h);
398 }
399
400 glEnd();
401
402 glBindTexture(GL_TEXTURE_2D, 0);
403 glDisable(GL_TEXTURE_2D);
404}
405
406void OpenGLImage::drawAt(const GraphicsContext&, const Point<int>& pos)
407{

Callers 2

drawAtMethod · 0.85
drawMethod · 0.85

Calls 4

setupOpenGLImageFunction · 0.70
isInvalidMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected