From 74c2952c320241727b7bdae9a2c927767640e49b Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 8 Jun 2011 10:16:44 +0200 Subject: [PATCH] Changed: #1275 Create an OpenGL ES driver --- .../opengl/driver_opengl_extension_def.h | 63 ++++++++++++++++--- .../opengl/driver_opengl_vertex_buffer_hard.h | 9 ++- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h index decd4a0c5..c1ecfe8c0 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h @@ -20,22 +20,67 @@ #include "nel/misc/types_nl.h" -#ifdef NL_OS_MAC -# define GL_GLEXT_LEGACY -# include -# include "mac/glext.h" +#ifdef USE_OPENGLES +# include +# include #else -# include -# include // Please download it from http://www.opengl.org/registry/ -# if defined(NL_OS_WINDOWS) -# include -# endif +# ifdef NL_OS_MAC +# define GL_GLEXT_LEGACY +# include +# include "mac/glext.h" +# else +# include +# include +# if defined(NL_OS_WINDOWS) +# include +# endif +# endif #endif #ifdef __cplusplus extern "C" { #endif +#ifdef USE_OPENGLES +// OES_mapbuffer +//============== +typedef void* (APIENTRY * NEL_PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRY * NEL_PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (APIENTRY * NEL_PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params); + +typedef void (APIENTRY * NEL_PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); + +// GL_OES_framebuffer_object +//================================== +typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer); +typedef void (APIENTRY * NEL_PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (APIENTRY * NEL_PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRY * NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer); +typedef void (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers); +typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target); +typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRY * NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (APIENTRY * NEL_PFNGLGENERATEMIPMAPOESPROC) (GLenum target); + +// GL_OES_texture_cube_map +//================================== +typedef void (APIENTRY * NEL_PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param); +typedef void (APIENTRY * NEL_PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * NEL_PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param); +typedef void (APIENTRY * NEL_PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params); +typedef void (APIENTRY * NEL_PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params); +typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); +typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +#endif + // *************************************************************************** // *************************************************************************** // The NEL Functions Typedefs. diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h index a2b7111f4..da454c558 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h @@ -113,7 +113,7 @@ protected: bool _Invalid; }; - +#ifndef USE_OPENGLES // *************************************************************************** // *************************************************************************** @@ -456,6 +456,8 @@ public: #endif }; +#endif + // *************************************************************************** // *************************************************************************** // ARB_vertex_buffer_object implementation @@ -553,6 +555,11 @@ private: CVertexArrayRangeARB *_VertexArrayRange; CVertexBuffer::TPreferredMemory _MemType; void *_VertexPtr; // pointer on current datas. Null if not locked +#ifdef USE_OPENGLES + uint8 *_Buffer; + uint32 _BufferSize; + uint32 _LastBufferSize; +#endif // if buffer has been invalidated, returns a dummy memory block and silently fails rendering std::vector _DummyVB; // for use by CVertexArrayRangeARB