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

Rendering system #18

Closed
KeKl opened this issue Jan 14, 2015 · 2 comments
Closed

Rendering system #18

KeKl opened this issue Jan 14, 2015 · 2 comments

Comments

@KeKl
Copy link

KeKl commented Jan 14, 2015

Would it be possible to use also OpenGL as a rendering subsystem?

Which requirements are necessary for the rendering subsystem?

  • Which features should the system have?
  • What is the common denominator?
  • Is there a basic class for the rendering system?
@grokys
Copy link
Member

grokys commented Jan 14, 2015

Short answer: Yes, Cairo supports OpenGL as a backend.

Long answer: A rendering subsystem which uses OpenGL directly could be written but you'd essentially have to rewrite a 2D drawing library like Direct2D or Cairo over the top of it, which is something that I don't think many people would want to do.

As for your points, I'm not sure what you're asking in the first two.

For point 3 - There is no single base class, as there are many facets to the rendering subsystem. The easiest way to see what needs to be implemented currently is to look at the code:

https://github.com/grokys/Perspex/tree/master/Windows/Perspex.Direct2D1
https://github.com/grokys/Perspex/tree/master/Cairo/Perspex.Cairo

But in short:

  • The main interface is IPlatformRenderInterface which is implemented by Direct2D1Platform and CairoPlatform.
  • You need to implement an IRenderer to actually carry out the drawing. The Direct2D and Cairo versions of this are actually sufficiently similar that a common base-class should probably factored out.
  • You then need to implement the platform-specific impls of the various media classes such as DrawingContent, FormattedText, Geometries etc.

This can probably be tidied up to some extent and certainly needs to be documented better.

@amerkoleci
Copy link
Contributor

This is related to #6

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

No branches or pull requests

3 participants