Loading...
Searching...
No Matches
OpenGL Rendering
Prev Tutorial: Render vector graphics and manipulate the framebuffer
Next Tutorial: Font rendering
Original author | Amir Hassan (kallaballa) amir@.nosp@m.viel.nosp@m.-zu.o.nosp@m.rg |
Compatibility | OpenCV >= 4.7 |
Render a blue screen using OpenGL
This example simply paints the screen blue using OpenGL without shaders for brevity. One important detail of this example is that states are being preserved between invocations of a context type (in this case the gl
context).
Downloading...
#include <opencv2/v4d/v4d.hpp>
using namespace cv;
using namespace cv::v4d;
public:
win->gl([]() {
//Sets the clear color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
});
}
win->gl([]() {
//Clears the screen. The clear color and other GL-states are preserved between context-calls.
glClear(GL_COLOR_BUFFER_BIT);
});
}
};
int main() {
Ptr<V4D> window = V4D::make(960, 960, "GL Blue Screen");
window->run<RenderOpenGLPlan>(0);
}
Definition: v4d.hpp:68
Definition: backend.hpp:15
"black box" representation of the file storage associated with a file on disk.
Definition: core.hpp:106