guestrendering/guestopengles11/inc/opengl.h
branchbug235_bringup_0
changeset 16 1b3a923fcf07
child 24 a3f46bb01be2
equal deleted inserted replaced
15:86401090b67f 16:1b3a923fcf07
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Header file for the Guest OpenGL ES 1.1 serialization stubs
       
    15 
       
    16 #ifndef __GUESTOPENGLES11_OPENGL_H__
       
    17 #define __GUESTOPENGLES11_OPENGL_H__
       
    18 
       
    19 #include <e32debug.h>
       
    20 
       
    21 // set trace level here
       
    22 #ifndef _OPENGL_TRACE_LEVEL_
       
    23 #define _OPENGL_TRACE_LEVEL_ ( _APICALL_ )
       
    24 #endif
       
    25 
       
    26 // trace levels (in udeb mode)
       
    27 
       
    28 #define _NONE_      0x0000      // no traces in udeb mode
       
    29 #define _GEN_       (1 << 0)    // general traces (default)
       
    30 #define _APICALL_   (1 << 1)    // API call traces (function entry and exit)
       
    31 #define _DETAIL_    (1 << 2)    // detailed traces
       
    32 #define _ALL_       0xFFFF
       
    33 
       
    34 
       
    35 #ifdef _DEBUG
       
    36     #define OPENGL_TRACE(level, fmt, args...)   \
       
    37     {                                           \
       
    38         if(level & _OPENGL_TRACE_LEVEL_)        \
       
    39         {                                       \
       
    40             RDebug::Printf(fmt, ##args);        \
       
    41         }                                       \
       
    42     }
       
    43 	#define GLPANIC_ASSERT(condition, panic) if (!(condition)) { GlesPanic(panic, #condition, __FILE__, __LINE__); }
       
    44 	#define GLPANIC_ASSERT_DEBUG(condition, panic) if (!(condition)) { GlesPanic(panic, #condition, __FILE__, __LINE__); }
       
    45 #else
       
    46     #define OPENGL_TRACE(level, fmt, args...)
       
    47 	#define GLPANIC_ASSERT(condition, panic) if (!(condition)) { GlesPanic(panic, NULL, NULL, __LINE__); }
       
    48 	#define GLPANIC_ASSERT_DEBUG(condition, panic)
       
    49 #endif
       
    50 
       
    51 // Guest Open VG panic codes
       
    52 typedef enum
       
    53 	{
       
    54 	EGlPanicNotReplyOpcode = 1,
       
    55 	} TGlPanic;
       
    56 
       
    57 void GlesPanic(TGlPanic aPanicCode, char* aCondition, char* aFile, TInt aLine);
       
    58 
       
    59 
       
    60 /* String constants */
       
    61 #define OGL_VENDOR_STRING        "Nokia"
       
    62 #define OGL_RENDERER_STRING      "1.1.0"
       
    63 #define OGL_VERSION_STRING       "OpenGL ES-CM 1.1"
       
    64 #define OGL_EXTENSION_STRING     "GL_OES_byte_coordinates GL_OES_fixed_point GL_OES_single_precision "               \
       
    65                                  "GL_OES_read_format GL_OES_query_matrix GL_OES_compressed_paletted_texture "        \
       
    66                                  "GL_OES_matrix_palette GL_OES_point_sprite GL_OES_point_size_array "                \
       
    67                                  "GL_OES_draw_texture GL_OES_matrix_get GL_OES_swap_control GL_OES_render_texture"
       
    68 
       
    69 static const char* const g_strings[] =
       
    70 {
       
    71     OGL_VENDOR_STRING,
       
    72     OGL_RENDERER_STRING,
       
    73     OGL_VERSION_STRING,
       
    74     OGL_EXTENSION_STRING
       
    75 };
       
    76 
       
    77 /* vertex array pointers */
       
    78 enum
       
    79 {
       
    80     COLOR_ARRAY,
       
    81     NORMAL_ARRAY,
       
    82     POINT_SIZE_ARRAY,
       
    83     TEX_COORD_ARRAY,
       
    84     VERTEX_ARRAY,
       
    85     MATRIX_INDEX_ARRAY,
       
    86     WEIGHT_ARRAY,
       
    87     NUM_ARRAYS
       
    88 };
       
    89 
       
    90 typedef struct
       
    91 {
       
    92     GLint size;
       
    93     GLenum type;
       
    94     GLsizei stride;
       
    95     const GLvoid *pointer;
       
    96 } vertexArrayInfo;
       
    97 
       
    98 
       
    99 NONSHARABLE_CLASS(TGles11ApiForEgl) : public MGles11ApiForEgl
       
   100 	{
       
   101 public:
       
   102 	TGles11ApiForEgl(); // constructor used to publish the MGles11ApiForEgl vtable
       
   103 	~TGles11ApiForEgl(); // destructor used to unpublish the MGles11ApiForEgl vtable
       
   104 	virtual ExtensionProcPointer guestGetGles11ProcAddress (const char *aProcName);
       
   105 	};
       
   106 
       
   107 #endif // __GUESTOPENGLES11_OPENGL_H__