theHetman
Posts: 88
Joined: Tue Jan 10, 2012 5:42 pm

Re: Hardware 3D in a window demo

Wed Jun 06, 2012 11:35 am

tipam wrote:Sorry, I'm a noob at this ... I've been trying to compile this example but I haven't got the 'eglext_brcm.h' file - where do I get this from? I've got all the includes from the hello_triangle example.
Any help appreciated! Thanks.
The easiest way is to use Hexxeh's updater: https://github.com/Hexxeh/rpi-update There are lots of dependences and you should start by doing:

Code: Select all

sudo apt-get update
Then install the certificates. You need to install git too (when you try to run the updater it will fail and tell you how to install git). Then the updater needs to be run with the 192 switch so that the GPU has enough ram. Finally to compile the demo you also need to have the libx library installed

Code: Select all

sudo apt-get libx11-dev

User avatar
PeterO
Posts: 3613
Joined: Sun Jul 22, 2012 4:14 pm

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 10:41 am

Just stumbled on this thread and it looks like just what I need...

But I tried to build the code give at the start and it fails...

g++ -I/opt/vc/include -lX11 -lEGL -lGLESv2 test.cpp
In file included from /opt/vc/include/interface/vcos/vcos_assert.h:149:0,
from /opt/vc/include/interface/vcos/vcos.h:114,
from /opt/vc/include/interface/vmcs_host/vc_dispmanx.h:33,
from /opt/vc/include/bcm_host.h:46,
from /opt/vc/include/EGL/eglplatform.h:95,
from /opt/vc/include/EGL/egl.h:36,
from test.cpp:24:
/opt/vc/include/interface/vcos/vcos_types.h:37:33: fatal error: vcos_platform_types.h: No such file or directory
compilation terminated.

There is however a vcos_platform_types.h in /opt/vc/include/interface/vcos/pthreads/vcos_platform_types.h Is that the same file as the one identified aas missing ?

Petero
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5099
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 10:54 am

PeterO wrote:/opt/vc/include/interface/vcos/vcos_types.h:37:33: fatal error: vcos_platform_types.h: No such file or directory
compilation terminated.

There is however a vcos_platform_types.h in /opt/vc/include/interface/vcos/pthreads/vcos_platform_types.h Is that the same file as the one identified aas missing ?
Try:

Code: Select all

g++ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -lX11 -lEGL -lGLESv2 test.cpp

User avatar
PeterO
Posts: 3613
Joined: Sun Jul 22, 2012 4:14 pm

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 11:01 am

dom wrote: Try:

Code: Select all

g++ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -lX11 -lEGL -lGLESv2 test.cpp
Thanks for the quick reply Dom,
Yes, I arrived at that solution as you posted it :-) So now it compiles, but ...

Code: Select all

pi@PiFive ~/openGLES/teh_orph $ ./egl_example 
shader info: Compiledshader info: CompiledX Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  73 (X_GetImage)
  Serial number of failed request:  14
  Current serial number in output stream:  14
I see from the thread that this is a problem due to running X in 32 bit mode. No solution was posted though :-(

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 3613
Joined: Sun Jul 22, 2012 4:14 pm

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 11:12 am

I decided to try shirro's code from git hub, and with the same "include path fix" it is working :-)
Now the fun can start :-)
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
teh_orph
Posts: 346
Joined: Mon Jan 30, 2012 2:09 pm
Location: London
Contact: Website

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 11:36 am

As a bit of an update to this, as the userland code has now been released I'm trying to see if I can massage that library to allow EGL/X code to "just work" without changes. The girlfriend is away this weekend so hopefully I'll get some work done on this front! ("don't code" she said whilst walking out the door)

User avatar
PeterO
Posts: 3613
Joined: Sun Jul 22, 2012 4:14 pm

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 3:25 pm

I've been out , and now after turning my Pi back on again the code that was working in now failing with the same error as Simon's code ..... WTF ?

And I just ran it again to cut and paste the error message... And it's working again... Double WTF ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 3613
Joined: Sun Jul 22, 2012 4:14 pm

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 3:41 pm

It looks like something is leaking as well as now it just gives a SegFault (same binary).
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 3613
Joined: Sun Jul 22, 2012 4:14 pm

Re: Hardware 3D in a window demo

Sat Nov 03, 2012 5:18 pm

teh_orph wrote:As a bit of an update to this, as the userland code has now been released I'm trying to see if I can massage that library to allow EGL/X code to "just work" without changes. The girlfriend is away this weekend so hopefully I'll get some work done on this front! ("don't code" she said whilst walking out the door)
I hope you can make it "just work" because now I've looked at the earlier code I realise it is really a hack with the openGL image not actually being properly linked to the Xwindow. The image is "manually" copied between the openGLES image and the Xwindow :shock: This is actually not going to be of much use to me I now realise :cry:
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
teh_orph
Posts: 346
Joined: Mon Jan 30, 2012 2:09 pm
Location: London
Contact: Website

Re: Hardware 3D in a window demo

Sun Nov 04, 2012 12:53 am

Yeah I have no idea why it would work one time but not another. Sounds like some EGL funk...
Anyway I'm trying to craft a modified library that will internally do the copy. So nothing will change - you just won't see it.

bbond007
Posts: 73
Joined: Sun Nov 04, 2012 6:10 pm

Re: Hardware 3D in a window demo

Mon Nov 05, 2012 7:09 am

I get this error like 90% of the time i run this...


X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 73 (X_GetImage)
Serial number of failed request: 14
Current serial number in output stream: 14


I came up with a fix that seems to help but its not elegant.

XGetWindowAttributes(x_display, win, &gwa);

int iEvent =0;
for(iEvent =0; iEvent < 10; iEvent++)
{
if(XPending(x_display))
{ // check for events from the x-server
XEvent xev;
XNextEvent(x_display, &xev);
}
usleep(1000*10);
}

bool quit = false;

PaulHaeberli
Posts: 1
Joined: Wed Apr 10, 2013 8:50 am

Re: Hardware 3D in a window demo

Wed Apr 10, 2013 8:57 am

Raspberry Pi EGL on X: Update 10 Apr 2013
----------------------------------------

This is an update of eglonx for Raspberry pi. Fixing some crashes on start up and
a pixel swapping error on the software conversion to 565 for drawing on to the X
window. Also added more complete handling of X window mouse and expose
events.

Fixed startup crash by replacing this:
Ximage = XGetImage(Xdsp, Xwin, 0, 0, Xgwa.width, Xgwa.height, AllPlanes, ZPixmap);
with
char *buf = (char *)malloc(Xgwa.width*Xgwa.height*2);
Ximage = XCreateImage(Xdsp,
DefaultVisual(Xdsp, DefaultScreen(Xdsp)),
DefaultDepth(Xdsp, DefaultScreen(Xdsp)),
ZPixmap, 0, buf, Xgwa.width, Xgwa.height, 16, 0);
And added this on exit:
bcm_host_deinit();
I'm using to get a photo application running that uses OpenGL ES 2.0
for all the UI, etc. Work in progress video here:

http://www.youtube.com/watch?v=jqNQ7-6Nk7Q

You can get this from github at:

https://github.com/PaulHaeberli/pi-eglonx

Paul H


.

Return to “General discussion”

Who is online

Users browsing this forum: F1TRN, i486 and 46 guests