2010-12-13 19:12:08 +00:00
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
EXTREME TUXRACER
|
|
|
|
|
|
|
|
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
|
|
|
|
Copyright (C) 2010 Extreme Tuxracer Team
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
---------------------------------------------------------------------*/
|
|
|
|
|
2013-06-23 22:44:40 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <etr_config.h>
|
|
|
|
#endif
|
|
|
|
|
2010-12-13 19:12:08 +00:00
|
|
|
#include "ogl_test.h"
|
|
|
|
#include "ogl.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "env.h"
|
2013-05-23 17:59:58 +00:00
|
|
|
#include "gui.h"
|
2013-06-11 17:49:59 +00:00
|
|
|
#include "winsys.h"
|
2010-12-13 19:12:08 +00:00
|
|
|
|
2013-05-01 17:12:19 +00:00
|
|
|
COglTest OglTest;
|
|
|
|
|
2013-09-11 13:24:19 +00:00
|
|
|
static const TLight light = {
|
2016-01-09 11:04:11 +00:00
|
|
|
{0.45f, 0.53f, 0.75f, 1.f},
|
|
|
|
{1.f, 0.9f, 1.f, 1.f},
|
|
|
|
{0.6f, 0.6f, 0.6f, 1.f},
|
|
|
|
{1.f, 2.f, 2.f, 0.f},
|
|
|
|
true
|
2013-09-11 13:24:19 +00:00
|
|
|
};
|
|
|
|
|
2010-12-13 19:12:08 +00:00
|
|
|
|
2014-01-18 09:55:13 +00:00
|
|
|
void SetTestLight() {
|
2013-09-11 13:24:19 +00:00
|
|
|
light.Enable(GL_LIGHT0);
|
|
|
|
glEnable(GL_LIGHTING);
|
2010-12-13 19:12:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-05 16:35:47 +00:00
|
|
|
void COglTest::Keyb(sf::Keyboard::Key key, bool release, int x, int y) {
|
2010-12-13 19:12:08 +00:00
|
|
|
if (release) return;
|
2016-06-24 23:48:14 +00:00
|
|
|
if (key == sf::Keyboard::Escape) {
|
|
|
|
State::manager.RequestQuit();
|
2010-12-13 19:12:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-28 16:41:50 +00:00
|
|
|
void COglTest::Loop(float time_step) {
|
2010-12-13 19:12:08 +00:00
|
|
|
// ------------- 3d scenery ---------------------------------------
|
2013-06-19 20:07:03 +00:00
|
|
|
ScopedRenderMode rm(TUX);
|
2014-01-18 09:55:13 +00:00
|
|
|
ClearRenderContext(colDDBackgr);
|
2010-12-13 19:12:08 +00:00
|
|
|
|
2014-01-18 09:55:13 +00:00
|
|
|
glLoadIdentity();
|
|
|
|
glPushMatrix();
|
|
|
|
SetTestLight();
|
2010-12-13 19:12:08 +00:00
|
|
|
|
2013-08-15 14:21:01 +00:00
|
|
|
/*
|
|
|
|
glTranslatef (xposition, yposition, zposition);
|
|
|
|
glRotatef (xrotation, 1, 0, 0);
|
|
|
|
glRotatef (yrotation, 0, 1, 0);
|
|
|
|
glRotatef (zrotation, 0, 0, 1);
|
|
|
|
*/
|
2014-01-18 09:55:13 +00:00
|
|
|
glPopMatrix();
|
2010-12-13 19:12:08 +00:00
|
|
|
|
|
|
|
// --------------- 2d screen --------------------------------------
|
2014-01-18 09:55:13 +00:00
|
|
|
Setup2dScene();
|
2013-06-19 20:07:03 +00:00
|
|
|
ScopedRenderMode rm2(TEXFONT);
|
2013-10-03 13:11:40 +00:00
|
|
|
FT.SetProps("bold", 24, colWhite);
|
2014-01-18 09:55:13 +00:00
|
|
|
FT.DrawString(CENTER, 10, "Test screen");
|
|
|
|
Reshape(Winsys.resolution.width, Winsys.resolution.height);
|
|
|
|
Winsys.SwapBuffers();
|
2010-12-13 19:12:08 +00:00
|
|
|
}
|