Re: Give A directFB surface to EGL
Albert Freeman <[email protected]>
| Newsgroups | gmane.comp.video.mesa3d.user |
|---|---|
| Message-ID | <CAHD8uZOJ5VqM2uB43vYYRN+DGqTGf1UAzJb1fiZiVcjkEqKG2A@mail.gmail.com> |
On 23 October 2015 at 12:16, 刘涛 <[email protected]> wrote: > I apply the patch to Mesa-10.1.3 and then install to execute "./configure > --prefix=/usr --enable-gles1 --enable-gles2 --enable-gallium-egl > --with-egl-platforms=directfb --with-gallium-drivers=swrast && make && sudo > make install" . Then recompile my program, execute "export > GALLIUM_DRIVER=softpipe" and "export LIBGL_ALWAYS_SOFTWARE=1", then execute > my program, it works, ^_^. Thanks for you advise. > > > > I just got glClear working in a window, although quite a few glitches: #include <EGL/egl.h> #include <directfb.h> #include <GLES2/gl2.h> IDirectFB* _pDFB; IDirectFBDisplayLayer* _pDFBl; IDirectFBSurface* _pDFB_surface; IDirectFBWindow* _pDFBw; EGLSurface eglSurface; int main() { /*1 create Directfb Surface*/ DFBDisplayLayerConfig dlc; DFBSurfaceDescription dsc; DFBWindowDescription dsc_w; DirectFBInit(0, NULL); DirectFBCreate(&_pDFB); //_pDFB->SetCooperativeLevel(_pDFB, DFSCL_FULLSCREEN); memset(&dsc, 0, sizeof(dsc)); memset(&dsc_w, 0, sizeof(dsc_w)); _pDFB->GetDisplayLayer(_pDFB, DLID_PRIMARY, &_pDFBl); //_pDFBl->SetCooperativeLevel(_pDFBl, DLSCL_ADMINISTRATIVE); dsc_w.flags |= DWDESC_POSX | DWDESC_POSY; dsc_w.posx = 0; dsc_w.posy = 0; dsc_w.flags |= DWDESC_WIDTH | DWDESC_HEIGHT; dsc_w.width = 640; dsc_w.height = 480; dsc_w.surface_caps = DSCAPS_FLIPPING | /*DSCAPS_PRIMARY |*/ DSCAPS_GL | DSCAPS_DOUBLE; _pDFBl->CreateWindow(_pDFBl, &dsc_w, &_pDFBw); _pDFBw->GetSurface(_pDFBw, &_pDFB_surface); _pDFBw->SetOpacity(_pDFBw, 0xFF); /* Seems to be quite important */ /*2 create egl surface*/ EGLDisplay eglDisplay = EGL_NO_DISPLAY; EGLint iMajorVersion, iMinorVersion; EGLint configAttribs[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8, EGL_SAMPLES, 0, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLConfig eglConfig = 0; EGLint iConfigs = 0; eglDisplay = eglGetDisplay((EGLNativeDisplayType) /* EGL_DEFAULT_DISPLAY */ DLID_PRIMARY); eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion); eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &iConfigs); eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (EGLNativeWindowType) _pDFB_surface, NULL); EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE }; eglBindAPI(EGL_OPENGL_ES_API); EGLContext eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs); eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); fprintf(stderr, "%x\n", eglSurface); while(1) { static loop = 1; loop *= -1; if (loop == 1) glClearColor(0.0f, 1.0f, 0.0f, 0.0f); else glClearColor(1.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); _pDFB_surface->Flip(_pDFB_surface, NULL, 0); //eglSwapBuffers(eglDisplay, eglSurface); } } _______________________________________________ mesa-users mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-users