3
*************************************************************************
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
6
Copyright (C) 2000 Manuel Moos (manuel@moosnet.de)
8
**************************************************************************
10
This program is free software; you can redistribute it and/or
11
modify it under the terms of the GNU General Public License
12
as published by the Free Software Foundation; either version 2
13
of the License, or (at your option) any later version.
15
This program is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
***************************************************************************
35
#include "tMemManager.h"
38
class glRenderer: public rRenderer{
44
void BeginPrimitive(GLenum p, bool forceEnd = false){
48
if (lastPrimitive != p && lastPrimitive != GL_FALSE)
54
forceglEnd = forceEnd;
57
void MatrixMode(GLenum mm){
58
// if (lastMatrix != mm)
66
glRenderer():lastPrimitive(GL_FALSE), lastMatrix(GL_FALSE){
67
ChangeFlags(0xffffffff,0);
70
virtual ~glRenderer(){};
72
virtual void Vertex(REAL x, REAL y){
76
virtual void Vertex(REAL x, REAL y, REAL z){
80
virtual void Vertex3(REAL *x){
84
virtual void Vertex(REAL x, REAL y, REAL z, REAL w){
88
virtual void TexCoord(REAL u, REAL v){
92
virtual void TexCoord(REAL u, REAL v, REAL w){
96
virtual void TexCoord(REAL u, REAL v, REAL w, REAL t){
97
glTexCoord4f(u,v,w,t);
100
virtual void TexVertex(REAL x, REAL y, REAL z,
107
virtual void Color(REAL r, REAL g, REAL b){
111
virtual void Color(REAL r, REAL g, REAL b,REAL a){
116
virtual void End(bool force=false){
120
if ((forceglEnd || force || true) && lastPrimitive!=GL_FALSE)
124
lastPrimitive = GL_FALSE;
128
virtual void BeginLines(){
129
BeginPrimitive(GL_LINES);
132
virtual void BeginTriangles(){
133
BeginPrimitive(GL_TRIANGLES);
136
virtual void BeginQuads(){
137
BeginPrimitive(GL_QUADS);
140
virtual void IsEdge(bool ie){
141
glEdgeFlag(ie ? GL_TRUE : GL_FALSE);
144
virtual void BeginLineStrip(){
145
BeginPrimitive(GL_LINE_STRIP, true);
148
virtual void BeginLineLoop(){
149
BeginPrimitive(GL_LINE_LOOP, true);
152
virtual void BeginTriangleStrip(){
153
BeginPrimitive(GL_TRIANGLE_STRIP, true);
156
virtual void BeginQuadStrip(){
157
BeginPrimitive(GL_QUAD_STRIP, true);
160
virtual void BeginTriangleFan(){
161
BeginPrimitive(GL_TRIANGLE_FAN, true);
164
virtual void Line(REAL x1, REAL y1, REAL z1,
165
REAL x2, REAL y2, REAL z2){
166
BeginPrimitive(GL_LINES);
167
glVertex3f(x1,y1,z1);
168
glVertex3f(x2,y2,z2);
175
virtual void ProjMatrix(){
177
MatrixMode(GL_PROJECTION);
180
virtual void ModelMatrix(){
182
MatrixMode(GL_MODELVIEW);
185
virtual void TexMatrix(){
187
MatrixMode(GL_TEXTURE);
190
virtual void PushMatrix(){
194
virtual void PopMatrix(){
199
virtual void MultMatrix(REAL mdata[4][4]){
201
tASSERT(sizeof(REAL) == sizeof(GLfloat));
202
glMultMatrixf(reinterpret_cast<GLfloat *>(&mdata));
205
virtual void IdentityMatrix(){
210
virtual void ScaleMatrix(REAL f){
215
virtual void ScaleMatrix(REAL f1, REAL f2, REAL f3){
220
virtual void TranslateMatrix(REAL x1, REAL x2, REAL x3){
222
glTranslatef(x1,x2,x3);
227
virtual void ReallySetFlag(flag f,bool c){
228
GLenum fl = GL_DEPTH_TEST;
249
void sr_glRendererInit(){