Ganesh example does not work

94 views
Skip to first unread message

Joel de Guzman

unread,
Aug 19, 2016, 9:10:33 PM8/19/16
to skia-discuss
Hi,

The code in the docs for setting up a Ganesh Surface does not seem to work:


I am getting compile errors with the latest code.

I'm very new to Skia. My intent is to get up and running with the GPU backend. 
I have an NSOpenGLView (OSX Cocoa) set up and I am able to draw OpenGL shapes
in the view (The GL context and all that stuff is already prepared).

Is there an updated tutorial on how to set it up?

Thanks in advance for any help!

--Joel


Matthew Leibowitz

unread,
Aug 20, 2016, 12:16:35 PM8/20/16
to skia-discuss
My OpenGL is a bit (very) rough, but I managed to get it going with this, note the "skia_" methods:

This is to get the default context:

    skiaContext = GrContext::Create(kOpenGL_GrBackend, 0); // default

Then, each time to get the surface: 

GrBackendRenderTargetDesc desc; desc.fWidth = w; desc.fHeight = h; desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fSampleCnt = 1; // may need 0 desc.fStencilBits = 0; desc.fRenderTargetHandle = 0; // deafult skiaSurface = SkSurface::MakeFromBackendRenderTarget(skiaContext, desc, NULL).release(); SkCanvas* skiaCanvas = skiaSurface->getCanvas(); // draw! skiaCanvas->flush();

Matthew Leibowitz

unread,
Aug 20, 2016, 12:17:48 PM8/20/16
to skia-discuss
I will remark that Skia is missing those ultra simple examples showing setup :)


On Saturday, August 20, 2016 at 3:10:33 AM UTC+2, Joel de Guzman wrote:
Reply all
Reply to author
Forward
0 new messages