-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
OpenGL renderer and backend-agnostic graphics subcrate #354
Conversation
It seems to cause considerable glitches when resizing.
native/src/program.rs
Outdated
|
||
/// The type of __messages__ your [`Program`] will produce. | ||
/// | ||
/// [`Application`]: trait.Program.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
little copy paste accident I guess:
Application
-> Program
Love your work!
The new documentation is available at https://iced-docs.now.sh/iced/index.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The iced_native
top level docs still mention window::Backend
which was moved
I think this is ready to be merged! The OpenGL renderer still does not support the Given that the OpenGL renderer isn't feature-complete yet, I have kept |
Currently there is no way to create a glow renderer backend (as it is a |
@draivin Not intentional. I forgot about exposing it 😅 |
Does this PR indicate that iced will slowly move away from using wgpu (and eventually not at all)? |
No, as the description says:
|
Gosh, sorry I missed that, thanks for clarification :) |
Are there any estimates on how hard it is to implement image support for OpenGL renderer? It's the only thing that prevents me from using iced on Raspberry Pi (see #428). With just a couple of shader hacks, everything else works fine. |
@0x7CFE It shouldn't be hard to get a similar implementation to the However, we should try to abstract and move the atlas logic to |
@hecrj is there a tracking issue for Also, could it be that the current master fails to compile with the glow feature? I'm getting lots of errors. |
Seconded. I would create an issue myself, but i feel like the OP of a tracking issue should contain all meaningful information, and it would be much better if you had control over that OP. |
This PR implements an OpenGL renderer on top of
glow
, introduces aglutin
shell, and abstracts a bunch of backend-agnostic rendering logic in a new graphics subcrate.iced_glow
iced_glow
is an OpenGL renderer powered byglow
(GL on Whatever). This renderer is meant to be an alternative (not a replacement!) toiced_wgpu
whilewgpu
and its ecosystem mature.As
iced_glow
uses OpenGL, it should offer us better compatibility, stability, and maintainability for the time being. Furthermore, users that currently have OpenGL-based applications should be able to integrate them directly withiced
.On a related note, my work on this renderer also prompted me to write and open-source
glow_glyph
, a direct port ofwgpu_glyph
forglow
.Please, feel free to give the renderer a try by switching to the
feature/glow-renderer
branch and running any of the examples! Keep in mind thatImage
andSvg
widgets are not supported yet.iced_glutin
iced_glutin
is a shell on top ofglutin
. It can be used to easily initialize OpenGL-based renderers, as it will create and properly configure an OpenGL context for them.Given that
glutin
is built on top ofwinit
itself,iced_winit
andiced_glutin
both share a good amount of logic. However, whileiced_winit
provides araw-window-handle
to initialize the chosen renderer,iced_glutin
provides an OpenGL loader function instead.The work on this crate also introduced a couple of new concepts in
iced_native
that should ease the integration oficed
in existing projects (#313). Specifically, aProgram
trait has been added which can be used together with someprogram::State
to feed events to a user interface and obtain its drawing primitives. Theintegration
example has been updated accordingly to showcase how to use them!iced_graphics
The first draft of
iced_glow
was implemented by copy-pasting a lot of code fromiced_wgpu
. As most of this code was backend-agnostic and shared between renderers, it was abstracted away and moved to an intermediate crate:iced_graphics
.iced_graphics
contains a bunch of backend-agnostic types that can be leveraged to build a renderer. The most important concepts it contains are:Primitive
type fromiced_wgpu
.Layer
type that flattens aPrimitive
tree for rendering.Renderer
trait for all the built-in widgets.Transformation
,Viewport
, a font loader on top offont-kit
, etc.And I think that's about it! I am aware there is a lot to unpack here. Once I finish writing the documentation for all the changes, I will share a link.
As always, any feedback appreciated and feel free to ask any questions!
cargo run --example tour
#98