Send them to Gitorious, to me ( maemo at javispedro dot com ) or attach them here.
file:sdlgl.c /* Including math.h is not bad. It may become useful somehow */ #include <math.h> /* what about establishing a surface? */ SDL_Surface *surface; /* variable context, better or worse? */ /* perspective replacement for opengles? */ void gluPerspective(double fovy,double aspect,double zNear,double zFar) { double xmin,xmax,ymin,ymax; ymax = zNear * tan(fovy * M_PI / 360); ymin=-ymax; xmin=ymin*aspect; xmax=ymax*aspect; glFrustumf(xmin,xmax,ymin,ymax,zNear,zFar); } /* defining screen resolution? */ #define SCREEN_WIDTH 800 #define SCREEN_HEIGHT 480 #define SCREEN_BPP 16 int resizeWindow(int width,int height) { GLfloat ratio; if(height==0) height =1; ratio=(GLfloat)width/(GLfloat)height; glViewport(0,0,(GLsizei)width,(GLsizei)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,ratio,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); return(1); } /* a function for later use */ int initGL(GLvoid) { static int gles_init ... SDL_GLES_MakeCurrent(context); /* maybe some applications require background color and smoothing? */ glShadeModel(GL_SMOOTH); glClearColor(0.0f,0.0f,0.0f,0.0f); glHint(GL_PERSPECTIVE_CORRECTION,GL_NICEST); glEnableClientState(GL_VERTEX_ARRAY); return(1); } /* buffer cleaning might be needed */ glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
/* Using additional function */ int FilterEvents(const SDL_Event *event) { static int boycott = 1; /* This quit event signals the closing of the window */ if ( (event->type == SDL_QUIT) && boycott ) { printf("Quit event filtered out -- try again.\n"); boycott = 0; return(0); } if ( event->type == SDL_MOUSEMOTION ) { printf("Mouse moved to (%d,%d)\n", event->motion.x, event->motion.y); return(0); /* Drop it, we've handled it */ } return(1); } SDL_SetEventFilter(FilterEvents);