os/graphics/m3g/m3gcore11/inc/m3g_gl.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/m3g/m3gcore11/inc/m3g_gl.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,107 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: OpenGL utility functions and definitions
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef __M3G_GL_H__
    1.22 +#define __M3G_GL_H__
    1.23 +
    1.24 +/*!
    1.25 + * \internal
    1.26 + * \file
    1.27 + * \brief OpenGL utility functions and definitions
    1.28 + */
    1.29 +
    1.30 +#include "M3G/m3g_core.h"
    1.31 +#include "m3g_defs.h"
    1.32 +
    1.33 +#if !(defined(M3G_NGL_CONTEXT_API) || defined(M3G_NGL_TEXTURE_API))
    1.34 +#   include <GLES/gl.h>
    1.35 +#   include <EGL/egl.h>
    1.36 +#else
    1.37 +
    1.38 +/*@notfunction@*/
    1.39 +#   define NGL_PREFIX(func)     gl ## func
    1.40 +/*@notfunction@*/
    1.41 +#   define NGLI_PREFIX(func)    ngl ## func
    1.42 +/*@notfunction@*/
    1.43 +#   define NGLU_PREFIX(func)    nglu ## func
    1.44 +#   include "ngl.h"
    1.45 +
    1.46 +#endif
    1.47 +
    1.48 +#if defined(__cplusplus)
    1.49 +extern "C" {
    1.50 +#endif
    1.51 +    
    1.52 +/*----------------------------------------------------------------------
    1.53 + * Handy macros
    1.54 + *--------------------------------------------------------------------*/
    1.55 +
    1.56 +#if defined(M3G_DEBUG_ASSERTS)
    1.57 +    static M3G_INLINE void m3gAssertGL(const char *filename, int line)
    1.58 +    {
    1.59 +        GLint err = glGetError();
    1.60 +        if (err != GL_NO_ERROR) {
    1.61 +            M3G_LOG3(M3G_LOG_FATAL_ERRORS, "GL error 0x%X (%s: %d)\n",
    1.62 +                     err, filename, line);
    1.63 +            M3G_ASSERT(M3G_FALSE);
    1.64 +        }
    1.65 +    }
    1.66 +#   define M3G_ASSERT_GL m3gAssertGL(__FILE__, __LINE__)
    1.67 +#else
    1.68 +#   define M3G_ASSERT_GL
    1.69 +#endif
    1.70 +
    1.71 +#define M3G_GLTYPE(m3gType) ((m3gType) + 0x1400)
    1.72 +#define M3G_M3GTYPE(glType) ((glType) - 0x1400)
    1.73 +
    1.74 +/*----------------------------------------------------------------------
    1.75 + * Internal functions
    1.76 + *--------------------------------------------------------------------*/
    1.77 +    
    1.78 +static GLenum m3gGetGLFormat(M3GPixelFormat format);    /* m3g_image.inl */
    1.79 +static void m3gGLColor(M3Guint argb, GLfixed *dst);     /* m3g_image.c */
    1.80 +
    1.81 +#if !defined(M3G_NGL_CONTEXT_API)
    1.82 +static void m3gInitializeEGL(void);     /* m3g_rendercontext.inl */
    1.83 +static void m3gTerminateEGL(void);      /* m3g_rendercontext.inl */
    1.84 +#endif
    1.85 +
    1.86 +/*----------------------------------------------------------------------
    1.87 + * Native platform abstraction layer
    1.88 + *--------------------------------------------------------------------*/
    1.89 +    
    1.90 +#if !defined(M3G_NGL_CONTEXT_API)
    1.91 +    
    1.92 +M3Gbool m3gglLockNativeBitmap(M3GNativeBitmap bitmap,
    1.93 +                              M3Gubyte **ptr,
    1.94 +                              M3Gsizei *stride);
    1.95 +void    m3gglReleaseNativeBitmap(M3GNativeBitmap bitmap);
    1.96 +    
    1.97 +M3Gbool m3gglGetNativeBitmapParams(M3GNativeBitmap bitmap,
    1.98 +                                   M3GPixelFormat *format,
    1.99 +                                   M3Gint *width, M3Gint *height, M3Gint *pixels);
   1.100 +M3Gbool m3gglGetNativeWindowParams(M3GNativeWindow wnd,
   1.101 +                                   M3GPixelFormat *format,
   1.102 +                                   M3Gint *width, M3Gint *height);
   1.103 +    
   1.104 +#endif /* M3G_NGL_CONTEXT_API */
   1.105 +    
   1.106 +#if defined(__cplusplus)
   1.107 +} /* extern "C" */
   1.108 +#endif
   1.109 +
   1.110 +#endif /*__M3G_GL_H__*/