Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/glmenu_imagescreen.cc @ 3359

Last change on this file since 3359 was 3359, checked in by patrick, 19 years ago

orxonox/branches/parenting: glEnable(Textures) only for parts that realy need textures.

File size: 3.1 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
16*/
17
18
19#include "glmenu_imagescreen.h"
20#include "importer/texture.h"
21
22using namespace std;
23
24
25/**
26   \brief standard constructor
27
28   \todo this constructor is not jet implemented - do it
29*/
30GLMenuImageScreen::GLMenuImageScreen () 
31{
32   this->setClassName ("GLMenuImageScreen");
33}
34
35
36/**
37   \brief standard deconstructor
38
39   \todo this deconstructor is not jet implemented - do it
40*/
41GLMenuImageScreen::~GLMenuImageScreen () {}
42
43
44/**
45   \brief function to init the screen
46*/
47void GLMenuImageScreen::init ()
48{
49  int w = 680;
50  int h = 480;
51
52  glViewport(0,0,w,h);
53 
54  glMatrixMode(GL_PROJECTION);
55  glLoadIdentity(); 
56  gluPerspective(45.0f,(GLfloat)w/(GLfloat)h, .5f ,150.0f);
57  glMatrixMode(GL_MODELVIEW); 
58
59  this->backTex = new Texture();
60  this->backTex->loadImage("orx_tex.bmp");
61
62  /* ------------painten */
63
64  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
65  glLoadIdentity();
66  gluLookAt(0, 0, 6,     0, 0, 0,     0, 1, 0);
67
68  // Bind the texture stored at the zero index of g_Texture[]
69  //glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
70}
71
72
73/**
74   \brief function to innit screen with all attributes set
75   \param name of the background-image file
76   \param height of the ImageScreen
77   \param width of the Image Screen
78   \param x offset from (0, 0)
79   \param y offset from (0, 0)
80
81   GLMenu uses its own coordinating system: upper left corner is (0, 0). x-axis is down=height,
82   right axis is right direction (=width)
83*/
84void GLMenuImageScreen::init (char* backImageName, float height, float width, 
85                              float offsetX, float offsetY)
86{}
87
88
89/**
90   \brief draws the ImageScreen to the screenbuffer
91*/
92void GLMenuImageScreen::draw ()
93{
94  // Display a quad texture to the screen
95  glEnable(GL_TEXTURE_2D);
96  glBegin(GL_QUADS);
97 
98  // Display the top left vertice
99  glTexCoord2f(0.0f, 1.0f);
100  glVertex3f(-2.5, 2.5, 0);
101 
102  // Display the bottom left vertice
103  glTexCoord2f(0.0f, 0.0f);
104  glVertex3f(-2.5, -2.5, 0);
105 
106  // Display the bottom right vertice
107  glTexCoord2f(1.0f, 0.0f);
108  glVertex3f(2.5, -2.5, 0);
109 
110  // Display the top right vertice
111  glTexCoord2f(1.0f, 1.0f);
112  glVertex3f(2.5, 2.5, 0);
113
114  glEnd();
115  glEnable(GL_TEXTURE_2D); 
116
117  SDL_GL_SwapBuffers();                   
118
119  delete this->backTex;
120  SDL_Delay(1000);
121}
122
123 
124/**
125    \brief sets the background image name
126    \param file name of the backgroun-image
127 */
128void GLMenuImageScreen::setBackImageName (char* backImageName)
129{}
130
131
132/**
133   \brief sets position of the ImageScreen
134   \param x offset from (0, 0)
135   \param y offset from (0, 0)
136*/
137void GLMenuImageScreen::setPosition(float offsetX, float offsetY)
138{}
139
140
141/*
142  \brief sets size of the ImageScreen
143  \param height of the ImageScreen
144  \param width of the Image Screen
145*/
146void GLMenuImageScreen::setSize(float height, float width)
147{}
Note: See TracBrowser for help on using the repository browser.