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

How to run skja without jogl or lwjgl? #53

Open
dariodariodario opened this issue Nov 18, 2020 · 9 comments
Open

How to run skja without jogl or lwjgl? #53

dariodariodario opened this issue Nov 18, 2020 · 9 comments

Comments

@dariodariodario
Copy link

Hello,
i was wondering if it possible to have the examples run in desktop without the aid of lwjgl or jogl. Any other dependency free way to do that?

@tonsky
Copy link
Collaborator

tonsky commented Nov 18, 2020

Well, the trick is, you need to create a window and initialize OpenGL some way. LWJGL is a bit of overkill, in terms that it provides whole OpenGL for you, and you only need to create a context. Guys in https://github.com/jetbrains/skiko have AWT integration, but it’s not avaliable as a standalone library. Another pointer is Winit/Glutin (Rust libraries that do exactly that: Window and OpenGL context init). Hope this helps :)

@dariodariodario
Copy link
Author

so is opengl a mandatory requirement to draw in a window?

@tonsky
Copy link
Collaborator

tonsky commented Nov 18, 2020

Well, Skia works best when rendering to OpenGL, Metal or Vulkan contexts. So you need one of these.

It can render to bitmap (software renderer), and in theory you can show those bitmaps any way you want, but I am not sure about the performance of this solution.

@dariodariodario
Copy link
Author

dariodariodario commented Nov 18, 2020 via email

@MikOfClassX
Copy link

So basically I could provide a current GL context (i.e. FBO) and let SKIJA do the rendering ?

@tonsky
Copy link
Collaborator

tonsky commented Nov 18, 2020

Interesting so Chrome uses opengl as a backend and flutter too?

Yes, as far as I know

So basically I could provide a current GL context (i.e. FBO) and let SKIJA do the rendering ?

Something like that (sorry, I am not a graphical programmer, I might mix some terms, but this is how I understand it).

See

surface = Surface.makeFromBackendRenderTarget(context, renderTarget, SurfaceOrigin.BOTTOM_LEFT, SurfaceColorFormat.RGBA_8888, ColorSpace.getDisplayP3()); // TODO load monitor profile

and

https://github.com/google/skia/blob/59bafeeaa7de9eb753e3778c414e01dcf013dcd8/include/core/SkSurface.h#L218-L250

@Solido
Copy link
Contributor

Solido commented Jan 5, 2021

Just to complete this even by using software render I need access to a graphical context.
Program can be launch and rendered without window from intelliJ but will crash when launched from a console.
Not sure if it possible to render from a server side which was my original goal !

@tonsky
Copy link
Collaborator

tonsky commented Jan 6, 2021

@Solido what about examples/bitmap? Does that crashes for you too?

@Solido
Copy link
Contributor

Solido commented Jan 6, 2021

Yes launching shadow jar from ITerm lead to

Unhandled exception
Type=Segmentation error vmState=0x00040000
J9Generic_Signal_Number=00000018 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000001
Handler1=000000000A895340 Handler2=0000000006668C80 InaccessibleAddress=0000000000000000
RDI=000000000C980A00 RSI=0000000000000000 RAX=0000000000000404 RBX=0000000000000000
RCX=0000000000000410 RDX=0000000000000000 R8=0000000000000000 R9=0000000000099454
R10=00007FA11700E058 R11=00000000476D1344 R12=0000000000000000 R13=0000000000000000
R14=000000000C980A00 R15=0000000000000000
RIP=000000000A89DDE0 GS=0000 FS=0000 RSP=000070000957DE00
RFlags=0000000000010246 CS=002B RBP=000070000957DEA0 ERR=0000000000000004
TRAPNO=000000040000000E CPU=0000000000040000 FAULTVADDR=0000000000000000
XMM0 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM1 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM2 000e1781000e1781 (f: 923521.000000, d: 1.959708e-308)
XMM3 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM4 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM5 0000000000170000 (f: 1507328.000000, d: 7.447190e-318)
XMM6 3fc29552f81ff523 (f: 4162843904.000000, d: 1.451820e-01)
XMM7 402e7f9c1e980fa9 (f: 513281952.000000, d: 1.524924e+01)
XMM8 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM9 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM10 0000000000000006 (f: 6.000000, d: 2.964394e-323)
XMM11 0000000000000008 (f: 8.000000, d: 3.952525e-323)
XMM12 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM13 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM14 0000000000000000 (f: 0.000000, d: 0.000000e+00)
XMM15 0000000000000000 (f: 0.000000, d: 0.000000e+00)

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

4 participants