RETVAL
+int
+video_GL_load_library ( path )
+ char *path
+ CODE:
+ RETVAL = SDL_GL_LoadLibrary(path);
+ OUTPUT:
+ RETVAL
+
+void*
+video_GL_get_proc_address ( proc )
+ char *proc
+ CODE:
+ RETVAL = SDL_GL_GetProcAddress(proc);
+ OUTPUT:
+ RETVAL
+
+int
+video_GL_set_attribute ( attr, value )
+ int attr
+ int value
+ CODE:
+ RETVAL = SDL_GL_SetAttribute(attr, value);
+ OUTPUT:
+ RETVAL
+
+AV *
+video_GL_get_attribute ( attr )
+ int attr
+ CODE:
+ int value;
+ RETVAL = newAV();
+ av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
+ av_push(RETVAL,newSViv(value));
+ OUTPUT:
+ RETVAL
+
+void
+video_GL_swap_buffers ()
+ CODE:
+ SDL_GL_SwapBuffers ();
+
+
+
#endif
int
-GLLoadLibrary ( path )
- char *path
- CODE:
- RETVAL = SDL_GL_LoadLibrary(path);
- OUTPUT:
- RETVAL
-
-void*
-GLGetProcAddress ( proc )
- char *proc
- CODE:
- RETVAL = SDL_GL_GetProcAddress(proc);
- OUTPUT:
- RETVAL
-
-int
-GLSetAttribute ( attr, value )
- int attr
- int value
- CODE:
- RETVAL = SDL_GL_SetAttribute(attr, value);
- OUTPUT:
- RETVAL
-
-AV *
-GLGetAttribute ( attr )
- int attr
- CODE:
- int value;
- RETVAL = newAV();
- av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
- av_push(RETVAL,newSViv(value));
- OUTPUT:
- RETVAL
-
-void
-GLSwapBuffers ()
- CODE:
- SDL_GL_SwapBuffers ();
-
-
-int
BigEndian ()
CODE:
RETVAL = (SDL_BYTEORDER == SDL_BIG_ENDIAN);
use Test::More;
use SDL::Rect;
-plan ( tests => 44);
+plan ( tests => 50);
use_ok( 'SDL::Video' );
lock_YUV_overlay
unlock_YUV_overlay
display_YUV_overlay
+ GL_load_library
+ GL_get_proc_address
+ GL_get_attribute
+ GL_set_attribute
+ GL_swap_buffers
/;
can_ok ('SDL::Video', @done);
#testing get_video_surface
SDL::init(SDL_INIT_VIDEO);
-
+
+#needs to be done before set_video_mode
+my $glVal = SDL::Video::GL_load_library('this/should/fail');
+
+is ($glVal, -1, '[GL_load_library] Failed appropraitly');
+
+TODO: {
+local $TODO = 'These should be tested with OS specific DLL or SO';
+is (SDL::Video::GL_load_library('t/realGL.so'), 0, '[GL_load_libary] returns 0 on success');
+# this gets set by GL_load_library => SDL_GL_LOADLIBARY. How do we get this from XS though?
+# below t/realGL.so needs to use SDL_GL_LOADLIBRARY
+isnt(SDL::Video::GL_get_proc_address('t/realGL.so'), NULL, '[GL_get_proc_address] returns not null on success');
+is (SDL::Video::GL_set_attribute( SDL_GL_DOUBLEBUFFER, 1) , 0 , '[GL_set_attribute] returns 0 on success');
+my $tdisplay = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
+my $value = -3;
+SDL::Video::GL_set_attribute( SDL_GL_DOUBLEBUFFER, $value);
+is ($value , 1 , '[GL_get_attribute] returns 1 on success as set above');
+
+SDL::Video::GL_swap_buffers(); pass ( '[GL_swap_buffers] should work because Double Buffering is turned on');
+
+
+};
+
+
my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
if(!$display){
my @left = qw/
get_gamma_ramp
- GL_load_library
- GL_get_proc_address
- GL_get_attribute
- GL_set_attribute
- GL_swap_buffers
- GL_attr
/;
-my $why = '[Percentage Completion] '.int( 100 * $#done / ($#done + $#left) ) ."\% implementation. $#done / ".($#done+$#left);
+my $why = '[Percentage Completion] '.int( 100 * ($#done +1) / ($#done + $#left + 2) ) ."\% implementation. ". ($#done +1)." / ".($#done+$#left + 2);
TODO:
{