Changed: #1275 Create an OpenGL ES driver

This commit is contained in:
kervala 2011-06-08 10:16:44 +02:00
parent 0f63f56969
commit 74c2952c32
2 changed files with 62 additions and 10 deletions

View file

@ -20,22 +20,67 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#ifdef USE_OPENGLES
# include <GLES/gl.h>
# include <GLES/glext.h>
#else
# ifdef NL_OS_MAC # ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# include "mac/glext.h" # include "mac/glext.h"
# else # else
# include <GL/gl.h> # include <GL/gl.h>
# include <GL/glext.h> // Please download it from http://www.opengl.org/registry/ # include <GL/glext.h>
# if defined(NL_OS_WINDOWS) # if defined(NL_OS_WINDOWS)
# include <GL/wglext.h> # include <GL/wglext.h>
# endif # endif
# endif # endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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. // The NEL Functions Typedefs.

View file

@ -113,7 +113,7 @@ protected:
bool _Invalid; bool _Invalid;
}; };
#ifndef USE_OPENGLES
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
@ -456,6 +456,8 @@ public:
#endif #endif
}; };
#endif
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// ARB_vertex_buffer_object implementation // ARB_vertex_buffer_object implementation
@ -553,6 +555,11 @@ private:
CVertexArrayRangeARB *_VertexArrayRange; CVertexArrayRangeARB *_VertexArrayRange;
CVertexBuffer::TPreferredMemory _MemType; CVertexBuffer::TPreferredMemory _MemType;
void *_VertexPtr; // pointer on current datas. Null if not locked 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 // if buffer has been invalidated, returns a dummy memory block and silently fails rendering
std::vector<uint8> _DummyVB; std::vector<uint8> _DummyVB;
// for use by CVertexArrayRangeARB // for use by CVertexArrayRangeARB