Update contrib.
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: OpenGL utility functions and definitions
24 * \brief OpenGL utility functions and definitions
27 #include "M3G/m3g_core.h"
30 #if !(defined(M3G_NGL_CONTEXT_API) || defined(M3G_NGL_TEXTURE_API))
36 # define NGL_PREFIX(func) gl ## func
38 # define NGLI_PREFIX(func) ngl ## func
40 # define NGLU_PREFIX(func) nglu ## func
45 #if defined(__cplusplus)
49 /*----------------------------------------------------------------------
51 *--------------------------------------------------------------------*/
53 #if defined(M3G_DEBUG_ASSERTS)
54 static M3G_INLINE void m3gAssertGL(const char *filename, int line)
56 GLint err = glGetError();
57 if (err != GL_NO_ERROR) {
58 M3G_LOG3(M3G_LOG_FATAL_ERRORS, "GL error 0x%X (%s: %d)\n",
60 M3G_ASSERT(M3G_FALSE);
63 # define M3G_ASSERT_GL m3gAssertGL(__FILE__, __LINE__)
65 # define M3G_ASSERT_GL
68 #define M3G_GLTYPE(m3gType) ((m3gType) + 0x1400)
69 #define M3G_M3GTYPE(glType) ((glType) - 0x1400)
71 /*----------------------------------------------------------------------
73 *--------------------------------------------------------------------*/
75 static GLenum m3gGetGLFormat(M3GPixelFormat format); /* m3g_image.inl */
76 static void m3gGLColor(M3Guint argb, GLfixed *dst); /* m3g_image.c */
78 #if !defined(M3G_NGL_CONTEXT_API)
79 static void m3gInitializeEGL(void); /* m3g_rendercontext.inl */
80 static void m3gTerminateEGL(void); /* m3g_rendercontext.inl */
83 /*----------------------------------------------------------------------
84 * Native platform abstraction layer
85 *--------------------------------------------------------------------*/
87 #if !defined(M3G_NGL_CONTEXT_API)
89 M3Gbool m3gglLockNativeBitmap(M3GNativeBitmap bitmap,
92 void m3gglReleaseNativeBitmap(M3GNativeBitmap bitmap);
94 M3Gbool m3gglGetNativeBitmapParams(M3GNativeBitmap bitmap,
95 M3GPixelFormat *format,
96 M3Gint *width, M3Gint *height, M3Gint *pixels);
97 M3Gbool m3gglGetNativeWindowParams(M3GNativeWindow wnd,
98 M3GPixelFormat *format,
99 M3Gint *width, M3Gint *height);
101 #endif /* M3G_NGL_CONTEXT_API */
103 #if defined(__cplusplus)
107 #endif /*__M3G_GL_H__*/