istereo2
changeset 9:64e15874f3bd
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 26 Sep 2015 02:56:07 +0300 |
parents | 661bf09db398 |
children | 2a0ef5efb8e2 03cc3b1884d1 |
files | Makefile libs/Makefile libs/drawtext/drawtext_impl.h libs/goatkit/theme.cc src/glut/assman.c src/glut/main.c src/glutmain.c src/ui.cc src/uitheme.cc |
diffstat | 9 files changed, 184 insertions(+), 98 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Makefile Sat Sep 26 02:56:07 2015 +0300 1.3 @@ -0,0 +1,34 @@ 1.4 +src = $(wildcard src/*.c) $(wildcard src/glut/*.c) 1.5 +ccsrc = $(wildcard src/*.cc) 1.6 + 1.7 +obj = $(src:.c=.o) $(ccsrc:.cc=.o) 1.8 +dep = $(obj:.o=.d) 1.9 +bin = test 1.10 + 1.11 +incdir = -Isrc 1.12 +def = -DNO_FREETYPE 1.13 + 1.14 +CFLAGS = -pedantic -Wall -g $(def) $(incdir) 1.15 +CXXFLAGS = $(CFLAGS) 1.16 +LDFLAGS = -lGL -lGLU -lglut -lGLEW -lm -ldl 1.17 + 1.18 +include libs/Makefile 1.19 + 1.20 +$(bin): $(obj) 1.21 + $(CXX) -o $@ $(obj) $(LDFLAGS) 1.22 + 1.23 +-include $(dep) 1.24 + 1.25 +%.d: %.c 1.26 + @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ 1.27 + 1.28 +%.d: %.cc 1.29 + @$(CPP) $(CXXFLAGS) -MM -MT $(@:.d=.o) $< >$@ 1.30 + 1.31 +.PHONY: clean 1.32 +clean: 1.33 + rm -f $(obj) $(bin) 1.34 + 1.35 +.PHONY: cleandep 1.36 +cleandep: 1.37 + rm -f $(dep)
2.1 --- a/libs/Makefile Thu Sep 24 07:09:37 2015 +0300 2.2 +++ b/libs/Makefile Sat Sep 26 02:56:07 2015 +0300 2.3 @@ -2,6 +2,10 @@ 2.4 $(wildcard libs/libpng/*.c) \ 2.5 $(wildcard libs/libjpeg/*.c) \ 2.6 $(wildcard libs/imago2/*.c) \ 2.7 - $(wildcard libs/vmath/*.c) 2.8 + $(wildcard libs/vmath/*.c) \ 2.9 + $(wildcard libs/drawtext/*.c) 2.10 2.11 -incdir += -Ilibs/imago2 -Ilibs/zlib -Ilibs/libpng -Ilibs/libjpeg -Ilibs/vmath 2.12 +ccsrc += $(wildcard libs/goatkit/*.cc) 2.13 + 2.14 +incdir += -Ilibs -Ilibs/imago2 -Ilibs/zlib -Ilibs/libpng -Ilibs/libjpeg \ 2.15 + -Ilibs/vmath -Ilibs/drawtext
3.1 --- a/libs/drawtext/drawtext_impl.h Thu Sep 24 07:09:37 2015 +0300 3.2 +++ b/libs/drawtext/drawtext_impl.h Sat Sep 26 02:56:07 2015 +0300 3.3 @@ -1,6 +1,6 @@ 3.4 /* 3.5 libdrawtext - a simple library for fast text rendering in OpenGL 3.6 -Copyright (C) 2011-2012 John Tsiombikas <nuclear@member.fsf.org> 3.7 +Copyright (C) 2011-2015 John Tsiombikas <nuclear@member.fsf.org> 3.8 3.9 This program is free software: you can redistribute it and/or modify 3.10 it under the terms of the GNU Lesser General Public License as published by 3.11 @@ -62,7 +62,7 @@ 3.12 3.13 3.14 #define fperror(str) \ 3.15 - fprintf(stderr, "%s: %s: %s\n", __FUNCTION__, (str), strerror(errno)) 3.16 + fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno)) 3.17 3.18 int dtx_gl_init(void); 3.19
4.1 --- a/libs/goatkit/theme.cc Thu Sep 24 07:09:37 2015 +0300 4.2 +++ b/libs/goatkit/theme.cc Sat Sep 26 02:56:07 2015 +0300 4.3 @@ -1,6 +1,6 @@ 4.4 /* 4.5 GoatKit - a themable/animated widget toolkit for games 4.6 -Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org> 4.7 +Copyright (C) 2014-2015 John Tsiombikas <nuclear@member.fsf.org> 4.8 4.9 This program is free software: you can redistribute it and/or modify 4.10 it under the terms of the GNU Lesser General Public License as published by 4.11 @@ -21,12 +21,15 @@ 4.12 #include <string> 4.13 #include <map> 4.14 #include <algorithm> 4.15 +#include <string.h> 4.16 #include "theme.h" 4.17 #include "widget.h" 4.18 4.19 #ifdef WIN32 4.20 #include <windows.h> 4.21 4.22 +#define RTLD_DEFAULT ((void*)0) 4.23 + 4.24 static void *dlopen(const char *name, int flags); 4.25 static void dlclose(void *so); 4.26 static void *dlsym(void *so, const char *symbol);
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/src/glut/assman.c Sat Sep 26 02:56:07 2015 +0300 5.3 @@ -0,0 +1,28 @@ 5.4 +#include <stdio.h> 5.5 +#include "assman.h" 5.6 + 5.7 +ass_file *ass_fopen(const char *fname, const char *mode) 5.8 +{ 5.9 + return (ass_file*)fopen(fname, mode); 5.10 +} 5.11 + 5.12 +void ass_fclose(ass_file *fp) 5.13 +{ 5.14 + fclose((FILE*)fp); 5.15 +} 5.16 + 5.17 +long ass_fseek(ass_file *fp, long offs, int whence) 5.18 +{ 5.19 + fseek((FILE*)fp, offs, whence); 5.20 + return ftell((FILE*)fp); 5.21 +} 5.22 + 5.23 +long ass_ftell(ass_file *fp) 5.24 +{ 5.25 + return ftell((FILE*)fp); 5.26 +} 5.27 + 5.28 +size_t ass_fread(void *buf, size_t size, size_t count, ass_file *fp) 5.29 +{ 5.30 + return fread(buf, size, count, (FILE*)fp); 5.31 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/src/glut/main.c Sat Sep 26 02:56:07 2015 +0300 6.3 @@ -0,0 +1,103 @@ 6.4 +/* 6.5 +Stereoscopic tunnel for iOS. 6.6 +Copyright (C) 2011-2015 John Tsiombikas <nuclear@member.fsf.org> 6.7 + 6.8 +This program is free software: you can redistribute it and/or modify 6.9 +it under the terms of the GNU General Public License as published by 6.10 +the Free Software Foundation, either version 3 of the License, or 6.11 +(at your option) any later version. 6.12 + 6.13 +This program is distributed in the hope that it will be useful, 6.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 6.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 6.16 +GNU General Public License for more details. 6.17 + 6.18 +You should have received a copy of the GNU General Public License 6.19 +along with this program. If not, see <http://www.gnu.org/licenses/>. 6.20 +*/ 6.21 + 6.22 + 6.23 +#include <stdio.h> 6.24 +#include <stdlib.h> 6.25 +#include <GL/glew.h> 6.26 +#include <GL/glut.h> 6.27 +#include "sanegl.h" 6.28 +#include "istereo.h" 6.29 +#include "sdr.h" 6.30 + 6.31 +void disp(void); 6.32 +void keyb(unsigned char key, int x, int y); 6.33 +void mouse(int bn, int st, int x, int y); 6.34 +void motion(int x, int y); 6.35 + 6.36 +int main(int argc, char **argv) 6.37 +{ 6.38 + glutInit(&argc, argv); 6.39 + glutInitWindowSize(640, 920); 6.40 + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); 6.41 + glutCreateWindow("test"); 6.42 + 6.43 + glutDisplayFunc(disp); 6.44 + glutIdleFunc(glutPostRedisplay); 6.45 + glutReshapeFunc(reshape); 6.46 + glutKeyboardFunc(keyb); 6.47 + glutMouseFunc(mouse); 6.48 + glutMotionFunc(motion); 6.49 + 6.50 + glewInit(); 6.51 + 6.52 + if(init() == -1) { 6.53 + return 1; 6.54 + } 6.55 + 6.56 + glutMainLoop(); 6.57 + return 0; 6.58 +} 6.59 + 6.60 +void disp(void) 6.61 +{ 6.62 + redraw(); 6.63 + 6.64 + glutSwapBuffers(); 6.65 +} 6.66 + 6.67 +extern int stereo; 6.68 +extern int use_bump; 6.69 + 6.70 +void keyb(unsigned char key, int x, int y) 6.71 +{ 6.72 + switch(key) { 6.73 + case 27: 6.74 + exit(0); 6.75 + 6.76 + case 's': 6.77 + stereo = !stereo; 6.78 + break; 6.79 + 6.80 + case 'b': 6.81 + use_bump = !use_bump; 6.82 + break; 6.83 + 6.84 + case '`': 6.85 + { 6.86 + int xsz = glutGet(GLUT_WINDOW_WIDTH); 6.87 + int ysz = glutGet(GLUT_WINDOW_HEIGHT); 6.88 + 6.89 + glutReshapeWindow(ysz, xsz); 6.90 + } 6.91 + break; 6.92 + 6.93 + default: 6.94 + break; 6.95 + } 6.96 +} 6.97 + 6.98 +void mouse(int bn, int st, int x, int y) 6.99 +{ 6.100 + mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN ? 1 : 0, x, y); 6.101 +} 6.102 + 6.103 +void motion(int x, int y) 6.104 +{ 6.105 + mouse_motion(x, y); 6.106 +}
7.1 --- a/src/glutmain.c Thu Sep 24 07:09:37 2015 +0300 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,89 +0,0 @@ 7.4 -/* 7.5 -Stereoscopic tunnel for iOS. 7.6 -Copyright (C) 2011 John Tsiombikas <nuclear@member.fsf.org> 7.7 - 7.8 -This program is free software: you can redistribute it and/or modify 7.9 -it under the terms of the GNU General Public License as published by 7.10 -the Free Software Foundation, either version 3 of the License, or 7.11 -(at your option) any later version. 7.12 - 7.13 -This program is distributed in the hope that it will be useful, 7.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of 7.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 7.16 -GNU General Public License for more details. 7.17 - 7.18 -You should have received a copy of the GNU General Public License 7.19 -along with this program. If not, see <http://www.gnu.org/licenses/>. 7.20 -*/ 7.21 - 7.22 - 7.23 -#include <stdio.h> 7.24 -#include <stdlib.h> 7.25 -#include <GL/glew.h> 7.26 -#include <GL/glut.h> 7.27 -#include "sanegl.h" 7.28 -#include "istereo.h" 7.29 -#include "sdr.h" 7.30 - 7.31 -void disp(void); 7.32 -void keyb(unsigned char key, int x, int y); 7.33 - 7.34 -int main(int argc, char **argv) 7.35 -{ 7.36 - glutInit(&argc, argv); 7.37 - glutInitWindowSize(640, 920); 7.38 - glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); 7.39 - glutCreateWindow("test"); 7.40 - 7.41 - glutDisplayFunc(disp); 7.42 - glutIdleFunc(glutPostRedisplay); 7.43 - glutReshapeFunc(reshape); 7.44 - glutKeyboardFunc(keyb); 7.45 - 7.46 - glewInit(); 7.47 - 7.48 - if(init() == -1) { 7.49 - return 1; 7.50 - } 7.51 - 7.52 - glutMainLoop(); 7.53 - return 0; 7.54 -} 7.55 - 7.56 -void disp(void) 7.57 -{ 7.58 - redraw(); 7.59 - 7.60 - glutSwapBuffers(); 7.61 -} 7.62 - 7.63 -extern int stereo; 7.64 -extern int use_bump; 7.65 - 7.66 -void keyb(unsigned char key, int x, int y) 7.67 -{ 7.68 - switch(key) { 7.69 - case 27: 7.70 - exit(0); 7.71 - 7.72 - case 's': 7.73 - stereo = !stereo; 7.74 - break; 7.75 - 7.76 - case 'b': 7.77 - use_bump = !use_bump; 7.78 - break; 7.79 - 7.80 - case '`': 7.81 - { 7.82 - int xsz = glutGet(GLUT_WINDOW_WIDTH); 7.83 - int ysz = glutGet(GLUT_WINDOW_HEIGHT); 7.84 - 7.85 - glutReshapeWindow(ysz, xsz); 7.86 - } 7.87 - break; 7.88 - 7.89 - default: 7.90 - break; 7.91 - } 7.92 -}
8.1 --- a/src/ui.cc Thu Sep 24 07:09:37 2015 +0300 8.2 +++ b/src/ui.cc Sat Sep 26 02:56:07 2015 +0300 8.3 @@ -2,6 +2,7 @@ 8.4 #include "ui.h" 8.5 #include "goatkit/goatkit.h" 8.6 #include "opengl.h" 8.7 +#include "sanegl.h" 8.8 #include "sdr.h" 8.9 8.10 static goatkit::Screen scr; 8.11 @@ -135,4 +136,4 @@ 8.12 void ui_motion(int x, int y) 8.13 { 8.14 scr.sysev_mouse_motion((float)x / (float)width, (float)y / (float)height); 8.15 -} 8.16 \ No newline at end of file 8.17 +}
9.1 --- a/src/uitheme.cc Thu Sep 24 07:09:37 2015 +0300 9.2 +++ b/src/uitheme.cc Sat Sep 26 02:56:07 2015 +0300 9.3 @@ -2,6 +2,7 @@ 9.4 #include <string> 9.5 #include "goatkit/goatkit.h" 9.6 #include "opengl.h" 9.7 +#include "sanegl.h" 9.8 #include "drawtext.h" 9.9 #include "sdr.h" 9.10 9.11 @@ -26,8 +27,9 @@ 9.12 9.13 static std::map<std::string, WidgetDrawFunc> funcmap; 9.14 9.15 -__attribute__ ((used)) 9.16 -extern "C" WidgetDrawFunc get_widget_func(const char *name) 9.17 + 9.18 +extern "C"// __attribute__ ((used)) 9.19 +WidgetDrawFunc get_widget_func(const char *name) 9.20 { 9.21 static bool initialized; 9.22 9.23 @@ -99,4 +101,4 @@ 9.24 gl_pop_matrix(); 9.25 gl_matrix_mode(GL_MODELVIEW); 9.26 gl_pop_matrix(); 9.27 -} 9.28 \ No newline at end of file 9.29 +}