comparison src/video/photon/SDL_ph_video.c @ 910:4ab6d1fd028f

Date: Sat, 26 Jun 2004 14:58:42 +0300 From: "Mike Gorchak" Subject: QNX 6.3 fixes for SDL Sam, I've added new OpenGL framework for SDL, which appeared in the new QNX version - 6.3. I've leave compatibility with previous QNX versions. And I've moved all GL specific functions to the separate module, like it done for the other platforms. SDL is now ready for the QNX 6.3 :)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 18 Jul 2004 19:46:38 +0000
parents 05c551e5bc64
children c9b51268668f
comparison
equal deleted inserted replaced
909:e247a0139900 910:4ab6d1fd028f
45 #include "SDL_ph_modes_c.h" 45 #include "SDL_ph_modes_c.h"
46 #include "SDL_ph_image_c.h" 46 #include "SDL_ph_image_c.h"
47 #include "SDL_ph_events_c.h" 47 #include "SDL_ph_events_c.h"
48 #include "SDL_ph_mouse_c.h" 48 #include "SDL_ph_mouse_c.h"
49 #include "SDL_ph_wm_c.h" 49 #include "SDL_ph_wm_c.h"
50 #include "SDL_ph_gl.h"
50 #include "SDL_phyuv_c.h" 51 #include "SDL_phyuv_c.h"
51 #include "blank_cursor.h" 52 #include "blank_cursor.h"
52 53
53 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat); 54 static int ph_VideoInit(_THIS, SDL_PixelFormat *vformat);
54 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); 55 static SDL_Surface *ph_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
55 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); 56 static int ph_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
56 static void ph_VideoQuit(_THIS); 57 static void ph_VideoQuit(_THIS);
57 static void ph_DeleteDevice(SDL_VideoDevice *device); 58 static void ph_DeleteDevice(SDL_VideoDevice *device);
58
59 #ifdef HAVE_OPENGL
60 static void ph_GL_SwapBuffers(_THIS);
61 static int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value);
62 static int ph_GL_LoadLibrary(_THIS, const char* path);
63 static void* ph_GL_GetProcAddress(_THIS, const char* proc);
64 static int ph_GL_MakeCurrent(_THIS);
65 #endif /* HAVE_OPENGL */
66 59
67 static int phstatus=-1; 60 static int phstatus=-1;
68 61
69 static int ph_Available(void) 62 static int ph_Available(void)
70 { 63 {
374 window=NULL; 367 window=NULL;
375 desktoppal=SDLPH_PAL_NONE; 368 desktoppal=SDLPH_PAL_NONE;
376 369
377 #ifdef HAVE_OPENGL 370 #ifdef HAVE_OPENGL
378 oglctx=NULL; 371 oglctx=NULL;
372 oglbuffers=NULL;
379 oglflags=0; 373 oglflags=0;
380 oglbpp=0; 374 oglbpp=0;
381 #endif /* HAVE_OPENGL */ 375 #endif /* HAVE_OPENGL */
382 376
383 old_video_mode=-1; 377 old_video_mode=-1;
661 } 655 }
662 656
663 return 1; 657 return 1;
664 } 658 }
665 659
666 #ifdef HAVE_OPENGL
667
668 static void ph_GL_SwapBuffers(_THIS)
669 {
670 PgSetRegion(PtWidgetRid(window));
671 PdOpenGLContextSwapBuffers(oglctx);
672 }
673
674 static int ph_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
675 {
676 switch (attrib)
677 {
678 case SDL_GL_DOUBLEBUFFER:
679 *value=this->gl_config.double_buffer;
680 break;
681 case SDL_GL_STENCIL_SIZE:
682 *value=this->gl_config.stencil_size;
683 break;
684 case SDL_GL_DEPTH_SIZE:
685 *value=this->gl_config.depth_size;
686 break;
687 default:
688 *value=0;
689 return(-1);
690 }
691 return 0;
692 }
693
694 static int ph_GL_LoadLibrary(_THIS, const char* path)
695 {
696 /* if code compiled with HAVE_OPENGL, that mean that library already linked */
697 this->gl_config.driver_loaded = 1;
698
699 return 0;
700 }
701
702 static void* ph_GL_GetProcAddress(_THIS, const char* proc)
703 {
704 return NULL;
705 }
706
707 static int ph_GL_MakeCurrent(_THIS)
708 {
709 PgSetRegion(PtWidgetRid(window));
710
711 if (oglctx!=NULL)
712 {
713 PhDCSetCurrent(oglctx);
714 }
715
716 return 0;
717 }
718
719 #endif /* HAVE_OPENGL */