Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dave Griffiths
jellyfish
Commits
4a89ae67
Commit
4a89ae67
authored
Feb 11, 2015
by
Dave Griffiths
Browse files
Merge branch 'master' of github.com:nebogeo/jellyfish
parents
af368126
31ecfcb6
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1128 additions
and
1021 deletions
+1128
-1021
Makefile.in
Makefile.in
+6
-4
configure
configure
+1061
-898
configure.ac
configure.ac
+18
-7
experiments/gp.scm
experiments/gp.scm
+3
-2
src/audio/alsa.c
src/audio/alsa.c
+0
-94
src/audio/alsa.cpp
src/audio/alsa.cpp
+1
-1
src/core/pixels.cpp
src/core/pixels.cpp
+3
-0
src/core/pixels.h
src/core/pixels.h
+3
-1
src/core/types.h
src/core/types.h
+3
-2
src/engine/importgl.h
src/engine/importgl.h
+2
-0
src/linux/glut_graphics.cpp
src/linux/glut_graphics.cpp
+4
-0
src/linux/glut_graphics.h
src/linux/glut_graphics.h
+4
-0
src/main.cpp
src/main.cpp
+14
-10
src/rpi/graphics.cpp
src/rpi/graphics.cpp
+5
-1
src/rpi/graphics.h
src/rpi/graphics.h
+1
-1
No files found.
Makefile.in
View file @
4a89ae67
...
...
@@ -26,12 +26,14 @@ SRCS := src/main.cpp\
src/engine/nomadic.cpp
\
src/engine/jellyfish_primitive.cpp
\
src/engine/jellyfish.cpp
\
src/linux/glut_graphics.cpp
src/linux/glut_graphics.cpp
\
src/rpi/graphics.cpp
\
src/rpi/input.cpp
# for the minute, go out and up to link to the vision lib
CCFLAGS
=
-ggdb
-O3
-fpermissive
-ffast-math
-Wno-unused
-DFLX_LINUX
-Isrc
-Wno-write-strings
-DASSETS_PATH
=
@prefix@/lib/jellyfish/
LDFLAGS
=
LIBS
=
-lglut
-lGL
-lpng
-lpthread
-ldl
-llo
-ljpeg
-lasound
CCFLAGS
=
@CFLAGS@
-ggdb
-O3
-fpermissive
-ffast-math
-Wno-unused
-Isrc
-Wno-write-strings
-DASSETS_PATH
=
@prefix@/lib/jellyfish/
LDFLAGS
=
@LDFLAGS@
LIBS
=
@LIBS@
CC
=
@CXX@
OBJS
:=
${SRCS:.cpp=.o}
...
...
configure
View file @
4a89ae67
This diff is collapsed.
Click to expand it.
configure.ac
View file @
4a89ae67
AC_INIT(jellyfish, version-0.1)
echo " Testing for a C compiler"
AC_PROG_CC
echo " Testing for a C++ compiler"
AC_PROG_CXX
AC_LANG(C++)
AC_CHECK_HEADERS(iostream)
CFLAGS="$CFLAGS -I/opt/vc/include/"
LDFLAGS="$LDFLAGS -L/opt/vc/lib"
dnl FIXME: EGL of RPi depends on GLESv1 or GLESv2
dnl FIXME: GLESv2 of RPi depends on EGL... WTF!
LIBS="$LIBS -lvcos -lvchiq_arm"
AC_CHECK_LIB([bcm_host], [bcm_host_init], [
CFLAGS="$CFLAGS -DFLX_RPI -I/opt/vc/include/interface/vcos/pthreads/ -I/opt/vc/include/interface/vmcs_host/linux/"
AC_CHECK_LIB(X11, main)
AC_CHECK_LIB(GLESv1_CM, main)
AC_CHECK_LIB(EGL, eglCopyBuffers)
])
AC_CHECK_LIB(m, cos)
AC_CHECK_LIB(glut, main)
AC_CHECK_LIB(gl, main)
...
...
@@ -15,7 +24,9 @@ AC_CHECK_LIB(lo, main)
AC_CHECK_LIB(jpeg, main)
AC_CHECK_LIB(asound, main)
echo " Are we on Raspberry Pi?"
AC_CHECK_HEADERS(/opt/vc/include/bcm_host.h)
AC_PROG_CXX
AC_LANG(C++)
AC_CHECK_HEADERS(iostream)
AC_CONFIG_HEADER(src/config.h)
AC_OUTPUT(Makefile)
experiments/gp.scm
View file @
4a89ae67
...
...
@@ -184,8 +184,9 @@
(
define
(
trig
)
(
let
((
p
(
make-function
vocab
0
)))
(
display
p
)(
newline
)
(
play-now
(
eval
p
)
0
))
(
loop
9999
)
;; (play-now (eval p) 0)
)
(
loop
99
)
(
trig
))
(
trig
)
src/audio/alsa.c
deleted
100644 → 0
View file @
af368126
#include <stdio.h>
#include <stdlib.h>
#include <alsa/asoundlib.h>
#include <limits.h>
#include <../Fluxa/Graph.h>
main
(
int
argc
,
char
*
argv
[])
{
Graph
g
;
int
i
;
int
err
;
short
buf
[
128
];
snd_pcm_t
*
playback_handle
;
snd_pcm_hw_params_t
*
hw_params
;
if
((
err
=
snd_pcm_open
(
&
playback_handle
,
argv
[
1
],
SND_PCM_STREAM_PLAYBACK
,
0
))
<
0
)
{
fprintf
(
stderr
,
"cannot open audio device %s (%s)
\n
"
,
argv
[
1
],
snd_strerror
(
err
));
exit
(
1
);
}
if
((
err
=
snd_pcm_hw_params_malloc
(
&
hw_params
))
<
0
)
{
fprintf
(
stderr
,
"cannot allocate hardware parameter structure (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
if
((
err
=
snd_pcm_hw_params_any
(
playback_handle
,
hw_params
))
<
0
)
{
fprintf
(
stderr
,
"cannot initialize hardware parameter structure (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
if
((
err
=
snd_pcm_hw_params_set_access
(
playback_handle
,
hw_params
,
SND_PCM_ACCESS_RW_INTERLEAVED
))
<
0
)
{
fprintf
(
stderr
,
"cannot set access type (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
if
((
err
=
snd_pcm_hw_params_set_format
(
playback_handle
,
hw_params
,
SND_PCM_FORMAT_S16_LE
))
<
0
)
{
fprintf
(
stderr
,
"cannot set sample format (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
fprintf
(
stderr
,
"here
\n
"
);
/*
if ((err = snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, 48000, 0)) < 0) {
fprintf (stderr, "cannot set sample rate (%s)\n",
snd_strerror (err));
exit (1);
}
*/
fprintf
(
stderr
,
"there
\n
"
);
if
((
err
=
snd_pcm_hw_params_set_channels
(
playback_handle
,
hw_params
,
2
))
<
0
)
{
fprintf
(
stderr
,
"cannot set channel count (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
if
((
err
=
snd_pcm_hw_params
(
playback_handle
,
hw_params
))
<
0
)
{
fprintf
(
stderr
,
"cannot set parameters (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
snd_pcm_hw_params_free
(
hw_params
);
if
((
err
=
snd_pcm_prepare
(
playback_handle
))
<
0
)
{
fprintf
(
stderr
,
"cannot prepare audio interface for use (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
for
(
i
=
0
;
i
<
128
;
i
++
)
{
buf
[
i
]
=
rand
()
%
SHRT_MAX
;
}
for
(
i
=
0
;
i
<
100
;
++
i
)
{
if
((
err
=
snd_pcm_writei
(
playback_handle
,
buf
,
128
))
!=
128
)
{
fprintf
(
stderr
,
"write to audio interface failed (%s)
\n
"
,
snd_strerror
(
err
));
exit
(
1
);
}
}
snd_pcm_close
(
playback_handle
);
exit
(
0
);
}
src/audio/alsa.cpp
View file @
4a89ae67
...
...
@@ -44,7 +44,7 @@ void audio_loop(void *c) {
left
->
Zero
();
right
->
Zero
();
g
->
Process
(
AUDIO_BUFSIZE
,
*
left
,
*
right
);
g
->
Process
(
AUDIO_BUFSIZE
,
*
left
,
*
right
);
unsigned
int
pos
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
AUDIO_BUFSIZE
*
2
;
i
+=
2
)
...
...
src/core/pixels.cpp
View file @
4a89ae67
#include "core/pixels.h"
#include <iostream>
using
namespace
std
;
GLubyte
*
GetScreenBuffer
(
int
x
,
int
y
,
unsigned
int
width
,
unsigned
int
height
,
int
super
)
{
// get the raw image
...
...
src/core/pixels.h
View file @
4a89ae67
#include <png.h>
#include <string>
#include "engine/importgl.h"
#ifdef HAVE_LIBJPEG
extern
"C"
{
...
...
@@ -9,7 +11,7 @@ extern "C"
#endif
GLubyte
*
GetScreenBuffer
(
int
x
,
int
y
,
unsigned
int
width
,
unsigned
int
height
,
int
super
);
unsigned
char
*
LoadPNG
(
const
string
filename
,
long
&
width
,
long
&
height
);
unsigned
char
*
LoadPNG
(
const
std
::
string
filename
,
long
&
width
,
long
&
height
);
#ifdef HAVE_LIBJPEG
int
WriteJPG
(
GLubyte
*
image
,
const
char
*
filename
,
const
char
*
description
,
int
x
,
int
y
,
int
width
,
int
height
,
int
quality
,
int
super
);
#endif
src/core/types.h
View file @
4a89ae67
...
...
@@ -23,8 +23,9 @@
#include <math.h>
// autoconf can tell us if we are on Pi
#ifdef HAVE__OPT_VC_INCLUDE_BCM_HOST_H
#define FLX_RPI
// only support Pi and linux for the moment
#ifndef FLX_RPI
#define FLX_LINUX
#endif
#ifndef _EE
...
...
src/engine/importgl.h
View file @
4a89ae67
...
...
@@ -25,6 +25,8 @@
#ifndef IMPORTGL_H_INCLUDED
#define IMPORTGL_H_INCLUDED
#include <core/types.h>
#ifndef _EE
#ifdef FLX_RPI
...
...
src/linux/glut_graphics.cpp
View file @
4a89ae67
#include "engine/importgl.h"
#include "linux/glut_graphics.h"
#ifndef FLX_RPI
void
glTranslatex
(
GLfixed
x
,
GLfixed
y
,
GLfixed
z
)
{
glTranslatef
(
x
/
65536.0
,
y
/
65536.0
,
z
/
65536.0
);
...
...
@@ -52,3 +54,5 @@ void glMultMatrixx( GLfixed * mat )
}
glMultMatrixf
(
m
);
}
#endif
src/linux/glut_graphics.h
View file @
4a89ae67
#include "engine/importgl.h"
#ifndef FLX_RPI
// fixed point versions for speeeed
void
glTranslatex
(
GLfixed
x
,
GLfixed
y
,
GLfixed
z
);
void
glFrustumx
(
GLfixed
xmin
,
GLfixed
xmax
,
GLfixed
ymin
,
GLfixed
ymax
,
GLfixed
zNear
,
GLfixed
zFar
);
...
...
@@ -8,3 +10,5 @@ void glMaterialx( GLenum face, GLenum pname, GLfixed param);
void
glMaterialxv
(
GLenum
face
,
GLenum
pname
,
GLfixed
*
params
);
void
glLightxv
(
GLenum
light
,
GLenum
pname
,
GLfixed
*
params
);
void
glMultMatrixx
(
GLfixed
*
mat
);
#endif
src/main.cpp
View file @
4a89ae67
...
...
@@ -135,6 +135,8 @@ void KeyboardCallback(unsigned char key,int x, int y)
#endif
}
#ifdef FLX_LINUX
void
ReshapeCallback
(
int
width
,
int
height
)
{
w
=
width
;
...
...
@@ -146,6 +148,8 @@ void IdleCallback()
glutPostRedisplay
();
}
#endif
void
KeyboardUpCallback
(
unsigned
char
key
,
int
x
,
int
y
)
{
char
code
[
256
];
...
...
@@ -170,10 +174,10 @@ void repl_loop() {
int
main
(
int
argc
,
char
*
argv
[])
{
#ifdef FLX_RPI
bcm_host_init
();
//
bcm_host_init();
// Clear application state
memset
(
state
,
0
,
sizeof
(
*
state
)
);
init_ogl_rpi
(
state
);
//
init_ogl_rpi(state);
#else
w
=
640
;
h
=
480
;
...
...
@@ -196,21 +200,21 @@ int main(int argc, char *argv[])
appInit
();
initGL
();
appEval
((
char
*
)
LoadFile
(
ASSETS_LOCATION
+
"init.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
ASSETS_LOCATION
+
"boot.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
ASSETS_LOCATION
+
"lib.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
ASSETS_LOCATION
+
"compiler.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
ASSETS_LOCATION
+
"fluxa.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
string
(
ASSETS_LOCATION
)
+
"init.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
string
(
ASSETS_LOCATION
)
+
"boot.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
string
(
ASSETS_LOCATION
)
+
"lib.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
string
(
ASSETS_LOCATION
)
+
"compiler.scm"
).
c_str
());
appEval
((
char
*
)
LoadFile
(
string
(
ASSETS_LOCATION
)
+
"fluxa.scm"
).
c_str
());
// preload the textures
long
w
=
0
,
h
=
0
;
unsigned
char
*
tex
=
LoadPNG
(
ASSETS_LOCATION
+
"raspberrypi.png"
,
w
,
h
);
appLoadTexture
(
"raspberrypi.png"
,
w
,
h
,(
char
*
)
tex
);
tex
=
LoadPNG
(
ASSETS_LOCATION
+
"stripes.png"
,
w
,
h
);
tex
=
LoadPNG
(
string
(
ASSETS_LOCATION
)
+
"stripes.png"
,
w
,
h
);
appLoadTexture
(
"stripes.png"
,
w
,
h
,(
char
*
)
tex
);
tex
=
LoadPNG
(
ASSETS_LOCATION
+
"bg.png"
,
w
,
h
);
tex
=
LoadPNG
(
string
(
ASSETS_LOCATION
)
+
"bg.png"
,
w
,
h
);
appLoadTexture
(
"bg.png"
,
w
,
h
,(
char
*
)
tex
);
tex
=
LoadPNG
(
ASSETS_LOCATION
+
"thread.png"
,
w
,
h
);
tex
=
LoadPNG
(
string
(
ASSETS_LOCATION
)
+
"thread.png"
,
w
,
h
);
appLoadTexture
(
"thread.png"
,
w
,
h
,(
char
*
)
tex
);
if
(
argc
>
1
)
{
...
...
src/rpi/graphics.cpp
View file @
4a89ae67
static
void
init_ogl_rpi
(
RPI_STATE_T
*
state
)
#include "bcm_host.h"
#include "graphics.h"
#include <assert.h>
void
init_ogl_rpi
(
RPI_STATE_T
*
state
)
{
int32_t
success
=
0
;
EGLBoolean
result
;
...
...
src/rpi/graphics.h
View file @
4a89ae67
...
...
@@ -13,4 +13,4 @@ typedef struct
static
volatile
int
terminate_prog
;
static
RPI_STATE_T
_state
,
*
state
=&
_state
;
static
void
init_ogl_rpi
(
RPI_STATE_T
*
state
);
void
init_ogl_rpi
(
RPI_STATE_T
*
state
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment