Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Date: Wed, 4 Mar 2009 15:38:22 +0200
Browse files Browse the repository at this point in the history
From: "Mike Gorchak"
Subject: Re: About QNX support in SDL 1.3

Here is another batch of patches.

1) Makefile.in - added SDL_opengles.h header as header to install.
2) configure.in - Added special define to detect Common Lite OpenGL ES
library in case if Common library is not installed. Added check for
clock_gettime in libc (in QNX it is in libc).
3) SDL_config.h.in - Added SDL_VIDEO_RENDER_OPENGL_ES and
SDL_VIDEO_OPENGL_ES declarations for configure script autodetection.
4) SDL_opengles.h - Added GL_API definition if it is not defined. Added
extension GL_OES_draw_texture because OpenGL ES Renderer uses it without
declaration. Added GL_OES_vertex_buffer_object extension, which is supported
under QNX OpenGL ES. Added GL_OES_single_precision extension.
5) To the test directory I've added building OpenGL ES test applications
through the autotools suite. Was support for iPhone IDE building only.
  • Loading branch information
slouken committed Mar 4, 2009
1 parent c60261f commit b6d6d77
Show file tree
Hide file tree
Showing 15 changed files with 1,108 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -42,7 +42,7 @@ SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@

DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode

HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
HDRS = SDL.h SDL_audio.h SDL_cdrom.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h

LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
Expand Down
9 changes: 7 additions & 2 deletions configure.in
Expand Up @@ -1705,12 +1705,12 @@ CheckOpenGLESQNX()
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_ES)
AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
else
AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
video_opengl=no
AC_TRY_COMPILE([
#define COMMON_LITE
#include <GLES/egl.h>
],[
],[
Expand All @@ -1719,7 +1719,6 @@ CheckOpenGLESQNX()
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_ES)
AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CL"
fi
fi
Expand Down Expand Up @@ -2295,6 +2294,12 @@ AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettime
if test x$have_clock_gettime = xyes; then
AC_DEFINE(HAVE_CLOCK_GETTIME)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
else
AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
if test x$have_clock_gettime = xyes; then
AC_DEFINE(HAVE_CLOCK_GETTIME)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
fi
fi
fi
}
Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.in
Expand Up @@ -310,10 +310,12 @@
#undef SDL_VIDEO_RENDER_D3D
#undef SDL_VIDEO_RENDER_GDI
#undef SDL_VIDEO_RENDER_OGL
#undef SDL_VIDEO_RENDER_OGL_ES
#undef SDL_VIDEO_RENDER_X11

/* Enable OpenGL support */
#undef SDL_VIDEO_OPENGL
#undef SDL_VIDEO_OPENGL_ES
#undef SDL_VIDEO_OPENGL_BGL
#undef SDL_VIDEO_OPENGL_CGL
#undef SDL_VIDEO_OPENGL_GLX
Expand Down
66 changes: 62 additions & 4 deletions include/SDL_opengles.h
Expand Up @@ -40,10 +40,6 @@ extern "C"
#include <OpenGLES/ES1/gl.h> /* Header File For The OpenGL ES Library */
#endif

#if defined(__QNXNTO__) && defined(SDL_VIDEO_OPENGL_ES)
#include <GLES/egl.h>
#endif

#ifndef APIENTRY
#define APIENTRY
#endif
Expand All @@ -52,6 +48,9 @@ extern "C"
#define GL_APIENTRY
#endif

#ifndef GL_API
#define GL_API
#endif /* GL_API */

/*
** License Applicability. Except to the extent portions of this file are
Expand Down Expand Up @@ -659,6 +658,29 @@ extern "C"
#define GL_COORD_REPLACE_OES 0x8862
#endif

/* GL_OES_draw_texture */
#ifndef GL_OES_draw_texture
#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
#endif /* GL_OES_draw_texture */

/* GL_OES_vertex_buffer_object */
#ifndef GL_OES_vertex_buffer_object
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_WRITE_ONLY 0x88B9
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_BUFFER_ACCESS 0x88BB
#endif /* GL_OES_vertex_buffer_object */

/*************************************************************/

/* Available only in Common profile */
Expand Down Expand Up @@ -945,6 +967,42 @@ extern "C"
#define GL_OES_point_sprite 1
#endif

/* GL_OES_draw_texture */
#ifndef GL_OES_draw_texture
#define GL_OES_draw_texture 1
GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
#endif /* GL_OES_draw_texture */

/* GL_OES_single_precision */
#ifndef GL_OES_single_precision
#define GL_OES_single_precision 1
GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar);
GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]);
GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
#endif /* GL_OES_single_precision */

/* GL_OES_vertex_buffer_object */
#ifndef GL_OES_vertex_buffer_object
#define GL_OES_vertex_buffer_object 1
GL_API void APIENTRY glBindBufferOES(GLenum, GLuint);
GL_API void APIENTRY glDeleteBuffersOES(GLsizei, const GLuint *);
GL_API void APIENTRY glGenBuffersOES(GLsizei, GLuint *);
GL_API GLboolean APIENTRY glIsBufferOES(GLuint);
GL_API void APIENTRY glBufferDataOES(GLenum, GLsizeiptr, const GLvoid *, GLenum);
GL_API void APIENTRY glBufferSubDataOES(GLenum, GLintptr, GLsizeiptr, const GLvoid *);
GL_API void APIENTRY glGetBufferParameterivOES(GLenum, GLenum, GLint *);
#endif /* GL_OES_vertex_buffer_object */

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/SDL_syswm.h
Expand Up @@ -169,7 +169,7 @@ struct SDL_SysWMinfo
int window; /* The RISC OS display window */
};

#elif defined(SDL_VIDEO_DRIVER_PHOTON)
#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
#include <sys/neutrino.h>
#include <Ph.h>

Expand All @@ -180,7 +180,7 @@ struct SDL_SysWMmsg
int data;
};

/* The QNX custom window manager information structure */
/* The QNX Photon custom window manager information structure */
struct SDL_SysWMinfo
{
SDL_version version;
Expand Down
69 changes: 69 additions & 0 deletions src/video/photon/SDL_photon.c
@@ -0,0 +1,69 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/

#include "SDL_config.h"

#include "../SDL_sysvideo.h"

static SDL_bool photon_initialized=SDL_FALSE;

static int photon_available(void)
{
int status;

/* Check if Photon was initialized before */
if (photon_initialized==SDL_FALSE)
{
/* Initialize Photon widget library and open channel to Photon */
status=PtInit(NULL);
if (status==0)
{
photon_initialized=SDL_TRUE;
return 1;
}
else
{
photon_initialized=SDL_FALSE;
return 0;
}
}

return 1;
}

static void photon_destroy(SDL_VideoDevice* device)
{
}

static SDL_VideoDevice* photon_create(int devindex)
{
}

VideoBootStrap photon_bootstrap=
{
"photon",
"SDL Photon video driver",
photon_available,
photon_create
};

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit b6d6d77

Please sign in to comment.