00001
00002
00003
00004
00005
00006
00011 #include "Planet.h"
00012 #include "TextureManager.h"
00013 #include "Window.h"
00014
00018 void Planet::draw() {
00019
00020 drawBegin();
00021
00023 glColor3f(1.0, 1.0, 1.0);
00024
00025 GLfloat emission[] = { 0, 0, 0, 1.0 };
00026
00027 glMaterialfv(GL_FRONT, GL_EMISSION, emission);
00028
00029 glPushMatrix();
00030
00031
00032 Vector adaptedpos = getScaledPos();
00033 glTranslatef(adaptedpos.x,adaptedpos.y,adaptedpos.z);
00034
00035
00036 GLUquadricObj * planetQuadric = gluNewQuadric();
00037
00038 if(ourConfiguration.showTextures) {
00039 glEnable (GL_TEXTURE_2D);
00040 glBindTexture (GL_TEXTURE_2D, getOpenglTextureNumber());
00041 gluQuadricTexture( planetQuadric, GL_TRUE );
00042 }
00043
00044 gluSphere( planetQuadric, getScaledRadius(),
00045 ourConfiguration.sphereDetaillevel,
00046 ourConfiguration.sphereDetaillevel );
00047
00048 glDisable(GL_TEXTURE_2D);
00049
00050 glPopMatrix();
00051 gluDeleteQuadric(planetQuadric);
00052
00053 drawEnd();
00054 }
00055
00056 char * Planet::getType() {
00057 return "planet";
00058 }
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089