ollix / glfc Goto Github PK
View Code? Open in Web Editor NEWA collection of OpenGL filters that can be easily applied to an existing texture.
License: Apache License 2.0
A collection of OpenGL filters that can be easily applied to an existing texture.
License: Apache License 2.0
Hi, I am trying to use glfc on Windows and macOS with NanoVG and OpenGL 3 that is rendering to a framebuffer.
I have converted blur shader to #330 and everything works great on Windows.
On macOS I did set up the correct pixel format for gl3 and everything compiles OK including shaders, and no error is thrown, but can't make it blur the texture. I can see that my GPU is working but it seems that the blurred texture is not painted to the correct destination.
Here is my sample code:
glViewport(0, 0, surface->device_width, surface->device_height);
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &initial_macOS_FBO); // Stash apple FBO
nvgluBindFramebuffer(surface->nvg_surface); // Begin main frame buffer update
nvgBeginFrame(ctx->vg, surface->user_width, surface->user_height, surface->scaling);
///////////
// Drawing something to the framebuffer using the NanoVG
//////////
nvgEndFrame(ctx->vg); // End main frame buffer update
glfc::GaussianBlurFilter filter;
filter.set_sigma(100);
filter.set_blur_radius(100);
filter.Render(surface->nvg_surface->texture, surface->user_width, surface->user_height, surface->scaling);
nvgluBindFramebuffer(nullptr);
nvgBeginFrame(ctx->vg, (float)surface->user_width, (float)surface->user_height, (float)surface->scaling);
NVGpaint img = nvgImagePattern(ctx->vg, 0, 0, (float)surface->user_width, (float)surface->user_height, 0, surface->nvg_surface->image, 1.0f);
nvgSave(ctx->vg);
nvgResetTransform(ctx->vg);
nvgBeginPath(ctx->vg);
nvgRect(ctx->vg, 0, 0, (float)surface->user_width, (float)surface->user_height);
nvgFillPaint(ctx->vg, img);
nvgFill(ctx->vg);
nvgRestore(ctx->vg);
#ifdef OS_MAC
glBindFramebuffer(GL_FRAMEBUFFER, initial_macOS_FBO); // restore apple FBO
#endif
nvgEndFrame(ctx->vg);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.