ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

get.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 /*
00024  * This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
00025  * which is licensed under the zlib-license (see LICENSE).
00026  * It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
00027  */
00028 
00029 #define FORBIDDEN_SYMBOL_EXCEPTION_fprintf
00030 #define FORBIDDEN_SYMBOL_EXCEPTION_stderr
00031 
00032 #include "graphics/tinygl/zgl.h"
00033 
00034 void tglGetIntegerv(int pname, int *params) {
00035     TinyGL::GLContext *c = TinyGL::gl_get_context();
00036 
00037     switch (pname) {
00038     case TGL_VIEWPORT:
00039         params[0] = c->viewport.xmin;
00040         params[1] = c->viewport.ymin;
00041         params[2] = c->viewport.xsize;
00042         params[3] = c->viewport.ysize;
00043         break;
00044     case TGL_MAX_MODELVIEW_STACK_DEPTH:
00045         *params = MAX_MODELVIEW_STACK_DEPTH;
00046         break;
00047     case TGL_MAX_PROJECTION_STACK_DEPTH:
00048         *params = MAX_PROJECTION_STACK_DEPTH;
00049         break;
00050     case TGL_MAX_LIGHTS:
00051         *params = T_MAX_LIGHTS;
00052         break;
00053     case TGL_MAX_TEXTURE_SIZE:
00054         *params = c->_textureSize;
00055         break;
00056     case TGL_MAX_TEXTURE_STACK_DEPTH:
00057         *params = MAX_TEXTURE_STACK_DEPTH;
00058         break;
00059     case TGL_BLEND:
00060         *params = c->fb->isBlendingEnabled();
00061         break;
00062     case TGL_ALPHA_TEST:
00063         *params = c->fb->isAlphaTestEnabled();
00064         break;
00065     default:
00066         error("tglGet: option not implemented");
00067         break;
00068     }
00069 }
00070 
00071 void tglGetFloatv(int pname, float *v) {
00072     int i;
00073     int mnr = 0; // just a trick to return the correct matrix
00074     TinyGL::GLContext *c = TinyGL::gl_get_context();
00075     switch (pname) {
00076     case TGL_TEXTURE_MATRIX:
00077         mnr++;
00078         // fall through
00079     case TGL_PROJECTION_MATRIX:
00080         mnr++;
00081         // fall through
00082     case TGL_MODELVIEW_MATRIX: {
00083         float *p = &c->matrix_stack_ptr[mnr]->_m[0][0];
00084         for (i = 0; i < 4; i++) {
00085             *v++ = p[0];
00086             *v++ = p[4];
00087             *v++ = p[8];
00088             *v++ = p[12];
00089             p++;
00090         }
00091     }
00092     break;
00093     case TGL_LINE_WIDTH:
00094         *v = 1.0f;
00095         break;
00096     case TGL_LINE_WIDTH_RANGE:
00097         v[0] = v[1] = 1.0f;
00098         break;
00099     case TGL_POINT_SIZE:
00100         *v = 1.0f;
00101         break;
00102     case TGL_POINT_SIZE_RANGE:
00103         v[0] = v[1] = 1.0f;
00104         break;
00105     default:
00106         fprintf(stderr, "warning: unknown pname in glGetFloatv()\n");
00107         break;
00108     }
00109 }


Generated on Sat May 18 2019 05:01:03 for ResidualVM by doxygen 1.7.1
curved edge   curved edge