chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: gles2 C framework now with raspberry pi support! :o

Thu Sep 27, 2012 2:46 pm

panik wrote:Is that correct, chris_c?
no.

I'll commit a fix when I get chance, see the first fix above (extra if terms) from mossman
instead of:
if(n >= 0)

to:
if(n >= 0 && eps != 0 && eps[0] != 0)
I've been unable to replicate the error, I'd recommend raspbian btw as it uses hard float math which is especially useful when doing physics for example...

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: gles2 C framework now with raspberry pi support! :o

Thu Sep 27, 2012 3:26 pm

I don't have the segfaults, and I'm running raspbian. No problem on line 249 for me. Keys are recognized and responding. Different issue? Reverting back to the original input.c and 'make clean' and 'make', everything compiles (and runs) without problems. Which is a bit weird, because all .o files are being cleaned up as far as I can tell. Cloning and compiling the repo to a different directory gives the same error again.

I don't understand it. But anyway, nice framework. Thanks!

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: gles2 C framework now with raspberry pi support! :o

Thu Sep 27, 2012 4:10 pm

sorry confused! what error are you actually seeing?

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: gles2 C framework now with raspberry pi support! :o

Thu Sep 27, 2012 7:53 pm

Thanks chris. Sorry, my 'question' wasn't very clear.

In the Makefile:

Code: Select all

#PLATFORM=xorg
#PLATFORM=rpi
PLATFORM=rpi_noX
The part that matters from the error (right after libkazmath.a compiled and linked succesfully):

Code: Select all

gcc o/input.o o/obj.o o/support.o o/invaders.o lib/libkazmath.a -o invaders -lX11 -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib `pkg-config libpng --libs`
o/input.o: In function `doEvents':
/home/pi/code/gles2framework/src/input.c:200: undefined reference to `__x_display'
/home/pi/code/gles2framework/src/input.c:200: undefined reference to `__eventWin'
Those variables are defined in src/input.c line 14 and 15, in an #ifndef:

Code: Select all

#ifndef __FOR_RPi_noX__

#include  <X11/Xlib.h>
#include  <X11/Xatom.h>
#include  <X11/Xutil.h>
extern Display *__x_display;
extern Window __eventWin;

#endif //NOT  __FOR_RPi_noX__
It compiles when commenting out the #ifndef and #endif line, so that they're declared. The code further down where they're used is also inbetween the same #ifndef's, so I don't understand why that works, or why it compiles flawlessly a second time after restoring the original input.c and 'make clean && make'.

I only get the error the first time, after cloning the git repo. Color me baffled.

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: gles2 C framework now with raspberry pi support! :o

Thu Sep 27, 2012 9:16 pm

I not really sure I understand what you are having problems with!?!

If its all cleaned (just check that the makefile is cleaning out all object files (.o) and all executables)

If those variables are not used (ie noX) then they shouldn't be linked too....

if its any consolation I'm experiencing a very odd ldconfig error with my set up where it links but can't find a lib at runtime despite being in /etc/ld.conf.d - a setup that *was* working before an update!

With the lack of a proper EGL library and no accelerated xorg support I'm wondering if supporting the pi is worthwhile given the number of properly open ex-phone/ex-tablet boards that are around now...

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: gles2 C framework now with raspberry pi support! :o

Thu Sep 27, 2012 9:49 pm

It's a minor inconvenience. I figured it may help people get it to work if they run into the same thing. I'm not complaining :D
For what it's worth, I think supporting the pi is totally worth it. And your framework runs great on it. Thanks for sharing!

Theo Last
Posts: 17
Joined: Wed Sep 26, 2012 9:33 am

Re: gles2 C framework now with raspberry pi support! :o

Fri Sep 28, 2012 2:22 am

terminal (bash) says git isn't a command

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: gles2 C framework now with raspberry pi support! :o

Fri Sep 28, 2012 5:43 am

Theo Last wrote:terminal (bash) says git isn't a command
Try

Code: Select all

sudo apt-get install git
Assuming your pi is running a debian variant

The package might be called something else if that doesn't work...

Theo Last
Posts: 17
Joined: Wed Sep 26, 2012 9:33 am

Re: gles2 C framework now with raspberry pi support! :o

Fri Sep 28, 2012 9:34 pm

But git isn't a command

(bash)

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: gles2 C framework now with raspberry pi support! :o

Fri Sep 28, 2012 9:44 pm

oh yes it is - if its installed...

see apt-get command above....

Theo Last
Posts: 17
Joined: Wed Sep 26, 2012 9:33 am

Re: gles2 C framework now with raspberry pi support! :o

Fri Sep 28, 2012 10:41 pm

panik wrote:No need to install OpenGL. OpenGL ES is already installed on raspbian. In a terminal:

Code: Select all

git clone git://github.com/chriscamacho/gles2framework.git
cd gles2framework
make
Before 'make', you'll want to open the Makefile, and uncomment either 'PLATFORM=rpi' or 'PLATFORM=rpi_noX'

I had the same error as kevs3d. It's /src/input.c that fails. In /src/input.c, I just commented out (twice) the:
#ifndef __FOR_RPi_noX__
And #endif of course.
I don't think '__FOR_RPi_noX__' is defined somewhere (I expect it in the Makefile, but I didn't look really hard). Is that correct, chris_c?

Other that that: Nice!

Edit: same output (but more complete) as kevs3d:

Code: Select all

gcc o/input.o o/obj.o o/support.o o/invaders.o lib/libkazmath.a -o invaders -lX11 -lGLESv2 -lEGL -lm - bcm_host -L/opt/vc/lib `pkg-config libpng --libs`
o/input.o: In function `doEvents':
/home/pi/code/gles2framework/src/input.c:200: undefined reference to `__x_display'
/home/pi/code/gles2framework/src/input.c:200: undefined reference to `__eventWin'
o/support.o: In function `closeNativeWindow':
support.c:(.text+0x50): undefined reference to `restoreKbd'
o/support.o: In function `closeContext':
support.c:(.text+0x1bdc): undefined reference to `__mouse_fd'
collect2: ld returned 1 exit status
make: *** [invaders] Error 1
I infact had a different error

gcc -g -D__FOR_XORG__ -c -std=gnu99 `pkg-config libpng --cflags` -Iinclude -Ikazmath/kazmath src/obj.c -o o/obj.o
Package libpng was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpng.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpng' found
src/obj.c:1:24: fatal error: GLES2/gl2.h: No such file or directory
compilation terminated.
make: *** [o/obj.o] Error 1

chris_c
Posts: 156
Joined: Sun May 06, 2012 10:23 am

Re: gles2 C framework now with raspberry pi support! :o

Sat Sep 29, 2012 6:53 am

as started in the readme.md, libpng is a dependency of the framework
again assuming that you are using a Debian derived distro

apt-get install libpng-dev

might install the needed dev package for png, the package could also be called libpng12-dev

Return to “OpenGLES”