sl@0: /* sl@0: * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: OpenGL utility functions and definitions sl@0: * sl@0: */ sl@0: sl@0: #ifndef __M3G_GL_H__ sl@0: #define __M3G_GL_H__ sl@0: sl@0: /*! sl@0: * \internal sl@0: * \file sl@0: * \brief OpenGL utility functions and definitions sl@0: */ sl@0: sl@0: #include "M3G/m3g_core.h" sl@0: #include "m3g_defs.h" sl@0: sl@0: #if !(defined(M3G_NGL_CONTEXT_API) || defined(M3G_NGL_TEXTURE_API)) sl@0: # include sl@0: # include sl@0: #else sl@0: sl@0: /*@notfunction@*/ sl@0: # define NGL_PREFIX(func) gl ## func sl@0: /*@notfunction@*/ sl@0: # define NGLI_PREFIX(func) ngl ## func sl@0: /*@notfunction@*/ sl@0: # define NGLU_PREFIX(func) nglu ## func sl@0: # include "ngl.h" sl@0: sl@0: #endif sl@0: sl@0: #if defined(__cplusplus) sl@0: extern "C" { sl@0: #endif sl@0: sl@0: /*---------------------------------------------------------------------- sl@0: * Handy macros sl@0: *--------------------------------------------------------------------*/ sl@0: sl@0: #if defined(M3G_DEBUG_ASSERTS) sl@0: static M3G_INLINE void m3gAssertGL(const char *filename, int line) sl@0: { sl@0: GLint err = glGetError(); sl@0: if (err != GL_NO_ERROR) { sl@0: M3G_LOG3(M3G_LOG_FATAL_ERRORS, "GL error 0x%X (%s: %d)\n", sl@0: err, filename, line); sl@0: M3G_ASSERT(M3G_FALSE); sl@0: } sl@0: } sl@0: # define M3G_ASSERT_GL m3gAssertGL(__FILE__, __LINE__) sl@0: #else sl@0: # define M3G_ASSERT_GL sl@0: #endif sl@0: sl@0: #define M3G_GLTYPE(m3gType) ((m3gType) + 0x1400) sl@0: #define M3G_M3GTYPE(glType) ((glType) - 0x1400) sl@0: sl@0: /*---------------------------------------------------------------------- sl@0: * Internal functions sl@0: *--------------------------------------------------------------------*/ sl@0: sl@0: static GLenum m3gGetGLFormat(M3GPixelFormat format); /* m3g_image.inl */ sl@0: static void m3gGLColor(M3Guint argb, GLfixed *dst); /* m3g_image.c */ sl@0: sl@0: #if !defined(M3G_NGL_CONTEXT_API) sl@0: static void m3gInitializeEGL(void); /* m3g_rendercontext.inl */ sl@0: static void m3gTerminateEGL(void); /* m3g_rendercontext.inl */ sl@0: #endif sl@0: sl@0: /*---------------------------------------------------------------------- sl@0: * Native platform abstraction layer sl@0: *--------------------------------------------------------------------*/ sl@0: sl@0: #if !defined(M3G_NGL_CONTEXT_API) sl@0: sl@0: M3Gbool m3gglLockNativeBitmap(M3GNativeBitmap bitmap, sl@0: M3Gubyte **ptr, sl@0: M3Gsizei *stride); sl@0: void m3gglReleaseNativeBitmap(M3GNativeBitmap bitmap); sl@0: sl@0: M3Gbool m3gglGetNativeBitmapParams(M3GNativeBitmap bitmap, sl@0: M3GPixelFormat *format, sl@0: M3Gint *width, M3Gint *height, M3Gint *pixels); sl@0: M3Gbool m3gglGetNativeWindowParams(M3GNativeWindow wnd, sl@0: M3GPixelFormat *format, sl@0: M3Gint *width, M3Gint *height); sl@0: sl@0: #endif /* M3G_NGL_CONTEXT_API */ sl@0: sl@0: #if defined(__cplusplus) sl@0: } /* extern "C" */ sl@0: #endif sl@0: sl@0: #endif /*__M3G_GL_H__*/