<font color='midnightblue' size='4' face='Georgia, Times New Roman, Times, Serif'><font color="black" size="4">Dear Developers</font><br>
<div style="font-family: arial,helvetica; font-size: 10pt;"><font color="black"></font>
<div id="AOLMsgPart_2_c3deb75a-60fa-496a-b3c2-47ab825b3f30"><font face="Georgia, Times New Roman, Times, Serif" color="black" size="4">
<br>
<font size="4">I tried to use Cairo with EGL and OpenGLESv2 backend </font><font size="4">after compilation the Cairo and writing an application </font><font size="4"><font size="4">with Cairo </font><font size="4"><font size="4">I can't see anything on screen</font> just display back light turned on and after few second turned off again.<br>
<br>
</font>may be my configuration and my program can help to solve my issue.<br>
<br>
my configuration is :<br>
</font><br>
<font size="4"> ./configure --prefix=/home/super/Desktop/ROOTFS/MY_ROOTFS/usr --host=${CROSS_COMPILE} CFLAGS="-I/home/super/Desktop/ROOTFS/MY_ROOTFS/usr/include/ -DLINUX -DEGL_API_FB" LIBS="-L/home/super/Desktop/ROOTFS/MY_ROOTFS/usr/lib/ -lz" --enable-xlib=no --enable-egl --enable-glesv2<br>
<br>
With above configuration Cairo compiled correctly.<br>
<br>
</font><font size="4">My program is :<br>
<br>
</font><br>
<font size="4"><font size="4">//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
</font>//============================================================================<br>
// Name : test_app.cpp<br>
// Author : Ali Sarlak<br>
// Version :<br>
// Copyright : GPL<br>
// Description : EGL+Cairo GLIB<br>
//============================================================================<br>
<br>
#include <iostream><br>
#include <stdio.h><br>
#include <cairo.h><br>
#include <egl.h><br>
#include <EGL/eglext.h><br>
#include <eglplatform.h><br>
#include <cairo-gl.h><br>
#include <stdlib.h><br>
<br>
using namespace std;<br>
<br>
int main()<br>
{<br>
EGLContext eglContext;<br>
EGLSurface eglSurface;<br>
EGLBoolean resultB;<br>
<br>
/* Get a display handle and initalize EGL */<br>
EGLint major, minor;<br>
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);<br>
<br>
printf("egldisplay = %x\n", eglGetError());<br>
<br>
resultB = eglInitialize(display, &major, &minor);<br>
<br>
printf("eglInitialize = %d\n<Major(%d),Minor(%d)>\n", resultB, major,<br>
minor);<br>
<br>
EGLint attributes[] =<br>
{<br>
EGL_RENDERABLE_TYPE,<br>
EGL_OPENGL_ES2_BIT,<br>
EGL_RED_SIZE, 8,<br>
EGL_GREEN_SIZE, 8,<br>
EGL_BLUE_SIZE, 8,<br>
EGL_DEPTH_SIZE, 1,<br>
EGL_NONE };<br>
<br>
EGLint numberConfigs = 0;<br>
EGLConfig* matchingConfigs=NULL;<br>
<br>
if (EGL_FALSE<br>
== eglChooseConfig(display, attributes, NULL, 0, &numberConfigs))<br>
{<br>
printf("eglChooseConfig EROR\n");<br>
}<br>
if (numberConfigs == 0)<br>
{<br>
printf("eglChooseConfig EROR\n");<br>
}<br>
<br>
printf("numberConfigs = %d\n", numberConfigs);<br>
/* Allocate some space to store list of matching configs... */<br>
matchingConfigs = (EGLConfig*) malloc(numberConfigs * sizeof(EGLConfig));<br>
/* ...and this time actually get the list (notice the 3rd argument is<br>
* now the buffer to write matching EGLConfig's to)<br>
*/<br>
<br>
if (EGL_FALSE<br>
== eglChooseConfig(display, attributes, matchingConfigs,<br>
numberConfigs, &numberConfigs))<br>
{<br>
printf("eglChooseConfig EROR\n");<br>
}<br>
<br>
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");<br>
<br>
EGLint attribList[] =<br>
{<br>
EGL_WIDTH, 600,<br>
EGL_HEIGHT, 600,<br>
EGL_LARGEST_PBUFFER, EGL_TRUE,<br>
EGL_NONE };<br>
<br>
eglSurface = eglCreatePbufferSurface(display, matchingConfigs[0],<br>
attribList);<br>
if (eglSurface == EGL_NO_SURFACE)<br>
{<br>
printf("eglSurface = %x\n", eglGetError());<br>
}<br>
<br>
const EGLint attribListCtx[] =<br>
{<br>
// EGL_KHR_create_context is required<br>
EGL_CONTEXT_CLIENT_VERSION, 2,<br>
EGL_NONE };<br>
<br>
eglContext = eglCreateContext(display, matchingConfigs[0], EGL_NO_CONTEXT,<br>
attribListCtx);<br>
<br>
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
if (eglContext == EGL_NO_CONTEXT)<br>
{<br>
printf("eglContext = %x\n", eglGetError());<br>
}<br>
<br>
cairo_device_t* cdt = cairo_egl_device_create(display, eglContext);<br>
<br>
printf("cdt = %x\n", eglGetError());<br>
<br>
eglMakeCurrent(display, eglSurface, eglSurface, eglContext);<br>
<br>
cairo_surface_t *surface = cairo_gl_surface_create_for_egl(cdt, eglSurface,<br>
600, 600);<br>
<br>
// EGL_SUCCESS<br>
printf("surface = %x\n", eglGetError());<br>
<br>
cairo_t *cr = cairo_create(surface);<br>
<br>
//******************************************************************************************************************<br>
cairo_set_source_rgb (cr, 0, 0, 0);<br>
<br>
cairo_move_to (cr, 0, 0);<br>
cairo_line_to (cr, 200, 200);<br>
cairo_move_to (cr, 200, 0);<br>
cairo_line_to (cr, 0, 200);<br>
cairo_set_line_width (cr, 1);<br>
cairo_stroke (cr);<br>
<br>
cairo_rectangle (cr, 0, 0, 100,100);<br>
cairo_set_source_rgba (cr, 1, 0, 0, 0.8);<br>
cairo_fill (cr);<br>
<br>
cairo_rectangle (cr, 0, 100, 100, 100);<br>
cairo_set_source_rgba (cr, 0, 1, 0, 0.60);<br>
cairo_fill (cr);<br>
<br>
cairo_rectangle (cr, 100, 0, 100, 100);<br>
cairo_set_source_rgba (cr, 0, 0, 1, 0.40);<br>
cairo_fill (cr);<br>
<br>
cairo_rectangle (cr, 100, 100, 100, 100);<br>
cairo_set_source_rgba (cr, 1, 1, 0, 0.20);<br>
cairo_fill (cr);<br>
//******************************************************************************************************************<br>
<br>
// cairo_surface_flush(surface);<br>
<br>
// if (eglWaitClient() == EGL_TRUE)<br>
// {<br>
// printf("EGL GET FINISHED!\n");<br>
// }<br>
<br>
//to check that cairo can make the photo from the surface it's OK and png created<br>
cairo_status_t s = cairo_surface_write_to_png(surface, "surface.png");<br>
//it is a photo that made by cairo [OK]<br>
<br>
cairo_destroy(cr);<br>
<br>
if (CAIRO_STATUS_SUCCESS == s)<br>
{<br>
printf("Status = OK \n");<br>
}<br>
else<br>
{<br>
printf("Status = ERROR <ERROR_CODE->%d>\n", s);<br>
}<br>
<br>
if(matchingConfigs!=NULL)<br>
{<br>
free(matchingConfigs);<br>
matchingConfigs=NULL;<br>
}<br>
<br>
cairo_surface_destroy(surface);<br>
printf("END!\n");<br>
return 0;<br>
}<br>
<br>
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
Compiler prefix is :<br>
</font><font size="4"><font size="4"><font size="4">arm-none-linux-gnueabi<br>
<br>
</font></font>Target Device is :<br>
IMX6Q<br>
<br>
Is it possible that there is a bug here in Cairo?or in my configuration or in my application?<br>
Of course I checked my application and replace the Cairo function with </font><font size="4"><font size="4">OpenGLES to saw that my EGL's settings were true </font>and OpenGLES works, I saw something on my screen; but with Cairo no?<br>
<br>
Best Regards:<br>
Ali</font><br>
<div style="font-family: arial,helvetica; font-size: 10pt;">
<div id="AOLMsgPart_1_e130344f-1c38-4614-9bdd-56d0ca306ed7" style="margin: 0px; font-family: Tahoma,Verdana,Arial,sans-serif; font-size: 12px; background-color: rgb(255, 255, 255);">
</div>
</div>
</font>
</div>
</div>
<font color="black">
</font></font>