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
ff840e9e
Commit
ff840e9e
authored
Feb 07, 2015
by
Dave Griffiths
Browse files
started sanity process
parent
1ab91a76
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
346 additions
and
381 deletions
+346
-381
Makefile.in
Makefile.in
+4
-1
src/core/osc.cpp
src/core/osc.cpp
+37
-0
src/core/osc.h
src/core/osc.h
+9
-0
src/core/pixels.cpp
src/core/pixels.cpp
+163
-0
src/core/pixels.h
src/core/pixels.h
+15
-0
src/main.cpp
src/main.cpp
+17
-380
src/rpi/graphics.cpp
src/rpi/graphics.cpp
+85
-0
src/rpi/graphics.h
src/rpi/graphics.h
+16
-0
No files found.
Makefile.in
View file @
ff840e9e
...
...
@@ -7,6 +7,8 @@ SRCS := src/main.cpp\
src/scheme/scheme.cpp
\
src/core/geometry.cpp
\
src/core/noise.cpp
\
src/core/pixels.cpp
\
src/core/osc.cpp
\
src/fluxa/Sample.cpp
\
src/fluxa/Allocator.cpp
\
src/fluxa/Graph.cpp
\
...
...
@@ -23,7 +25,8 @@ SRCS := src/main.cpp\
src/engine/texture.cpp
\
src/engine/nomadic.cpp
\
src/engine/jellyfish_primitive.cpp
\
src/engine/jellyfish.cpp
src/engine/jellyfish.cpp
\
src/linux/glut_graphics.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/
...
...
src/core/osc.cpp
0 → 100644
View file @
ff840e9e
#include "core/osc.h"
#include <pthread.h>
#include <stdio.h>
#include <app.h>
extern
pthread_mutex_t
*
render_mutex
;
void
osc_error_handler
(
int
num
,
const
char
*
msg
,
const
char
*
path
)
{
printf
(
"liblo server error %d in path %s
\n
"
,
num
,
path
);
}
int
osc_default_handler
(
const
char
*
path
,
const
char
*
types
,
lo_arg
**
argv
,
int
argc
,
void
*
data
,
void
*
user_data
)
{
//printf("osc server no handler for: %s %s\n",path,types);
return
1
;
}
int
osc_eval_handler
(
const
char
*
path
,
const
char
*
types
,
lo_arg
**
argv
,
int
argc
,
void
*
data
,
void
*
user_data
)
{
if
(
types
[
0
]
==
's'
)
{
printf
(
"%s
\n
"
,
argv
[
0
]);
pthread_mutex_lock
(
render_mutex
);
appEval
((
char
*
)
argv
[
0
]);
pthread_mutex_unlock
(
render_mutex
);
}
return
1
;
}
void
setup_osc_repl
()
{
printf
(
"starting osc, listening to port 8000
\n
"
);
lo_server_thread
server
=
lo_server_thread_new
(
"8000"
,
osc_error_handler
);
lo_server_thread_add_method
(
server
,
NULL
,
NULL
,
osc_default_handler
,
NULL
);
lo_server_thread_add_method
(
server
,
"/eval"
,
"s"
,
osc_eval_handler
,
NULL
);
lo_server_thread_start
(
server
);
}
src/core/osc.h
0 → 100644
View file @
ff840e9e
#include <lo/lo.h>
/////////////// osc stuff ////////////////////////////////////////////////
void
osc_error_handler
(
int
num
,
const
char
*
msg
,
const
char
*
path
);
int
osc_default_handler
(
const
char
*
path
,
const
char
*
types
,
lo_arg
**
argv
,
int
argc
,
void
*
data
,
void
*
user_data
);
int
osc_eval_handler
(
const
char
*
path
,
const
char
*
types
,
lo_arg
**
argv
,
int
argc
,
void
*
data
,
void
*
user_data
);
void
setup_osc_repl
();
src/core/pixels.cpp
0 → 100644
View file @
ff840e9e
#include "core/pixels.h"
GLubyte
*
GetScreenBuffer
(
int
x
,
int
y
,
unsigned
int
width
,
unsigned
int
height
,
int
super
)
{
// get the raw image
GLubyte
*
image
=
(
GLubyte
*
)
malloc
(
width
*
height
*
sizeof
(
GLubyte
)
*
3
);
// OpenGL's default 4 byte pack alignment would leave extra bytes at the
// end of each image row so that each full row contained a number of bytes
// divisible by 4. Ie, an RGB row with 3 pixels and 8-bit componets would
// be laid out like "RGBRGBRGBxxx" where the last three "xxx" bytes exist
// just to pad the row out to 12 bytes (12 is divisible by 4). To make sure
// the rows are packed as tight as possible (no row padding), set the pack
// alignment to 1.
glPixelStorei
(
GL_PACK_ALIGNMENT
,
1
);
glReadPixels
(
x
,
y
,
width
,
height
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
image
);
if
(
super
==
1
)
return
image
;
// supersample the image
int
newwidth
=
width
/
super
;
int
newheight
=
height
/
super
;
GLubyte
*
image2
=
(
GLubyte
*
)
malloc
(
newwidth
*
newheight
*
sizeof
(
GLubyte
)
*
3
);
for
(
int
yy
=
0
;
yy
<
newheight
;
yy
++
)
{
for
(
int
xx
=
0
;
xx
<
newwidth
;
xx
++
)
{
int
sx
=
xx
*
super
;
int
sy
=
yy
*
super
;
int
i
=
(
yy
*
newwidth
+
xx
)
*
3
;
int
a
=
(
sy
*
width
+
sx
)
*
3
;
int
b
=
(
sy
*
width
+
(
sx
+
1
))
*
3
;
int
c
=
((
sy
+
1
)
*
width
+
(
sx
+
1
))
*
3
;
int
d
=
((
sy
+
1
)
*
width
+
sx
)
*
3
;
image2
[
i
]
=
(
image
[
a
]
+
image
[
b
]
+
image
[
c
]
+
image
[
d
])
/
4
;
image2
[
i
+
1
]
=
(
image
[
a
+
1
]
+
image
[
b
+
1
]
+
image
[
c
+
1
]
+
image
[
d
+
1
])
/
4
;
image2
[
i
+
2
]
=
(
image
[
a
+
2
]
+
image
[
b
+
2
]
+
image
[
c
+
2
]
+
image
[
d
+
2
])
/
4
;
}
}
width
=
newwidth
;
height
=
newheight
;
free
(
image
);
return
image2
;
}
unsigned
char
*
LoadPNG
(
const
string
filename
,
long
&
width
,
long
&
height
)
{
unsigned
char
*
data
=
NULL
;
FILE
*
fp
=
fopen
(
filename
.
c_str
(),
"rb"
);
if
(
!
fp
||
filename
==
""
)
{
cerr
<<
"Couldn't open image ["
<<
filename
<<
"]"
<<
endl
;
}
else
{
png_structp
png_ptr
=
png_create_read_struct
(
PNG_LIBPNG_VER_STRING
,
NULL
,
NULL
,
NULL
);
png_infop
info_ptr
=
png_create_info_struct
(
png_ptr
);
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
{
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
NULL
);
cerr
<<
"Error reading image ["
<<
filename
<<
"]"
<<
endl
;
fclose
(
fp
);
return
NULL
;
}
png_init_io
(
png_ptr
,
fp
);
png_read_info
(
png_ptr
,
info_ptr
);
width
=
png_get_image_width
(
png_ptr
,
info_ptr
);
height
=
png_get_image_height
(
png_ptr
,
info_ptr
);
int
bit_depth
=
png_get_bit_depth
(
png_ptr
,
info_ptr
);
int
colour_type
=
png_get_color_type
(
png_ptr
,
info_ptr
);
png_bytep
*
row_pointers
=
new
png_bytep
[
height
];
unsigned
int
rb
=
png_get_rowbytes
(
png_ptr
,
info_ptr
);
for
(
unsigned
long
row
=
0
;
row
<
height
;
row
++
)
{
row_pointers
[
row
]
=
new
png_byte
[
rb
];
}
// read the data into the row pointers
png_read_image
(
png_ptr
,
row_pointers
);
fclose
(
fp
);
// make a new contiguous array to store the pixels
data
=
new
unsigned
char
[
rb
*
height
];
int
p
=
0
;
for
(
int
row
=
0
;
row
<
height
;
row
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
rb
;
i
++
)
{
data
[
p
]
=
(
unsigned
char
)(
row_pointers
[
row
])[
i
];
p
++
;
}
}
// clear up the row_pointers
for
(
unsigned
long
row
=
0
;
row
<
height
;
row
++
)
{
delete
[]
row_pointers
[
row
];
}
delete
[]
row_pointers
;
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
(
png_infopp
)
NULL
);
}
return
data
;
}
#ifdef USE_JPGLIB
int
WriteJPG
(
GLubyte
*
image
,
const
char
*
filename
,
const
char
*
description
,
int
x
,
int
y
,
int
width
,
int
height
,
int
quality
,
int
super
)
{
struct
jpeg_compress_struct
cinfo
;
struct
jpeg_error_mgr
jerr
;
FILE
*
outfile
;
JSAMPROW
row_pointer
[
1
];
int
row_stride
;
cinfo
.
err
=
jpeg_std_error
(
&
jerr
);
jpeg_create_compress
(
&
cinfo
);
if
((
outfile
=
fopen
(
filename
,
"wb"
))
==
NULL
)
{
return
1
;
}
jpeg_stdio_dest
(
&
cinfo
,
outfile
);
cinfo
.
image_width
=
width
;
cinfo
.
image_height
=
height
;
cinfo
.
input_components
=
3
;
cinfo
.
in_color_space
=
JCS_RGB
;
jpeg_set_defaults
(
&
cinfo
);
jpeg_set_quality
(
&
cinfo
,
quality
,
TRUE
);
jpeg_start_compress
(
&
cinfo
,
TRUE
);
row_stride
=
width
*
3
;
while
(
cinfo
.
next_scanline
<
cinfo
.
image_height
)
{
row_pointer
[
0
]
=
&
image
[(
cinfo
.
image_height
-
1
-
cinfo
.
next_scanline
)
*
row_stride
];
(
void
)
jpeg_write_scanlines
(
&
cinfo
,
row_pointer
,
1
);
}
jpeg_finish_compress
(
&
cinfo
);
fclose
(
outfile
);
jpeg_destroy_compress
(
&
cinfo
);
free
(
image
);
return
0
;
}
#endif
src/core/pixels.h
0 → 100644
View file @
ff840e9e
#include <png.h>
#include "engine/importgl.h"
#ifdef USE_JPGLIB
extern
"C"
{
#include <jpeglib.h>
}
#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
);
#ifdef USE_JPGLIB
int
WriteJPG
(
GLubyte
*
image
,
const
char
*
filename
,
const
char
*
description
,
int
x
,
int
y
,
int
width
,
int
height
,
int
quality
,
int
super
);
#endif
src/main.cpp
View file @
ff840e9e
...
...
@@ -20,42 +20,24 @@
#include <sys/time.h>
#include <iostream>
#include <string>
#include <png.h>
#include <pthread.h>
#ifdef USE_JPGLIB
extern
"C"
{
#include <jpeglib.h>
}
#endif
#include <lo/lo.h>
#include "engine/importgl.h"
#include "core/fixed.h"
#include "core/pixels.h"
#include "core/osc.h"
#include "app.h"
#include "audio/alsa.h"
#ifdef FLX_RPI
#include <assert.h>
#include "bcm_host.h"
#include "rpi/input.h"
#include "rpi/graphics.h"
#endif
typedef
struct
{
uint32_t
screen_width
;
uint32_t
screen_height
;
// OpenGL|ES objects
EGLDisplay
display
;
EGLSurface
surface
;
EGLContext
context
;
}
RPI_STATE_T
;
static
volatile
int
terminate_prog
;
static
RPI_STATE_T
_state
,
*
state
=&
_state
;
#ifndef FLX_RPI
#include "linux/glut_graphics.h"
#endif
using
namespace
std
;
...
...
@@ -77,168 +59,6 @@ static const string ASSETS_LOCATION("assets/");
#endif
#endif
GLubyte
*
GetScreenBuffer
(
int
x
,
int
y
,
unsigned
int
width
,
unsigned
int
height
,
int
super
)
{
// get the raw image
GLubyte
*
image
=
(
GLubyte
*
)
malloc
(
width
*
height
*
sizeof
(
GLubyte
)
*
3
);
// OpenGL's default 4 byte pack alignment would leave extra bytes at the
// end of each image row so that each full row contained a number of bytes
// divisible by 4. Ie, an RGB row with 3 pixels and 8-bit componets would
// be laid out like "RGBRGBRGBxxx" where the last three "xxx" bytes exist
// just to pad the row out to 12 bytes (12 is divisible by 4). To make sure
// the rows are packed as tight as possible (no row padding), set the pack
// alignment to 1.
glPixelStorei
(
GL_PACK_ALIGNMENT
,
1
);
glReadPixels
(
x
,
y
,
width
,
height
,
GL_RGB
,
GL_UNSIGNED_BYTE
,
image
);
if
(
super
==
1
)
return
image
;
// supersample the image
int
newwidth
=
width
/
super
;
int
newheight
=
height
/
super
;
GLubyte
*
image2
=
(
GLubyte
*
)
malloc
(
newwidth
*
newheight
*
sizeof
(
GLubyte
)
*
3
);
for
(
int
yy
=
0
;
yy
<
newheight
;
yy
++
)
{
for
(
int
xx
=
0
;
xx
<
newwidth
;
xx
++
)
{
int
sx
=
xx
*
super
;
int
sy
=
yy
*
super
;
int
i
=
(
yy
*
newwidth
+
xx
)
*
3
;
int
a
=
(
sy
*
width
+
sx
)
*
3
;
int
b
=
(
sy
*
width
+
(
sx
+
1
))
*
3
;
int
c
=
((
sy
+
1
)
*
width
+
(
sx
+
1
))
*
3
;
int
d
=
((
sy
+
1
)
*
width
+
sx
)
*
3
;
image2
[
i
]
=
(
image
[
a
]
+
image
[
b
]
+
image
[
c
]
+
image
[
d
])
/
4
;
image2
[
i
+
1
]
=
(
image
[
a
+
1
]
+
image
[
b
+
1
]
+
image
[
c
+
1
]
+
image
[
d
+
1
])
/
4
;
image2
[
i
+
2
]
=
(
image
[
a
+
2
]
+
image
[
b
+
2
]
+
image
[
c
+
2
]
+
image
[
d
+
2
])
/
4
;
}
}
width
=
newwidth
;
height
=
newheight
;
free
(
image
);
return
image2
;
}
unsigned
char
*
LoadPNG
(
const
string
filename
,
long
&
width
,
long
&
height
)
{
unsigned
char
*
data
=
NULL
;
FILE
*
fp
=
fopen
(
filename
.
c_str
(),
"rb"
);
if
(
!
fp
||
filename
==
""
)
{
cerr
<<
"Couldn't open image ["
<<
filename
<<
"]"
<<
endl
;
}
else
{
png_structp
png_ptr
=
png_create_read_struct
(
PNG_LIBPNG_VER_STRING
,
NULL
,
NULL
,
NULL
);
png_infop
info_ptr
=
png_create_info_struct
(
png_ptr
);
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
{
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
NULL
);
cerr
<<
"Error reading image ["
<<
filename
<<
"]"
<<
endl
;
fclose
(
fp
);
return
NULL
;
}
png_init_io
(
png_ptr
,
fp
);
png_read_info
(
png_ptr
,
info_ptr
);
width
=
png_get_image_width
(
png_ptr
,
info_ptr
);
height
=
png_get_image_height
(
png_ptr
,
info_ptr
);
int
bit_depth
=
png_get_bit_depth
(
png_ptr
,
info_ptr
);
int
colour_type
=
png_get_color_type
(
png_ptr
,
info_ptr
);
png_bytep
*
row_pointers
=
new
png_bytep
[
height
];
unsigned
int
rb
=
png_get_rowbytes
(
png_ptr
,
info_ptr
);
for
(
unsigned
long
row
=
0
;
row
<
height
;
row
++
)
{
row_pointers
[
row
]
=
new
png_byte
[
rb
];
}
// read the data into the row pointers
png_read_image
(
png_ptr
,
row_pointers
);
fclose
(
fp
);
// make a new contiguous array to store the pixels
data
=
new
unsigned
char
[
rb
*
height
];
int
p
=
0
;
for
(
int
row
=
0
;
row
<
height
;
row
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
rb
;
i
++
)
{
data
[
p
]
=
(
unsigned
char
)(
row_pointers
[
row
])[
i
];
p
++
;
}
}
// clear up the row_pointers
for
(
unsigned
long
row
=
0
;
row
<
height
;
row
++
)
{
delete
[]
row_pointers
[
row
];
}
delete
[]
row_pointers
;
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
(
png_infopp
)
NULL
);
}
return
data
;
}
#ifdef USE_JPGLIB
int
WriteJPG
(
GLubyte
*
image
,
const
char
*
filename
,
const
char
*
description
,
int
x
,
int
y
,
int
width
,
int
height
,
int
quality
,
int
super
)
{
struct
jpeg_compress_struct
cinfo
;
struct
jpeg_error_mgr
jerr
;
FILE
*
outfile
;
JSAMPROW
row_pointer
[
1
];
int
row_stride
;
cinfo
.
err
=
jpeg_std_error
(
&
jerr
);
jpeg_create_compress
(
&
cinfo
);
if
((
outfile
=
fopen
(
filename
,
"wb"
))
==
NULL
)
{
return
1
;
}
jpeg_stdio_dest
(
&
cinfo
,
outfile
);
cinfo
.
image_width
=
width
;
cinfo
.
image_height
=
height
;
cinfo
.
input_components
=
3
;
cinfo
.
in_color_space
=
JCS_RGB
;
jpeg_set_defaults
(
&
cinfo
);
jpeg_set_quality
(
&
cinfo
,
quality
,
TRUE
);
jpeg_start_compress
(
&
cinfo
,
TRUE
);
row_stride
=
width
*
3
;
while
(
cinfo
.
next_scanline
<
cinfo
.
image_height
)
{
row_pointer
[
0
]
=
&
image
[(
cinfo
.
image_height
-
1
-
cinfo
.
next_scanline
)
*
row_stride
];
(
void
)
jpeg_write_scanlines
(
&
cinfo
,
row_pointer
,
1
);
}
jpeg_finish_compress
(
&
cinfo
);
fclose
(
outfile
);
jpeg_destroy_compress
(
&
cinfo
);
free
(
image
);
return
0
;
}
#endif
string
LoadFile
(
string
filename
)
{
FILE
*
file
=
fopen
(
filename
.
c_str
(),
"r"
);
...
...
@@ -260,74 +80,6 @@ string LoadFile(string filename)
return
""
;
}
#ifndef FLX_RPI
void
ReshapeCallback
(
int
width
,
int
height
)
{
w
=
width
;
h
=
height
;
}
void
IdleCallback
()
{
glutPostRedisplay
();
}
void
glTranslatex
(
GLfixed
x
,
GLfixed
y
,
GLfixed
z
)
{
glTranslatef
(
x
/
65536.0
,
y
/
65536.0
,
z
/
65536.0
);
}
void
glFrustumx
(
GLfixed
xmin
,
GLfixed
xmax
,
GLfixed
ymin
,
GLfixed
ymax
,
GLfixed
zNear
,
GLfixed
zFar
)
{
glFrustum
(
xmin
/
65536.0
,
xmax
/
65536.0
,
ymin
/
65536.0
,
ymax
/
65536.0
,
zNear
/
65536.0
,
zFar
/
65536.0
);
}
void
glClearColorx
(
GLfixed
r
,
GLfixed
g
,
GLfixed
b
,
GLfixed
a
)
{
glClearColor
(
r
/
65536.0
,
g
/
65536.0
,
b
/
65536.0
,
a
/
65536.0
);
}
void
glMaterialx
(
GLenum
face
,
GLenum
pname
,
GLfixed
param
)
{
glMaterialf
(
face
,
pname
,
param
/
65536.0
);
}
void
glMaterialxv
(
GLenum
face
,
GLenum
pname
,
GLfixed
*
params
)
{
float
fparams
[
4
];
fparams
[
0
]
=
params
[
0
]
/
65536.0
;
fparams
[
1
]
=
params
[
1
]
/
65536.0
;
fparams
[
2
]
=
params
[
2
]
/
65536.0
;
fparams
[
3
]
=
params
[
3
]
/
65536.0
;
glMaterialfv
(
face
,
pname
,
fparams
);
}
void
glLightxv
(
GLenum
light
,
GLenum
pname
,
GLfixed
*
params
)
{
float
fparams
[
4
];
fparams
[
0
]
=
params
[
0
]
/
65536.0
;
fparams
[
1
]
=
params
[
1
]
/
65536.0
;
fparams
[
2
]
=
params
[
2
]
/
65536.0
;
fparams
[
3
]
=
params
[
3
]
/
65536.0
;
glLightfv
(
light
,
pname
,
fparams
);
}
void
glMultMatrixx
(
GLfixed
*
mat
)
{
float
m
[
16
];
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
m
[
i
]
=
mat
[
i
]
/
65536.0
f
;
}
glMultMatrixf
(
m
);
}
#endif // FLX_RPI
//// common //////////////////////////
static
int
frame_num
=
0
;
...
...
@@ -385,6 +137,17 @@ void KeyboardCallback(unsigned char key,int x, int y)
#endif
}
void
ReshapeCallback
(
int
width
,
int
height
)
{
w
=
width
;
h
=
height
;
}
void
IdleCallback
()
{
glutPostRedisplay
();
}
void
KeyboardUpCallback
(
unsigned
char
key
,
int
x
,
int
y
)
{
char
code
[
256
];
...
...
@@ -395,97 +158,6 @@ void KeyboardUpCallback(unsigned char key,int x, int y)
}
}
#ifdef FLX_RPI
static
void
init_ogl_rpi
(
RPI_STATE_T
*
state
)
{
int32_t
success
=
0
;
EGLBoolean
result
;
EGLint
num_config
;
static
EGL_DISPMANX_WINDOW_T
nativewindow
;
DISPMANX_ELEMENT_HANDLE_T
dispman_element
;
DISPMANX_DISPLAY_HANDLE_T
dispman_display
;
DISPMANX_UPDATE_HANDLE_T
dispman_update
;
VC_RECT_T
dst_rect
;
VC_RECT_T
src_rect
;
static
const
EGLint
attribute_list
[]
=
{
EGL_RED_SIZE
,
8
,
EGL_GREEN_SIZE
,
8
,
EGL_BLUE_SIZE
,
8
,
EGL_ALPHA_SIZE
,
8
,
EGL_DEPTH_SIZE
,
16
,
EGL_SURFACE_TYPE
,
EGL_WINDOW_BIT
,
EGL_NONE
};
EGLConfig
config
;
// get an EGL display connection
state
->
display
=
eglGetDisplay
(
EGL_DEFAULT_DISPLAY
);
assert
(
state
->
display
!=
EGL_NO_DISPLAY
);
// initialize the EGL display connection
result
=
eglInitialize
(
state
->
display
,
NULL
,
NULL
);
assert
(
EGL_FALSE
!=
result
);
// get an appropriate EGL frame buffer configuration
result
=
eglChooseConfig
(
state
->
display
,
attribute_list
,
&
config
,
1
,
&
num_config
);
assert
(
EGL_FALSE
!=
result
);
// create an EGL rendering context
state
->
context
=
eglCreateContext
(
state
->
display
,
config
,
EGL_NO_CONTEXT
,
NULL
);
assert
(
state
->
context
!=
EGL_NO_CONTEXT
);
// create an EGL window surface
success
=
graphics_get_display_size
(
0
/* LCD */
,
&
state
->
screen_width
,
&
state
->
screen_height
);
assert
(
success
>=
0
);
dst_rect
.
x
=
0
;
dst_rect
.
y
=
0
;
dst_rect
.
width
=
state
->
screen_width
;