source: trunk/packages/vizservers/nanovis/global.h @ 1111

Last change on this file since 1111 was 1111, checked in by gah, 16 years ago

nanovis/heightmap update

File size: 2.4 KB
Line 
1/*
2 * ======================================================================
3 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
4 *           Purdue Rendering and Perceptualization Lab (PURPL)
5 *
6 *  Copyright (c) 2004-2006  Purdue Research Foundation
7 *
8 *  See the file "license.terms" for information on usage and
9 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10 * ======================================================================
11 */
12
13
14//system wide global or static functions
15
16#ifndef _GLOBAL_H_
17#define _GLOBAL_H_
18
19#include <GL/glew.h>
20#include <Cg/cgGL.h>
21
22#include <stdio.h>
23
24#define CHECK_FRAMEBUFFER_STATUS()                            \
25  {                                                           \
26    GLenum status;                                            \
27    status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); \
28    switch(status) {                                          \
29      case GL_FRAMEBUFFER_COMPLETE_EXT:                       \
30        break;                                                \
31      case GL_FRAMEBUFFER_UNSUPPORTED_EXT:                    \
32        /* choose different formats */                        \
33        break;                                                \
34      default:                                                \
35        /* programming error; will fail on all hardware */    \
36        fprintf(stderr, "programming error\n");               \
37        assert(0);                                            \
38     }                                                        \
39   }
40
41
42inline void
43draw_quad(int w, int h, int tw, int th)
44{
45    glBegin(GL_QUADS);
46    glTexCoord2f(0,         0);         glVertex2f(0,        0);
47    glTexCoord2f((float)tw, 0);         glVertex2f((float)w, 0);
48    glTexCoord2f((float)tw, (float)th); glVertex2f((float)w, (float) h);
49    glTexCoord2f(0,         (float)th); glVertex2f(0,        (float) h);
50    glEnd();
51}
52
53
54//query opengl information
55inline void
56system_info()
57{
58    fprintf(stderr,
59            "-----------------------------------------------------------\n");
60    fprintf(stderr, "OpenGL driver: %s %s\n", glGetString(GL_VENDOR),
61            glGetString(GL_VERSION));
62    fprintf(stderr, "Graphics hardware: %s\n", glGetString(GL_RENDERER));
63    fprintf(stderr,
64            "-----------------------------------------------------------\n");
65}
66
67extern CGprogram LoadCgSourceProgram(CGcontext context, const char *filename,
68        CGprofile profile, const char *entryPoint);
69
70#endif
Note: See TracBrowser for help on using the repository browser.