Port OpenGL/SDL/TinySDGL to android with native C

Put your problem here if it does not fit any of the other categories.

Port OpenGL/SDL/TinySDGL to android with native C

Postby i25ffz » Fri Oct 24, 2008 4:08 pm

I have success port SDL/TinySDGL to android with native C!

Make SDL with Makefile.minimal makefile, and config SDL_config.h to set video use FBCON, and timer user unix implement, and change some code when user FBCON video.

After compile SDL success, then compile TinySDGL, don't change any code, so crazy!

But compile TinySDGL demo need change screen size variables, then can success compile gears example, screensnap pls see the photo:
Image

Steps as follows:

1.Download arm linux cross platform compile toolchains from URL:

http://www.codesourcery.com/gnu_toolcha ... nload.html

Windows: http://www.codesourcery.com/gnu_toolcha ... nueabi.exe

Linux: http://www.codesourcery.com/gnu_toolcha ... nueabi.bin

after install the gnu arm linux toolchains, set the dir "bin" to your path;

2.If you use windows, pls install cygwin(http://www.cygwin.com), if you use linux, ignore this step;

3.Download SDL 1.2.13 source from http://www.libsdl.org, and un-zip it to a dir;

4.Change the Makefile.minimal as follows:

# Makefile to build the SDL library

INCLUDE = -I./include
CFLAGS = -g -O2 $(INCLUDE) -static
CC = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
RANLIB = arm-none-linux-gnueabi-ranlib

CONFIG_H = include/SDL_config.h
TARGET = libSDL.a
SOURCES =
src

#include <stdarg.h>

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef unsigned int size_t;
typedef unsigned long uintptr_t;


#define SDL_AUDIO_DRIVER_OSS 1 // SDL_AUDIO_DRIVER_DUMMY


#define SDL_CDROM_DISABLED 1


#define SDL_JOYSTICK_DISABLED 1


#define SDL_LOADSO_DISABLED 1


#define SDL_THREADS_DISABLED 1

//SDL_TIMERS_DISABLED
#define SDL_TIMER_UNIX 1

// SDL_VIDEO_DRIVER_DUMMY
#define SDL_VIDEO_DRIVER_FBCON 1


#define HAVE_STDIO_H 1

#endif

We enable audio driver oss, and video frame buffer, and unix timer, and enable stdio to read/write file;

3.Change $SDL/src/video/fbcon/SDL_fbvideo.c, line 191 & 499, use "/dev/graphics/fb0" instead of "/dev/fb0", becuase Android linux use "/dev/graphics/fb0" video device;

4.Now enter SDL dir, you can type "make" to compile SDL for Android! if success, you can get libSDL.a in SDL dir;

5.Download TinySDL from http://www.kyb.tuebingen.mpg.de/bu/people/gf/software/, TinySDGL: http://www.kyb.tuebingen.mpg.de/bu/peop ... nySDGL.zip, and un-zip TinySDGL to the same dir as you un-zip SDL;

6.For compile TinySDGL, you just need change Makefile, don't need change any source code, the makeinclude as follows:

#####################################################################
# C compiler

# linux / Windows MinGW
CC= arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
RANLIB = arm-none-linux-gnueabi-ranlib
CFLAGS = -g -Wall -O2 -w -static
LFLAGS = -s -static

#####################################################################
# SDL configuration (for the examples only)

UI_LIBS = -L../../SDL-1.2.13 -lSDL
UI_INCLUDES = -I../../SDL-1.2.13/include


#####################################################################
# OpenGL configuration (for the examples only)

# use TinySDGL
GL_LIBS= -L../lib -lTinySDGL
GL_INCLUDES= -I../include
GL_DEPS= ../lib/libTinySDGL.a

# use Mesa
#GL_LIBS= -lMesaGL
#GL_INCLUDES=
#GL_DEPS=

# use OpenGL
#GL_LIBS= -lGL
#GL_INCLUDES=
#GL_DEPS=

####################################################################
# Compile and link control

DIRS= src examples



After change this, you can enter TinySDGL dir, and type "make" to compile it, after compile success, enter examples dir, you can find the gears,triangle demos, now you can push them to android emulator, and run it, first start your android emulator, and type commonds as follwos:

>adb shell mkdir /dev/sample

>adb push gears /dev/sample

>adb shell chmod 777 /dev/sample/gears

>adb shell

#cd /dev/sample

#./gears

OK, you will see the demo run on android emulator!
i25ffz
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Dec 27, 2007 9:28 am

Top

Postby MrSnowflake » Tue Oct 28, 2008 8:36 pm

Didn't try it, but COOL :).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

can not compile

Postby charroch » Mon Jan 19, 2009 2:44 pm

Hi.

Could you post your Makefile.minimal as it seems truncated in the article.

Thanks.,
Carl
charroch
Freshman
Freshman
 
Posts: 7
Joined: Thu Dec 06, 2007 1:08 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 26 guests