[prev in list] [next in list] [prev in thread] [next in thread]
List: cairo
Subject: [cairo] Problem with Cairo with openglesv2 backend
From: Ali Sarlak <ali.sarlak () aol ! com>
Date: 2015-04-13 18:02:51
Message-ID: 14cb3f2ba43-2966-1669e () webprd-m08 ! mail ! aol ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Dear Developers
I tried to use Cairo with EGL and OpenGLESv2 backend after compilation the Cairo and \
writing an application with Cairo I can't see anything on display, just display back \
light turned on and after few second turned off again.
may be my configuration and my program can help to solve this issue.
my configuration is :
./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
With above configuration Cairo compiled correctly.
My program is :
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//============================================================================
// Name : test_app.cpp
// Author : Ali Sarlak
// Version :
// Copyright : GPL
// Description : EGL+Cairo GLIB
//============================================================================
#include <iostream>
#include <stdio.h>
#include <cairo.h>
#include <egl.h>
#include <EGL/eglext.h>
#include <eglplatform.h>
#include <cairo-gl.h>
#include <stdlib.h>
using namespace std;
int main()
{
EGLContext eglContext;
EGLSurface eglSurface;
EGLBoolean resultB;
/* Get a display handle and initalize EGL */
EGLint major, minor;
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
printf("egldisplay = %x\n", eglGetError());
resultB = eglInitialize(display, &major, &minor);
printf("eglInitialize = %d\n<Major(%d),Minor(%d)>\n", resultB, major,
minor);
EGLint attributes[] =
{
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES2_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_DEPTH_SIZE, 1,
EGL_NONE };
EGLint numberConfigs = 0;
EGLConfig* matchingConfigs=NULL;
if (EGL_FALSE
== eglChooseConfig(display, attributes, NULL, 0, &numberConfigs))
{
printf("eglChooseConfig EROR\n");
}
if (numberConfigs == 0)
{
printf("eglChooseConfig EROR\n");
}
printf("numberConfigs = %d\n", numberConfigs);
/* Allocate some space to store list of matching configs... */
matchingConfigs = (EGLConfig*) malloc(numberConfigs * sizeof(EGLConfig));
/* ...and this time actually get the list (notice the 3rd argument is
* now the buffer to write matching EGLConfig's to)
*/
if (EGL_FALSE
== eglChooseConfig(display, attributes, matchingConfigs,
numberConfigs, &numberConfigs))
{
printf("eglChooseConfig EROR\n");
}
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
EGLint attribList[] =
{
EGL_WIDTH, 600,
EGL_HEIGHT, 600,
EGL_LARGEST_PBUFFER, EGL_TRUE,
EGL_NONE };
eglSurface = eglCreatePbufferSurface(display, matchingConfigs[0],
attribList);
if (eglSurface == EGL_NO_SURFACE)
{
printf("eglSurface = %x\n", eglGetError());
}
const EGLint attribListCtx[] =
{
// EGL_KHR_create_context is required
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE };
eglContext = eglCreateContext(display, matchingConfigs[0], EGL_NO_CONTEXT,
attribListCtx);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (eglContext == EGL_NO_CONTEXT)
{
printf("eglContext = %x\n", eglGetError());
}
cairo_device_t* cdt = cairo_egl_device_create(display, eglContext);
printf("cdt = %x\n", eglGetError());
eglMakeCurrent(display, eglSurface, eglSurface, eglContext);
cairo_surface_t *surface = cairo_gl_surface_create_for_egl(cdt, eglSurface,
600, 600);
// EGL_SUCCESS
printf("surface = %x\n", eglGetError());
cairo_t *cr = cairo_create(surface);
//******************************************************************************************************************
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, 200, 200);
cairo_move_to (cr, 200, 0);
cairo_line_to (cr, 0, 200);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
cairo_rectangle (cr, 0, 0, 100,100);
cairo_set_source_rgba (cr, 1, 0, 0, 0.8);
cairo_fill (cr);
cairo_rectangle (cr, 0, 100, 100, 100);
cairo_set_source_rgba (cr, 0, 1, 0, 0.60);
cairo_fill (cr);
cairo_rectangle (cr, 100, 0, 100, 100);
cairo_set_source_rgba (cr, 0, 0, 1, 0.40);
cairo_fill (cr);
cairo_rectangle (cr, 100, 100, 100, 100);
cairo_set_source_rgba (cr, 1, 1, 0, 0.20);
cairo_fill (cr);
//******************************************************************************************************************
// cairo_surface_flush(surface);
// if (eglWaitClient() == EGL_TRUE)
// {
// printf("EGL GET FINISHED!\n");
// }
//to check that cairo can make the photo from the surface it's OK and png \
created
cairo_status_t s = cairo_surface_write_to_png(surface, "surface.png");
//it is a photo that made by cairo [OK]
cairo_destroy(cr);
if (CAIRO_STATUS_SUCCESS == s)
{
printf("Status = OK \n");
}
else
{
printf("Status = ERROR <ERROR_CODE->%d>\n", s);
}
if(matchingConfigs!=NULL)
{
free(matchingConfigs);
matchingConfigs=NULL;
}
cairo_surface_destroy(surface);
printf("END!\n");
return 0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiler prefix is :
arm-none-linux-gnueabi
Target Device is :
IMX6Q
Best Regards:
Ali
[Attachment #5 (text/html)]
<font color='midnightblue' size='4' face='Georgia, Times New Roman, Times, \
Serif'><br>
<div style="font-family:arial,helvetica;font-size:10pt;color:black"><font \
color="black" size="4">Dear Developers</font><br>
<div id="AOLMsgPart_2_a10a8d6b-edb9-45e3-9024-291a28398855"><font \
color="midnightblue" face="Georgia, Times New Roman, Times, Serif" size="4"> <div \
style="font-family: arial,helvetica; font-size: 10pt;"> <font color="black"></font>
<div id="AOLMsgPart_2_c3deb75a-60fa-496a-b3c2-47ab825b3f30">
<font color="black" face="Georgia, Times New Roman, Times, Serif" 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 display, </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 this 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>
</font><font size="4">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>
</div>
</div>
</font>
[Attachment #6 (text/plain)]
--
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic