openframeworks / openframeworks/openFrameworks
Feature : ofPresentWindow()
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
Hey!
I use a feature quite often, where I force glfw to present the window "as is" (e.g. during an update)
generally this involves something like:
glfwSwapBuffers(glfwGetCurrentContext());
glFlush();
This has been relatively stable with OpenGL 2 on Windows and OSX. I had to fiddle a bit when we moved to 0.9.0 (not sure why), but now I've moved Rulr to OpenGL 3.2, I'm having issues again.
For a start, glfwGetCurrentContext now returns NULL (great! how did that happen? :)
But even if I do something like
auto window = ofGetWindowPtr();
auto glfwAppWindow = dynamic_cast<ofAppGLFWWindow*>(window);
if (glfwAppWindow) {
auto glfwWindow = glfwAppWindow->getGLFWWindow();
ofClear(0, 0);
drawText(message, 0, 0, true, ofGetHeight(), ofGetWidth());
glfwMakeContextCurrent(glfwWindow);
glfwSwapBuffers(glfwWindow);
glfwPollEvents();
}
I still don't get the drawing on the screen.
The next frame of the app works fine, but i never see that drawText happen.
I use this feature especially for scanning, where it's important to sync the timing of the drawing and capture, and when using a for loop is much easier than sending the graphics out on separate app frames.
I'm wondering:
- What am I doing wrong this time?
- Could we make this a core feature? (especially as changes to oF core seem to break this usage)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the provided glfwSwapBuffers, glfwMakeContextCurrent, and glfwPollEvents calls through ofAppGLFWWindow, using ofGetWindowPtr() and getGLFWWindow() as entry points. Reproduce the missing immediate drawing with the supplied loop, then define and verify a core API that presents the current window reliably during such a loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100