Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find if accepting external OpenGL context is viable #66

Open
9prady9 opened this issue Dec 22, 2015 · 10 comments
Open

Find if accepting external OpenGL context is viable #66

9prady9 opened this issue Dec 22, 2015 · 10 comments
Milestone

Comments

@9prady9
Copy link
Member

9prady9 commented Dec 22, 2015

Useful topics

@9prady9 9prady9 added this to the 1.0.0 milestone Dec 22, 2015
@9prady9 9prady9 removed this from the 1.0.0 milestone Feb 19, 2016
@9prady9
Copy link
Member Author

9prady9 commented Sep 1, 2016

There are two possible approaches regarding this topic:

  • Find if user created OpenGL context can be used with Forge(glfw/sdl) windows. As of now, some internal state (loading default fonts, color maps etc.) is initialized during window object construction (Window constructor code). The logic in this initialization should be exposed via functions appropriately if external context usage is to be given as an option to the user.
  • Other approach would be to abstract renderable objects such as Image, Chart etc. to be able to render them on user provided OpenGL Window, where forge's window class is not used at all. In this case, just the Image/Chart objects are rendered to which ever viewport is active. The user has to do multiple views in single window by themselves.

@caseymcc
Copy link
Contributor

I have a few questions here. I quickly hacked together an Qt5 window for forge that seems to work,
caseymcc@a78f290

But as far as I could tell from the quick overview it to implement this. forge really doesn't care about the window as long as you don't call the window functions. Seems if you created a Chart and just called render making sure the current openGL context is properly setup it would draw.

Ill add a PR later for the Qt5 window (likely need a little info in the manner of how multiple windows are supposed the be handled), need to split it with the hunter functionality (cmake package manager) that I used.

@9prady9
Copy link
Member Author

9prady9 commented Apr 29, 2017

@caseymcc That is true - forge rendering user's can use their own windowing functionality - that was the intention behind the such design. As you said, the user has to take care of GL context. What do you need to know about multiple windows ?

@caseymcc
Copy link
Contributor

Is it intended that the user can open multiple windows? If so in the the case of Qt5 I could make them dockable, dialogs or or split in the same window.

@9prady9
Copy link
Member Author

9prady9 commented Apr 29, 2017

Yes,we wanted to enable multi-window usage. However, this hasn't been tested extensively. You are welcome to try and report any bugs you may find!

@9prady9 9prady9 added this to the 1.0.4 milestone Nov 17, 2018
@9prady9 9prady9 modified the milestones: 1.0.4, 1.0.5 Mar 2, 2019
@9prady9 9prady9 modified the milestones: 1.0.5, 1.0.6 Apr 8, 2020
@beojan
Copy link

beojan commented Jun 20, 2020

Any updates here? Is it still possible to just draw into the current context without setting up a window?

@9prady9 9prady9 modified the milestones: 1.0.6, 2.0 Jun 20, 2020
@9prady9
Copy link
Member Author

9prady9 commented Jun 20, 2020

@beojan Unfortunately, no, there has been much work done in this direction yet.

Currently, fonts are currently set via window object. Thus this needs to be separated from Window so that the they will work out of the box. So basically, except font rendering rest of the stuff should work fine in a user provided OpenGL context even now.

Because fonts won't work, chart won't make sense. Image object's should render fine though.

@9prady9
Copy link
Member Author

9prady9 commented Jul 8, 2020

@beojan A quick update. I have looked at the code and as of today font object used by Window object is separate from the font object's created for chart's internal use. Thus, even if Window class from forge isn't used, one should be able to still use rendering logic from other classes in a different OpenGL context.

Note that, a valid OpenGL context should be available to use forge's non-Window classes in that fashion. Hope this helps for your use case.

@beojan
Copy link

beojan commented Jul 8, 2020

It appears Chart's render member function still requires a reference to a Window. Is there a dummy Window to be passed?

@9prady9
Copy link
Member Author

9prady9 commented Jul 8, 2020

Ah right, my bad. Window is being passed, although it can easily worked around since the object is only used to get unique window ID that is in turn used for internal book keeping of VAO objects.

If this object of Windows is replaced with a window identifier variable like int, then it should work out of the box. Unfortunately, that would require an API change and can't be done before 2.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants