MCPcopy Create free account
hub / github.com/creatale/node-dv / render

Method render

deps/opencv/modules/core/src/opengl_interop.cpp:1418–1488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1416// Rendering
1417
1418void cv::ogl::render(const ogl::Texture2D& tex, Rect_<double> wndRect, Rect_<double> texRect)
1419{
1420#ifndef HAVE_OPENGL
1421 (void) tex;
1422 (void) wndRect;
1423 (void) texRect;
1424 throw_nogl();
1425#else
1426 if (!tex.empty())
1427 {
1428 gl::MatrixMode(gl::PROJECTION);
1429 gl::LoadIdentity();
1430 gl::Ortho(0.0, 1.0, 1.0, 0.0, -1.0, 1.0);
1431 CV_CheckGlError();
1432
1433 gl::MatrixMode(gl::MODELVIEW);
1434 gl::LoadIdentity();
1435 CV_CheckGlError();
1436
1437 gl::Disable(gl::LIGHTING);
1438 CV_CheckGlError();
1439
1440 tex.bind();
1441
1442 gl::Enable(gl::TEXTURE_2D);
1443 CV_CheckGlError();
1444
1445 gl::TexEnvi(gl::TEXTURE_ENV, gl::TEXTURE_ENV_MODE, gl::REPLACE);
1446 CV_CheckGlError();
1447
1448 gl::TexParameteri(gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR);
1449 CV_CheckGlError();
1450
1451 const float vertex[] =
1452 {
1453 wndRect.x, wndRect.y, 0.0f,
1454 wndRect.x, (wndRect.y + wndRect.height), 0.0f,
1455 wndRect.x + wndRect.width, (wndRect.y + wndRect.height), 0.0f,
1456 wndRect.x + wndRect.width, wndRect.y, 0.0f
1457 };
1458 const float texCoords[] =
1459 {
1460 texRect.x, texRect.y,
1461 texRect.x, texRect.y + texRect.height,
1462 texRect.x + texRect.width, texRect.y + texRect.height,
1463 texRect.x + texRect.width, texRect.y
1464 };
1465
1466 ogl::Buffer::unbind(ogl::Buffer::ARRAY_BUFFER);
1467
1468 gl::EnableClientState(gl::TEXTURE_COORD_ARRAY);
1469 CV_CheckGlError();
1470
1471 gl::TexCoordPointer(2, gl::FLOAT, 0, texCoords);
1472 CV_CheckGlError();
1473
1474 gl::DisableClientState(gl::NORMAL_ARRAY);
1475 gl::DisableClientState(gl::COLOR_ARRAY);

Callers

nothing calls this directly

Calls 11

throw_noglFunction · 0.85
kindMethod · 0.80
getOGlBufferMethod · 0.80
emptyMethod · 0.45
bindMethod · 0.45
sizeMethod · 0.45
depthMethod · 0.45
channelsMethod · 0.45
areaMethod · 0.45
getMatMethod · 0.45
isContinuousMethod · 0.45

Tested by

no test coverage detected