Last change
on this file since 2754 was
2754,
checked in by bensch, 20 years ago
|
orxonox/branches/importer: added array-class, that handles input dynamic arrays. Made a fake file read routine
|
File size:
769 bytes
|
Line | |
---|
1 | #include "object.h" |
---|
2 | #include <iostream.h> |
---|
3 | Object::Object () |
---|
4 | { |
---|
5 | this->readFromObjFile ("test"); |
---|
6 | |
---|
7 | listNumber = glGenLists(1); |
---|
8 | glNewList (listNumber, GL_COMPILE); |
---|
9 | |
---|
10 | glEnableClientState (GL_VERTEX_ARRAY); |
---|
11 | glVertexPointer(3, GL_FLOAT, 0, vertices->getArray()); |
---|
12 | |
---|
13 | glColor3f(1.0,0,0); |
---|
14 | glBegin(GL_TRIANGLES); |
---|
15 | |
---|
16 | glArrayElement(0); |
---|
17 | glArrayElement(1); |
---|
18 | glArrayElement(2); |
---|
19 | |
---|
20 | |
---|
21 | /* |
---|
22 | glVertex3f(0,0,0); |
---|
23 | glVertex3f(0,1,0); |
---|
24 | glVertex3f(1,0,0); |
---|
25 | */ |
---|
26 | glEnd(); |
---|
27 | glEndList(); |
---|
28 | } |
---|
29 | |
---|
30 | void Object::draw () |
---|
31 | { |
---|
32 | glCallList (listNumber); |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | bool Object::readFromObjFile (char* fileName) |
---|
40 | { |
---|
41 | vertices = new Array(2000); |
---|
42 | vertices->addEntry(0,0,0); |
---|
43 | vertices->addEntry(0,1,0); |
---|
44 | vertices->addEntry(1,0,1); |
---|
45 | vertices->finalizeArray(); |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | return true; |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.