~thumper/nux/next-changes

« back to all changes in this revision

Viewing changes to NuxGraphics/GLError.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 21:15:42 UTC
  • Revision ID: neil.patel@canonical.com-20100901211542-cw2ce3ak28unouwb
Add NuxGraphics with licensing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Inalogic Inc.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it 
 
5
 * under the terms of the GNU Lesser General Public License version 3, as
 
6
 * published by the  Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but 
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of 
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 
 
11
 * PURPOSE.  See the applicable version of the GNU Lesser General Public 
 
12
 * License for more details.
 
13
 * 
 
14
 * You should have received a copy of both the GNU Lesser General Public 
 
15
 * License version 3 along with this program.  If not, see 
 
16
 * <http://www.gnu.org/licenses/>
 
17
 *
 
18
 * Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
 
19
 *
 
20
 */
 
21
 
 
22
 
 
23
#ifndef GLERROR_H
 
24
#define GLERROR_H
 
25
 
 
26
// WARNING: Never call glGetError between glBegin and glEnd.
 
27
// WARNING: Never use CHECKGL between glBegin() and glEnd().
 
28
#ifdef _DEBUG
 
29
 
 
30
    #define CHECKGL( GLcall )                       \
 
31
        {                                           \
 
32
            GLcall;                                 \
 
33
            if(1)                                   \
 
34
            CheckGLError( ANSI_TO_TCHAR(#GLcall), __FILE__, __LINE__ );   \
 
35
        }
 
36
 
 
37
    #define CHECKGL_MSG( msg )                      \
 
38
        {                                           \
 
39
            if(1)                                   \
 
40
            CheckGLError( ANSI_TO_TCHAR(#msg), __FILE__, __LINE__  );      \
 
41
        }
 
42
 
 
43
#else
 
44
 
 
45
    #define CHECKGL(GLcall)                         \
 
46
        {                                           \
 
47
            GLcall;                                 \
 
48
        }
 
49
 
 
50
    #define CHECKGL_MSG( msg )                      \
 
51
        {                                           \
 
52
        }
 
53
 
 
54
#endif
 
55
 
 
56
int CheckGLError(const TCHAR* GLcall, const TCHAR *file, int line);
 
57
 
 
58
#endif // GLERROR_H
 
59