Funciones en dl_init. main() ligeramente optimizado
authorslack <slack@codemaniacs.com>
Sun, 30 Aug 2009 00:18:22 +0000 (02:18 +0200)
committerslack <slack@codemaniacs.com>
Sun, 30 Aug 2009 00:19:23 +0000 (02:19 +0200)
dl_init.c
dl_init.h
main.c

index 79ddf34df374943de61f6cd8bf54f0aa557de759..d48cbd5762dce6ed167936bf42c0637627d28db5 100644 (file)
--- a/dl_init.c
+++ b/dl_init.c
@@ -10,17 +10,14 @@ char *names="libSDL-1.2.so.0\0SDL_Init\0SDL_Quit\0SDL_OpenAudio\0"
 
            "libm.so\0powf\0fmodf\0"//expf\0"
            
-           "libc.so.6\0rand\0srand\0time\0"
+           "libc.so.6\0rand\0srand\0"
            
-           "libGL.so\0glBegin\0glEnd\0glColor4f\0glVertex3fv\0glRotatef\0"
-           "glEnable\0glMatrixMode\0glLoadIdentity\0glClear\0"
-           "glBlendFunc\0glTranslatef\0glPushMatrix\0glPopMatrix\0glRectf\0"
-           "glClearColor\0glXUseXFont\0glRasterPos2f\0glCallLists\0"
+           "libGL.so\0glRotatef\0"
+           "glBindTexture\0glCopyTexSubImage2D\0glInterleavedArrays\0"
+           "glEnable\0glDisable\0glMatrixMode\0glLoadIdentity\0glClear\0"
+           "glRecti\0glClearColor\0"
 
            "libGLU.so\0gluPerspective\0gluLookAt\0"
-
-           "libX11.so\0XOpenDisplay\0XLoadQueryFont\0"
-           
            "\0";
 
 
index d4074859d668f03b373e93fdc51ab9d6b8672271..c461fd8bb0059adce0063557ff6c5f2becc472d8 100644 (file)
--- a/dl_init.h
+++ b/dl_init.h
@@ -29,36 +29,29 @@ typedef struct
        // libc
        int     (*rand)(void);
        void    (*srand)(unsigned int);
-       time_t  (*time)(time_t*);
        
        // libGL
-       void    (*glBegin)(GLenum);
-       void    (*glEnd)(void);
-       void    (*glColor4f)(GLfloat, GLfloat, GLfloat, GLfloat);
-       //void  (*glVertex3f)(GLfloat, GLfloat, GLfloat);
-       void    (*glVertex3fv)(const GLfloat*);
        void    (*glRotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
+       void    (*glBindTexture)(GLenum, GLuint);
+       void    (*glCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+       void    (*glInterleavedArrays)(GLenum, GLsizei, const GLvoid*);
        void    (*glEnable)(GLenum);
-       //void  (*glDisable)(GLenum);
+       void    (*glDisable)(GLenum);
        void    (*glMatrixMode)(GLenum);
        void    (*glLoadIdentity)(void);
        void    (*glClear)(GLbitfield);
        //void  (*glScalef)(GLfloat, GLfloat, GLfloat);
-       void    (*glBlendFunc)(GLenum, GLenum);
-       void    (*glTranslatef)(GLfloat, GLfloat, GLfloat);
-       //void  (*glNormal3f)(GLfloat, GLfloat, GLfloat);
-       //void  (*glTexGeni)(GLenum, GLenum, GLint);
-       //void  (*glGetFloatv)(GLenum, GLfloat *);
-       void    (*glPushMatrix)(void);
-       void    (*glPopMatrix)(void);
+       //void  (*glBlendFunc)(GLenum, GLenum);
+       //void  (*glTranslatef)(GLfloat, GLfloat, GLfloat);
+       //void  (*glPushMatrix)(void);
+       //void  (*glPopMatrix)(void);
        //void  (*glTexCoord2f)(GLfloat, GLfloat);
-       //void  (*glBindTexture)(GLenum, GLuint);
-       //void  (*glGenTextures)(GLsizei, GLuint *);
-       void    (*glRectf)(GLfloat, GLfloat, GLfloat, GLfloat);
+       void    (*glBindTexture)(GLenum, GLuint);
+       void    (*glRecti)(GLint, GLint, GLint, GLint);
        void    (*glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat);
-       void    (*glXUseXFont)(Font, int, int, int);
-       void    (*glRasterPos2f)(GLfloat, GLfloat);
-       void    (*glCallLists)(GLsizei, GLenum, const GLvoid *);
+       //void    (*glXUseXFont)(Font, int, int, int);
+       //void  (*glRasterPos2f)(GLfloat, GLfloat);
+       //void  (*glCallLists)(GLsizei, GLenum, const GLvoid *);
 
        // libGLU
        void    (*gluPerspective)(GLdouble, GLdouble, GLdouble, GLdouble);
@@ -69,8 +62,8 @@ typedef struct
        //                      GLenum, GLenum, const void *);
 
        // libX11.so
-       Display* (*XOpenDisplay)(int);
-       XFontStruct* (*XLoadQueryFont)(Display*, char *);
+       //Display* (*XOpenDisplay)(int);
+       //XFontStruct* (*XLoadQueryFont)(Display*, char *);
 
 } FN_STRUCT;
 
diff --git a/main.c b/main.c
index 8752b8451adb24570f3492098585924716e8f028..2857f559b7f7b3c9f226fc1f0a9420812ce3aa9a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -85,23 +85,12 @@ void __attribute__((externally_visible)) _start(void)
        fn.SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,32,SDL_OPENGL);
        fn.SDL_ShowCursor(0);
 
-       initTextures();
-       initModels();
-
-       while(1)
+       do
        {
                current_t = fn.SDL_GetTicks()/1000.0f;
-               while(fn.SDL_PollEvent(&event))
-               {
-                       if (event.type == SDL_KEYDOWN)
-                               goto end;
-               }
-               drawScene();
-               endRenderTexture();
-               drawPostProcess();
-               
                fn.SDL_GL_SwapBuffers();
-       }
+               fn.SDL_PollEvent(&event);
+       } while(event.type != SDL_KEYDOWN);
 
 end:
        fn.SDL_Quit();