hostsupport/hostopengles20/src/GLES2/hgl.c
branchbug235_bringup_0
changeset 53 c2ef9095503a
parent 20 d2d6724aef32
equal deleted inserted replaced
52:39e5f73667ba 53:c2ef9095503a
       
     1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2  *
       
     3  * Permission is hereby granted, free of charge, to any person obtaining a
       
     4  * copy of this software and associated documentation files (the "Software"),
       
     5  * to deal in the Software without restriction, including without limitation
       
     6  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
       
     7  * and/or sell copies of the Software, and to permit persons to whom the
       
     8  * Software is furnished to do so, subject to the following conditions:
       
     9  *
       
    10  * The above copyright notice and this permission notice shall be included
       
    11  * in all copies or substantial portions of the Software.
       
    12  *
       
    13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
       
    14  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       
    16  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
       
    17  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
       
    18  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
       
    19  *
       
    20  * Initial Contributors:
       
    21  * Nokia Corporation - initial contribution.
       
    22  *
       
    23  * Contributors:
       
    24  *
       
    25  * Description:
       
    26  *
       
    27  */
       
    28 
       
    29 #include "common.h"
       
    30 #include "hgl.h"
       
    31 #include "degl.h"
       
    32 
       
    33 // Load the host renderer OpenGL functions.
       
    34 int hglLoad(HGL* hgl)
       
    35 {
       
    36     Dprintf("Loading GL functions...\n", 0);
       
    37 
       
    38 #if(CONFIG_STATIC == 1)
       
    39 #	define HGL_FUNC(ret, name, attr) \
       
    40         if(degl_handle == (void*)-1) \
       
    41         { \
       
    42             extern ret GL_APIENTRY mgl##name attr; \
       
    43             hgl->name = &mgl##name; \
       
    44         } \
       
    45         else if((hgl->name = deglGetHostProcAddress("gl" #name)) == NULL) \
       
    46         { \
       
    47             fprintf(stderr, "Function gl" #name " not found!\n"); \
       
    48         }
       
    49 #else
       
    50 #	define HGL_FUNC(ret, name, attr) \
       
    51         { \
       
    52         union {void *ptr; ret(GL_APIENTRY* fptr)attr;} ass; \
       
    53         ass.ptr = deglGetHostProcAddress("gl" #name); \
       
    54         if((hgl->name = ass.fptr) == NULL) \
       
    55         { \
       
    56             fprintf(stderr, "Function gl" #name " not found!\n"); \
       
    57         }\
       
    58         }
       
    59 #endif // CONFIG_STATIC != 1
       
    60 
       
    61     HGL_FUNCS
       
    62 
       
    63 #undef HGL_FUNC
       
    64 
       
    65     return 1;
       
    66 }