Mercurial > MadButterfly
comparison src/graph_engine_openvg.c @ 630:bd18951b51d5 openvg
Add initial code for graphic engines
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 19 Jul 2010 15:44:49 +0800 |
parents | 608f58b9b84d |
children | e224f496e6b8 |
comparison
equal
deleted
inserted
replaced
629:608f58b9b84d | 630:bd18951b51d5 |
---|---|
472 attrib_list[i++] = EGL_MAX_PBUFFER_WIDTH; | 472 attrib_list[i++] = EGL_MAX_PBUFFER_WIDTH; |
473 attrib_list[i++] = w; | 473 attrib_list[i++] = w; |
474 attrib_list[i++] = EGL_MAX_PBUFFER_HEIGHT; | 474 attrib_list[i++] = EGL_MAX_PBUFFER_HEIGHT; |
475 attrib_list[i++] = h; | 475 attrib_list[i++] = h; |
476 #endif | 476 #endif |
477 | |
478 attrib_list[i++] = EGL_RENDERABLE_TYPE; | |
479 attrib_list[i++] = EGL_OPENVG_BIT; | |
477 | 480 |
478 attrib_list[i++] = EGL_NONE; | 481 attrib_list[i++] = EGL_NONE; |
479 | 482 |
480 display = _VG_DISPLAY(); | 483 display = _VG_DISPLAY(); |
481 r = eglChooseConfig(display, attrib_list, configs, 1, &nconfigs); | 484 r = eglChooseConfig(display, attrib_list, configs, 1, &nconfigs); |
798 ASSERT(r == EGL_TRUE); | 801 ASSERT(r == EGL_TRUE); |
799 | 802 |
800 /* Clear regions to the color specified by mbe_create() */ | 803 /* Clear regions to the color specified by mbe_create() */ |
801 vgClear(0, 0, w, h); | 804 vgClear(0, 0, w, h); |
802 } | 805 } |
806 | |
807 void mbe_init() { | |
808 static EGLContext init_ctx; | |
809 static EGLSurface init_surf; | |
810 EGLDisplay display; | |
811 EGLConfig config; | |
812 EGLint nconfigs; | |
813 EGLint attrib_list[] = { | |
814 EGL_RED_SIZE, 1, | |
815 EGL_GREEN_SIZE, 1, | |
816 EGL_BLUE_SIZE, 1, | |
817 EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT, | |
818 EGL_NONE}; | |
819 EGLint surf_attribs[] = { | |
820 EGL_WIDTH, 1, | |
821 EGL_HEIGHT, 1, | |
822 EGL_NONE}; | |
823 EGLBoolean r; | |
824 | |
825 display = _VG_DISPLAY(); | |
826 eglInitialize(display, NULL, NULL); | |
827 | |
828 r = eglChooseConfig(display, attrib_list, &config, 1, &nconfigs); | |
829 ASSERT(r); | |
830 | |
831 eglBindAPI(EGL_OPENVG_API); | |
832 | |
833 init_ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL); | |
834 ASSERT(init_ctx != EGL_NO_CONTEXT); | |
835 | |
836 init_surf = eglCreatePbufferSurface(display, config, surf_attribs); | |
837 ASSERT(init_surf != EGL_NO_SURFACE); | |
838 | |
839 eglMakeCurrent(display, init_surf, init_surf, init_ctx); | |
840 } | |
841 |