From 3e7ba806a23dfd3d75f9cc156df9229f237f5d04 Mon Sep 17 00:00:00 2001 From: Tom Gall Date: Mon, 6 Oct 2014 17:08:43 -0500 Subject: to esContext, hold references for RIEGL objects such as Display, Surface and Context to EGLAddOn.cpp, sort out and add init routine to setup and string together various background objects that the reference implementation needs in order to render to a buffer space. to tests/font/main.c, add an Update function and change to use the drawn into OpenVG buffer that we've read back. font renders to the screen now but the pixels aren't interpreted quite right. On the right track tho. --- src/vg/EGLAddOn.cpp | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'src/vg/EGLAddOn.cpp') diff --git a/src/vg/EGLAddOn.cpp b/src/vg/EGLAddOn.cpp index e8da666..f8d25bc 100644 --- a/src/vg/EGLAddOn.cpp +++ b/src/vg/EGLAddOn.cpp @@ -306,7 +306,9 @@ public: int getNumConfigs() const { return EGL_NUMCONFIGS; } const RIEGLConfig& getConfig(int i) const { RI_ASSERT(i >= 0 && i < EGL_NUMCONFIGS); return m_configs[i]; } - const RIEGLConfig& getConfig(const EGLConfig config) const { for(int i=0;igetThread(); - tgOpenVG::VGContext* vgctx = NULL; - RIEGLContext* c = NULL; + if (!thread) { + thread = RI_NEW(RIEGLThread, (OSGetCurrentThreadID() )); + } + + /* sane defaults */ + int colorSpace = EGL_VG_COLORSPACE_sRGB; + int alphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE; + tgOpenVG::VGContext* vgctx = NULL; try { vgctx = RI_NEW(tgOpenVG::VGContext, (NULL)); //throws bad_alloc - c = RI_NEW(RIEGLContext, (vgctx, esContext->eglConfig)); //throws bad_alloc + riC = RI_NEW(RIEGLContext, (vgctx, esContext->eglConfig)); //throws bad_alloc + esContext->vgContext = vgctx; + riD=RI_NEW(RIEGLDisplay, (esContext->eglDisplay)); + riD->addContext(riC); + + d = RI_NEW(Drawable, (riD->getConfig(esContext->eglConfig).configToDescriptor((colorSpace == EGL_VG_COLORSPACE_LINEAR) ? false : true, (alphaFormat == EGL_VG_ALPHA_FORMAT_PRE) ? true : false), esContext->width, esContext->height, riD->getConfig(esContext->eglConfig).m_samples, riD->getConfig(esContext->eglConfig).m_maskBits)); + + riSurfaceDraw=RI_NEW(RIEGLSurface, (esContext->eglContext, esContext->eglConfig, d, false , EGL_BACK_BUFFER)); + riD->addSurface(riSurfaceDraw); + + thread->makeCurrent(riC, riSurfaceDraw); + riC->getVGContext()->setDefaultDrawable(riSurfaceDraw->getDrawable()); + + egl->addCurrentThread(thread); } catch (std::bad_alloc) { } + + riC->addReference(); + riSurfaceDraw->addReference(); + esContext->rieglSurface=riSurfaceDraw; + esContext->rieglDisplay=riD; + esContext->rieglContext=riC; } -- cgit v1.2.3