|
Dernière réponse | |
---|---|
Sujet : [OpenGL] Utilisation d'objets créés avec 3D Exploration | |
Alload | Merci pour tes conseils d'optimisation du code void draw().
Au fait, j'ai résolu mon problème, en fait la display list chargeait les textures à chaque fois et pas seulement une fois, j'ai donc passé les lignes s'occupant de ça dans void init() et ça marche impec. :) |
Aperçu |
---|
Vue Rapide de la discussion |
---|
Alload | Merci pour tes conseils d'optimisation du code void draw().
Au fait, j'ai résolu mon problème, en fait la display list chargeait les textures à chaque fois et pas seulement une fois, j'ai donc passé les lignes s'occupant de ça dans void init() et ça marche impec. :) |
MC | p'tain j'arrive même pas a trouver la box pour mettre la réponse...
Hmmm, c'est une display list, donc a priori rien d'optimisable (car c'est deja optimisé). Pb de taille de textures? de display list? (nvidia est assez fun il parait la dessus). Par contre revoie un peu ton code: utilise plutot les stacks de matrices pour éviter d'avoir a réinitialiser ton etat entre deux objets (push + pop), et utilise toujours la même classe de fonction (translatef et scalef ou translated et scaled), f etant a priori plus rapide, mais moins précis. Sinon si ca t'interesse, va voir sur http://www.gamasutra.com il y a un article (avec code) sur la génération automatique de planètes. |
Alload | Voilà le code de mon programme:
#include <windows.h> #include <stdio.h> #include <math.h> #include <gl/glut.h> #include <gl/glaux.h> /////////////////////////////////////////////////////////////////// GLfloat rterre; GLfloat rlune; GLfloat r; GLdouble orbite; GLdouble orbitespeed = 0.5; bool speed; GLfloat diffuse[] = {1.0, 1.0, 1.0, 1.0}; GLfloat position[] = {0.0, 0.0, 30.0, 1.0}; GLint terre; /////////////////////////////////////////////////////////////////// struct sample_MATERIAL{ GLfloat ambient[3]; GLfloat diffuse[3]; GLfloat specular[3]; GLfloat emission[3]; GLfloat alpha; GLfloat phExp; int texture; }; struct sample_TEXTURE{ char * name; GLint id; }; static sample_MATERIAL materials [1] = { {{1.0f,1.0f,1.0f}, {1.0f,1.0f,1.0f}, {1.0f,1.0f,1.0f}, {1.0f,1.0f,1.0f}, 1.0f,11.3137f,0} //Material #1 }; static sample_TEXTURE texture_maps [1] = { {"terre_0.bmp",0} }; // 182 Verticies // 230 Texture Coordinates // 236 Normals // 360 Triangles static BYTE face_indicies[360][9] = { // Terre {0,1,2 ,0,1,2 ,0,1,2 }, {0,2,3 ,3,2,4 ,3,2,4 }, {0,3,4 ,5,4,6 ,5,4,6 }, {0,4,5 ,7,6,8 ,7,6,8 }, {0,5,6 ,9,8,10 ,9,8,10 }, {0,6,7 ,11,10,12 ,11,10,12 }, {0,7,8 ,13,12,14 ,13,12,14 }, {0,8,9 ,15,14,16 ,15,14,16 }, {0,9,10 ,17,16,18 ,17,16,18 }, {0,10,11 ,19,18,20 ,19,18,20 }, {0,11,12 ,21,20,22 ,21,20,22 }, {0,12,13 ,23,22,24 ,23,22,24 }, {0,13,14 ,25,24,26 ,25,24,26 }, {0,14,15 ,27,26,28 ,27,26,28 }, {0,15,16 ,29,28,30 ,29,28,30 }, {0,16,17 ,31,30,32 ,31,30,32 }, {0,17,18 ,33,32,34 ,33,32,34 }, {0,18,19 ,35,34,36 ,35,34,36 }, {0,19,20 ,37,36,38 ,37,36,38 }, {0,20,1 ,39,38,39 ,39,38,40 }, {1,21,22 ,1,40,41 ,1,41,42 }, {1,22,2 ,1,41,2 ,1,42,2 }, {2,22,23 ,2,41,42 ,2,42,43 }, {2,23,3 ,2,42,4 ,2,43,4 }, {3,23,24 ,4,42,43 ,4,43,44 }, {3,24,4 ,4,43,6 ,4,44,6 }, {4,24,25 ,6,43,44 ,6,44,45 }, {4,25,5 ,6,44,8 ,6,45,8 }, {5,25,26 ,8,44,45 ,8,45,46 }, {5,26,6 ,8,45,10 ,8,46,10 }, {6,26,27 ,10,45,46 ,10,46,47 }, {6,27,7 ,10,46,12 ,10,47,12 }, {7,27,28 ,12,46,47 ,12,47,48 }, {7,28,8 ,12,47,14 ,12,48,14 }, {8,28,29 ,14,47,48 ,14,48,49 }, {8,29,9 ,14,48,16 ,14,49,16 }, {9,29,30 ,16,48,49 ,16,49,50 }, {9,30,10 ,16,49,18 ,16,50,18 }, {10,30,31 ,18,49,50 ,18,50,51 }, {10,31,11 ,18,50,20 ,18,51,20 }, {11,31,32 ,20,50,51 ,20,51,52 }, {11,32,12 ,20,51,22 ,20,52,22 }, {12,32,33 ,22,51,52 ,22,52,53 }, {12,33,13 ,22,52,24 ,22,53,24 }, {13,33,34 ,24,52,53 ,24,53,54 }, {13,34,14 ,24,53,26 ,24,54,26 }, {14,34,35 ,26,53,54 ,26,54,55 }, {14,35,15 ,26,54,28 ,26,55,28 }, {15,35,36 ,28,54,55 ,28,55,56 }, {15,36,16 ,28,55,30 ,28,56,30 }, {16,36,37 ,30,55,56 ,30,56,57 }, {16,37,17 ,30,56,32 ,30,57,32 }, {17,37,38 ,32,56,57 ,32,57,58 }, {17,38,18 ,32,57,34 ,32,58,34 }, {18,38,39 ,34,57,58 ,34,58,59 }, {18,39,19 ,34,58,36 ,34,59,36 }, {19,39,40 ,36,58,59 ,36,59,60 }, {19,40,20 ,36,59,38 ,36,60,38 }, {20,40,21 ,38,59,60 ,38,60,61 }, {20,21,1 ,38,61,61 ,38,61,40 }, {21,41,42 ,40,62,63 ,41,62,63 }, {21,42,22 ,40,63,41 ,41,63,42 }, {22,42,43 ,41,63,64 ,42,63,64 }, {22,43,23 ,41,64,42 ,42,64,43 }, {23,43,44 ,42,64,65 ,43,64,65 }, {23,44,24 ,42,65,43 ,43,65,44 }, {24,44,45 ,43,65,66 ,44,65,66 }, {24,45,25 ,43,66,44 ,44,66,45 }, {25,45,46 ,44,66,67 ,45,66,67 }, {25,46,26 ,44,67,45 ,45,67,46 }, {26,46,47 ,45,67,68 ,46,67,68 }, {26,47,27 ,45,68,46 ,46,68,47 }, {27,47,48 ,46,68,69 ,47,68,69 }, {27,48,28 ,46,69,47 ,47,69,48 }, {28,48,49 ,47,69,70 ,48,69,70 }, {28,49,29 ,47,70,48 ,48,70,49 }, {29,49,50 ,48,70,71 ,49,70,71 }, {29,50,30 ,48,71,49 ,49,71,50 }, {30,50,51 ,49,71,72 ,50,71,72 }, {30,51,31 ,49,72,50 ,50,72,51 }, {31,51,52 ,50,72,73 ,51,72,73 }, {31,52,32 ,50,73,51 ,51,73,52 }, {32,52,53 ,51,73,74 ,52,73,74 }, {32,53,33 ,51,74,52 ,52,74,53 }, {33,53,54 ,52,74,75 ,53,74,75 }, {33,54,34 ,52,75,53 ,53,75,54 }, {34,54,55 ,53,75,76 ,54,75,76 }, {34,55,35 ,53,76,54 ,54,76,55 }, {35,55,56 ,54,76,77 ,55,76,77 }, {35,56,36 ,54,77,55 ,55,77,56 }, {36,56,57 ,55,77,78 ,56,77,78 }, {36,57,37 ,55,78,56 ,56,78,57 }, {37,57,58 ,56,78,79 ,57,78,79 }, {37,58,38 ,56,79,57 ,57,79,58 }, {38,58,59 ,57,79,80 ,58,79,80 }, {38,59,39 ,57,80,58 ,58,80,59 }, {39,59,60 ,58,80,81 ,59,80,81 }, {39,60,40 ,58,81,59 ,59,81,60 }, {40,60,41 ,59,81,82 ,60,81,82 }, {40,41,21 ,59,83,83 ,60,82,61 }, {41,61,62 ,62,84,85 ,62,83,84 }, {41,62,42 ,62,85,63 ,62,84,63 }, {42,62,63 ,63,85,86 ,63,84,85 }, {42,63,43 ,63,86,64 ,63,85,64 }, {43,63,64 ,64,86,87 ,64,85,86 }, {43,64,44 ,64,87,65 ,64,86,65 }, {44,64,65 ,65,87,88 ,65,86,87 }, {44,65,45 ,65,88,66 ,65,87,66 }, {45,65,66 ,66,88,89 ,66,87,88 }, {45,66,46 ,66,89,67 ,66,88,67 }, {46,66,67 ,67,89,90 ,67,88,89 }, {46,67,47 ,67,90,68 ,67,89,68 }, {47,67,68 ,68,90,91 ,68,89,90 }, {47,68,48 ,68,91,69 ,68,90,69 }, {48,68,69 ,69,91,92 ,69,90,91 }, {48,69,49 ,69,92,70 ,69,91,70 }, {49,69,70 ,70,92,93 ,70,91,92 }, {49,70,50 ,70,93,71 ,70,92,71 }, {50,70,71 ,71,93,94 ,71,92,93 }, {50,71,51 ,71,94,72 ,71,93,72 }, {51,71,72 ,72,94,95 ,72,93,94 }, {51,72,52 ,72,95,73 ,72,94,73 }, {52,72,73 ,73,95,96 ,73,94,95 }, {52,73,53 ,73,96,74 ,73,95,74 }, {53,73,74 ,74,96,97 ,74,95,96 }, {53,74,54 ,74,97,75 ,74,96,75 }, {54,74,75 ,75,97,98 ,75,96,97 }, {54,75,55 ,75,98,76 ,75,97,76 }, {55,75,76 ,76,98,99 ,76,97,98 }, {55,76,56 ,76,99,77 ,76,98,77 }, {56,76,77 ,77,99,100 ,77,98,99 }, {56,77,57 ,77,100,78 ,77,99,78 }, {57,77,78 ,78,100,101 ,78,99,100 }, {57,78,58 ,78,101,79 ,78,100,79 }, {58,78,79 ,79,101,102 ,79,100,101 }, {58,79,59 ,79,102,80 ,79,101,80 }, {59,79,80 ,80,102,103 ,80,101,102 }, {59,80,60 ,80,103,81 ,80,102,81 }, {60,80,61 ,81,103,104 ,81,102,103 }, {60,61,41 ,81,105,105 ,81,103,82 }, {61,81,82 ,84,106,107 ,83,104,105 }, {61,82,62 ,84,107,85 ,83,105,84 }, {62,82,83 ,85,107,108 ,84,105,106 }, {62,83,63 ,85,108,86 ,84,106,85 }, {63,83,84 ,86,108,109 ,85,106,107 }, {63,84,64 ,86,109,87 ,85,107,86 }, {64,84,85 ,87,109,110 ,86,107,108 }, {64,85,65 ,87,110,88 ,86,108,87 }, {65,85,86 ,88,110,111 ,87,108,109 }, {65,86,66 ,88,111,89 ,87,109,88 }, {66,86,87 ,89,111,112 ,88,109,110 }, {66,87,67 ,89,112,90 ,88,110,89 }, {67,87,88 ,90,112,113 ,89,110,111 }, {67,88,68 ,90,113,91 ,89,111,90 }, {68,88,89 ,91,113,114 ,90,111,112 }, {68,89,69 ,91,114,92 ,90,112,91 }, {69,89,90 ,92,114,115 ,91,112,113 }, {69,90,70 ,92,115,93 ,91,113,92 }, {70,90,91 ,93,115,116 ,92,113,114 }, {70,91,71 ,93,116,94 ,92,114,93 }, {71,91,92 ,94,116,117 ,93,114,115 }, {71,92,72 ,94,117,95 ,93,115,94 }, {72,92,93 ,95,117,118 ,94,115,116 }, {72,93,73 ,95,118,96 ,94,116,95 }, {73,93,94 ,96,118,119 ,95,116,117 }, {73,94,74 ,96,119,97 ,95,117,96 }, {74,94,95 ,97,119,120 ,96,117,118 }, {74,95,75 ,97,120,98 ,96,118,97 }, {75,95,96 ,98,120,121 ,97,118,119 }, {75,96,76 ,98,121,99 ,97,119,98 }, {76,96,97 ,99,121,122 ,98,119,120 }, {76,97,77 ,99,122,100 ,98,120,99 }, {77,97,98 ,100,122,123 ,99,120,121 }, {77,98,78 ,100,123,101 ,99,121,100 }, {78,98,99 ,101,123,124 ,100,121,122 }, {78,99,79 ,101,124,102 ,100,122,101 }, {79,99,100 ,102,124,125 ,101,122,123 }, {79,100,80 ,102,125,103 ,101,123,102 }, {80,100,81 ,103,125,126 ,102,123,124 }, {80,81,61 ,103,127,127 ,102,124,103 }, {81,101,102 ,106,128,129 ,104,125,126 }, {81,102,82 ,106,129,107 ,104,126,105 }, {82,102,103 ,107,129,130 ,105,126,127 }, {82,103,83 ,107,130,108 ,105,127,106 }, {83,103,104 ,108,130,131 ,106,127,128 }, {83,104,84 ,108,131,109 ,106,128,107 }, {84,104,105 ,109,131,132 ,107,128,129 }, {84,105,85 ,109,132,110 ,107,129,108 }, {85,105,106 ,110,132,133 ,108,129,130 }, {85,106,86 ,110,133,111 ,108,130,109 }, {86,106,107 ,111,133,134 ,109,130,131 }, {86,107,87 ,111,134,112 ,109,131,110 }, {87,107,108 ,112,134,135 ,110,131,132 }, {87,108,88 ,112,135,113 ,110,132,111 }, {88,108,109 ,113,135,136 ,111,132,133 }, {88,109,89 ,113,136,114 ,111,133,112 }, {89,109,110 ,114,136,137 ,112,133,134 }, {89,110,90 ,114,137,115 ,112,134,113 }, {90,110,111 ,115,137,138 ,113,134,135 }, {90,111,91 ,115,138,116 ,113,135,114 }, {91,111,112 ,116,138,139 ,114,135,136 }, {91,112,92 ,116,139,117 ,114,136,115 }, {92,112,113 ,117,139,140 ,115,136,137 }, {92,113,93 ,117,140,118 ,115,137,116 }, {93,113,114 ,118,140,141 ,116,137,138 }, {93,114,94 ,118,141,119 ,116,138,117 }, {94,114,115 ,119,141,142 ,117,138,139 }, {94,115,95 ,119,142,120 ,117,139,118 }, {95,115,116 ,120,142,143 ,118,139,140 }, {95,116,96 ,120,143,121 ,118,140,119 }, {96,116,117 ,121,143,144 ,119,140,141 }, {96,117,97 ,121,144,122 ,119,141,120 }, {97,117,118 ,122,144,145 ,120,141,142 }, {97,118,98 ,122,145,123 ,120,142,121 }, {98,118,119 ,123,145,146 ,121,142,143 }, {98,119,99 ,123,146,124 ,121,143,122 }, {99,119,120 ,124,146,147 ,122,143,144 }, {99,120,100 ,124,147,125 ,122,144,123 }, {100,120,101 ,125,147,148 ,123,144,145 }, {100,101,81 ,125,149,149 ,123,145,124 }, {101,121,122 ,128,150,151 ,125,146,147 }, {101,122,102 ,128,151,129 ,125,147,126 }, {102,122,123 ,129,151,152 ,126,147,148 }, {102,123,103 ,129,152,130 ,126,148,127 }, {103,123,124 ,130,152,153 ,127,148,149 }, {103,124,104 ,130,153,131 ,127,149,128 }, {104,124,125 ,131,153,154 ,128,149,150 }, {104,125,105 ,131,154,132 ,128,150,129 }, {105,125,126 ,132,154,155 ,129,150,151 }, {105,126,106 ,132,155,133 ,129,151,130 }, {106,126,127 ,133,155,156 ,130,151,152 }, {106,127,107 ,133,156,134 ,130,152,131 }, {107,127,128 ,134,156,157 ,131,152,153 }, {107,128,108 ,134,157,135 ,131,153,132 }, {108,128,129 ,135,157,158 ,132,153,154 }, {108,129,109 ,135,158,136 ,132,154,133 }, {109,129,130 ,136,158,159 ,133,154,155 }, {109,130,110 ,136,159,137 ,133,155,134 }, {110,130,131 ,137,159,160 ,134,155,156 }, {110,131,111 ,137,160,138 ,134,156,135 }, {111,131,132 ,138,160,161 ,135,156,157 }, {111,132,112 ,138,161,139 ,135,157,136 }, {112,132,133 ,139,161,162 ,136,157,158 }, {112,133,113 ,139,162,140 ,136,158,137 }, {113,133,134 ,140,162,163 ,137,158,159 }, {113,134,114 ,140,163,141 ,137,159,138 }, {114,134,135 ,141,163,164 ,138,159,160 }, {114,135,115 ,141,164,142 ,138,160,139 }, {115,135,136 ,142,164,165 ,139,160,161 }, {115,136,116 ,142,165,143 ,139,161,140 }, {116,136,137 ,143,165,166 ,140,161,162 }, {116,137,117 ,143,166,144 ,140,162,141 }, {117,137,138 ,144,166,167 ,141,162,163 }, {117,138,118 ,144,167,145 ,141,163,142 }, {118,138,139 ,145,167,168 ,142,163,164 }, {118,139,119 ,145,168,146 ,142,164,143 }, {119,139,140 ,146,168,169 ,143,164,165 }, {119,140,120 ,146,169,147 ,143,165,144 }, {120,140,121 ,147,169,170 ,144,165,166 }, {120,121,101 ,147,171,171 ,144,166,145 }, {121,141,142 ,150,172,173 ,146,167,168 }, {121,142,122 ,150,173,151 ,146,168,147 }, {122,142,143 ,151,173,174 ,147,168,169 }, {122,143,123 ,151,174,152 ,147,169,148 }, {123,143,144 ,152,174,175 ,148,169,170 }, {123,144,124 ,152,175,153 ,148,170,149 }, {124,144,145 ,153,175,176 ,149,170,171 }, {124,145,125 ,153,176,154 ,149,171,150 }, {125,145,146 ,154,176,177 ,150,171,172 }, {125,146,126 ,154,177,155 ,150,172,151 }, {126,146,147 ,155,177,178 ,151,172,173 }, {126,147,127 ,155,178,156 ,151,173,152 }, {127,147,148 ,156,178,179 ,152,173,174 }, {127,148,128 ,156,179,157 ,152,174,153 }, {128,148,149 ,157,179,180 ,153,174,175 }, {128,149,129 ,157,180,158 ,153,175,154 }, {129,149,150 ,158,180,181 ,154,175,176 }, {129,150,130 ,158,181,159 ,154,176,155 }, {130,150,151 ,159,181,182 ,155,176,177 }, {130,151,131 ,159,182,160 ,155,177,156 }, {131,151,152 ,160,182,183 ,156,177,178 }, {131,152,132 ,160,183,161 ,156,178,157 }, {132,152,153 ,161,183,184 ,157,178,179 }, {132,153,133 ,161,184,162 ,157,179,158 }, {133,153,154 ,162,184,185 ,158,179,180 }, {133,154,134 ,162,185,163 ,158,180,159 }, {134,154,155 ,163,185,186 ,159,180,181 }, {134,155,135 ,163,186,164 ,159,181,160 }, {135,155,156 ,164,186,187 ,160,181,182 }, {135,156,136 ,164,187,165 ,160,182,161 }, {136,156,157 ,165,187,188 ,161,182,183 }, {136,157,137 ,165,188,166 ,161,183,162 }, {137,157,158 ,166,188,189 ,162,183,184 }, {137,158,138 ,166,189,167 ,162,184,163 }, {138,158,159 ,167,189,190 ,163,184,185 }, {138,159,139 ,167,190,168 ,163,185,164 }, {139,159,160 ,168,190,191 ,164,185,186 }, {139,160,140 ,168,191,169 ,164,186,165 }, {140,160,141 ,169,191,192 ,165,186,187 }, {140,141,121 ,169,193,193 ,165,187,166 }, {141,161,162 ,172,194,195 ,167,188,189 }, {141,162,142 ,172,195,173 ,167,189,168 }, {142,162,163 ,173,195,196 ,168,189,190 }, {142,163,143 ,173,196,174 ,168,190,169 }, {143,163,164 ,174,196,197 ,169,190,191 }, {143,164,144 ,174,197,175 ,169,191,170 }, {144,164,165 ,175,197,198 ,170,191,192 }, {144,165,145 ,175,198,176 ,170,192,171 }, {145,165,166 ,176,198,199 ,171,192,193 }, {145,166,146 ,176,199,177 ,171,193,172 }, {146,166,167 ,177,199,200 ,172,193,194 }, {146,167,147 ,177,200,178 ,172,194,173 }, {147,167,168 ,178,200,201 ,173,194,195 }, {147,168,148 ,178,201,179 ,173,195,174 }, {148,168,169 ,179,201,202 ,174,195,196 }, {148,169,149 ,179,202,180 ,174,196,175 }, {149,169,170 ,180,202,203 ,175,196,197 }, {149,170,150 ,180,203,181 ,175,197,176 }, {150,170,171 ,181,203,204 ,176,197,198 }, {150,171,151 ,181,204,182 ,176,198,177 }, {151,171,172 ,182,204,205 ,177,198,199 }, {151,172,152 ,182,205,183 ,177,199,178 }, {152,172,173 ,183,205,206 ,178,199,200 }, {152,173,153 ,183,206,184 ,178,200,179 }, {153,173,174 ,184,206,207 ,179,200,201 }, {153,174,154 ,184,207,185 ,179,201,180 }, {154,174,175 ,185,207,208 ,180,201,202 }, {154,175,155 ,185,208,186 ,180,202,181 }, {155,175,176 ,186,208,209 ,181,202,203 }, {155,176,156 ,186,209,187 ,181,203,182 }, {156,176,177 ,187,209,210 ,182,203,204 }, {156,177,157 ,187,210,188 ,182,204,183 }, {157,177,178 ,188,210,211 ,183,204,205 }, {157,178,158 ,188,211,189 ,183,205,184 }, {158,178,179 ,189,211,212 ,184,205,206 }, {158,179,159 ,189,212,190 ,184,206,185 }, {159,179,180 ,190,212,213 ,185,206,207 }, {159,180,160 ,190,213,191 ,185,207,186 }, {160,180,161 ,191,213,214 ,186,207,208 }, {160,161,141 ,191,215,215 ,186,208,187 }, {181,162,161 ,216,195,194 ,0,209,210 }, {181,163,162 ,217,196,195 ,3,211,209 }, {181,164,163 ,218,197,196 ,5,212,211 }, {181,165,164 ,219,198,197 ,7,213,212 }, {181,166,165 ,220,199,198 ,9,214,213 }, {181,167,166 ,221,200,199 ,11,215,214 }, {181,168,167 ,222,201,200 ,13,216,215 }, {181,169,168 ,223,202,201 ,15,217,216 }, {181,170,169 ,224,203,202 ,17,218,217 }, {181,171,170 ,225,204,203 ,19,219,218 }, {181,172,171 ,226,205,204 ,21,220,219 }, {181,173,172 ,227,206,205 ,23,221,220 }, {181,174,173 ,228,207,206 ,25,222,221 }, {181,175,174 ,229,208,207 ,27,223,222 }, {181,176,175 ,230,209,208 ,29,224,223 }, {181,177,176 ,231,210,209 ,31,225,224 }, {181,178,177 ,232,211,210 ,33,226,225 }, {181,179,178 ,233,212,211 ,35,227,226 }, {181,180,179 ,234,213,212 ,37,228,227 }, {181,161,180 ,235,235,213 ,39,229,228 } }; static GLfloat vertices [182][3] = { {0.0f,0.0f,0.5f},{-6.75403e-09f,0.154509f,0.475528f},{-0.0477458f,0.146946f,0.475528f}, {-0.0908178f,0.125f,0.475528f},{-0.125f,0.0908178f,0.475528f},{-0.146946f,0.0477457f,0.475528f}, {-0.154509f,-1.35081e-08f,0.475528f},{-0.146946f,-0.0477458f,0.475528f},{-0.125f,-0.0908178f,0.475528f}, {-0.0908178f,-0.125f,0.475528f},{-0.0477457f,-0.146946f,0.475528f},{2.02621e-08f,-0.154509f,0.475528f}, {0.0477458f,-0.146946f,0.475528f},{0.0908178f,-0.125f,0.475528f},{0.125f,-0.0908178f,0.475528f}, {0.146946f,-0.0477457f,0.475528f},{0.154509f,2.70142e-08f,0.475528f},{0.146946f,0.0477458f,0.475528f}, {0.125f,0.0908178f,0.475528f},{0.0908178f,0.125f,0.475528f},{0.0477457f,0.146946f,0.475528f}, {-1.28464e-08f,0.293893f,0.404509f},{-0.0908178f,0.279509f,0.404509f},{-0.172746f,0.237764f,0.404509f}, {-0.237764f,0.172746f,0.404509f},{-0.279509f,0.0908178f,0.404509f},{-0.293893f,-2.56929e-08f,0.404509f}, {-0.279509f,-0.0908178f,0.404509f},{-0.237764f,-0.172746f,0.404509f},{-0.172746f,-0.237764f,0.404509f}, {-0.0908178f,-0.279509f,0.404509f},{3.85393e-08f,-0.293893f,0.404509f},{0.0908179f,-0.279509f,0.404509f}, {0.172746f,-0.237764f,0.404509f},{0.237764f,-0.172746f,0.404509f},{0.279509f,-0.0908178f,0.404509f}, {0.293893f,5.13857e-08f,0.404509f},{0.279509f,0.0908179f,0.404509f},{0.237764f,0.172746f,0.404509f}, {0.172746f,0.237764f,0.404509f},{0.0908178f,0.279509f,0.404509f},{-1.76815e-08f,0.404509f,0.293893f}, {-0.125f,0.38471f,0.293893f},{-0.237764f,0.327254f,0.293893f},{-0.327254f,0.237764f,0.293893f}, {-0.38471f,0.125f,0.293893f},{-0.404509f,-3.53631e-08f,0.293893f},{-0.38471f,-0.125f,0.293893f}, {-0.327254f,-0.237764f,0.293893f},{-0.237764f,-0.327254f,0.293893f},{-0.125f,-0.38471f,0.293893f}, {5.30446e-08f,-0.404509f,0.293893f},{0.125f,-0.38471f,0.293893f},{0.237764f,-0.327254f,0.293893f}, {0.327254f,-0.237764f,0.293893f},{0.38471f,-0.125f,0.293893f},{0.404509f,7.07262e-08f,0.293893f}, {0.38471f,0.125f,0.293893f},{0.327254f,0.237764f,0.293893f},{0.237764f,0.327254f,0.293893f}, {0.125f,0.38471f,0.293893f},{-2.0786e-08f,0.475528f,0.154508f},{-0.146946f,0.452254f,0.154508f}, {-0.279509f,0.38471f,0.154508f},{-0.38471f,0.279508f,0.154508f},{-0.452254f,0.146946f,0.154508f}, {-0.475528f,-4.15719e-08f,0.154508f},{-0.452254f,-0.146946f,0.154508f},{-0.38471f,-0.279509f,0.154508f}, {-0.279508f,-0.38471f,0.154508f},{-0.146946f,-0.452254f,0.154508f},{6.23579e-08f,-0.475528f,0.154508f}, {0.146946f,-0.452254f,0.154508f},{0.279509f,-0.38471f,0.154508f},{0.38471f,-0.279508f,0.154508f}, {0.452254f,-0.146946f,0.154508f},{0.475528f,8.31438e-08f,0.154508f},{0.452254f,0.146946f,0.154508f}, {0.38471f,0.279509f,0.154508f},{0.279508f,0.38471f,0.154508f},{0.146946f,0.452254f,0.154508f}, {-2.1855e-08f,0.5f,-2.1855e-08f},{-0.154509f,0.475528f,-2.1855e-08f},{-0.293893f,0.404508f,-2.1855e-08f}, {-0.404509f,0.293893f,-2.1855e-08f},{-0.475528f,0.154508f,-2.1855e-08f},{-0.5f,-4.3712e-08f,-2.1855e-08f}, {-0.475528f,-0.154509f,-2.1855e-08f},{-0.404508f,-0.293893f,-2.1855e-08f},{-0.293893f,-0.404509f,-2.1855e-08f}, {-0.154508f,-0.475528f,-2.1855e-08f},{6.55671e-08f,-0.5f,-2.1855e-08f},{0.154509f,-0.475528f,-2.1855e-08f}, {0.293893f,-0.404508f,-2.1855e-08f},{0.404509f,-0.293893f,-2.1855e-08f},{0.475528f,-0.154508f,-2.1855e-08f}, {0.5f,8.74221e-08f,-2.1855e-08f},{0.475528f,0.154509f,-2.1855e-08f},{0.404508f,0.293893f,-2.1855e-08f}, {0.293893f,0.404509f,-2.1855e-08f},{0.154508f,0.475528f,-2.1855e-08f},{-2.0786e-08f,0.475528f,-0.154509f}, {-0.146946f,0.452254f,-0.154509f},{-0.279509f,0.38471f,-0.154509f},{-0.38471f,0.279508f,-0.154509f}, {-0.452254f,0.146946f,-0.154509f},{-0.475528f,-4.15719e-08f,-0.154509f},{-0.452254f,-0.146946f,-0.154509f}, {-0.38471f,-0.279509f,-0.154509f},{-0.279508f,-0.38471f,-0.154509f},{-0.146946f,-0.452254f,-0.154509f}, {6.23579e-08f,-0.475528f,-0.154509f},{0.146946f,-0.452254f,-0.154509f},{0.279509f,-0.38471f,-0.154509f}, {0.38471f,-0.279508f,-0.154509f},{0.452254f,-0.146946f,-0.154509f},{0.475528f,8.31438e-08f,-0.154509f}, {0.452254f,0.146946f,-0.154509f},{0.38471f,0.279509f,-0.154509f},{0.279508f,0.38471f,-0.154509f}, {0.146946f,0.452254f,-0.154509f},{-1.76815e-08f,0.404508f,-0.293893f},{-0.125f,0.38471f,-0.293893f}, {-0.237764f,0.327254f,-0.293893f},{-0.327254f,0.237764f,-0.293893f},{-0.38471f,0.125f,-0.293893f}, {-0.404508f,-3.53631e-08f,-0.293893f},{-0.38471f,-0.125f,-0.293893f},{-0.327254f,-0.237764f,-0.293893f}, {-0.237764f,-0.327254f,-0.293893f},{-0.125f,-0.38471f,-0.293893f},{5.30446e-08f,-0.404508f,-0.293893f}, {0.125f,-0.38471f,-0.293893f},{0.237764f,-0.327254f,-0.293893f},{0.327254f,-0.237764f,-0.293893f}, {0.38471f,-0.125f,-0.293893f},{0.404508f,7.07262e-08f,-0.293893f},{0.38471f,0.125f,-0.293893f}, {0.327254f,0.237764f,-0.293893f},{0.237764f,0.327254f,-0.293893f},{0.125f,0.38471f,-0.293893f}, {-1.28464e-08f,0.293893f,-0.404509f},{-0.0908178f,0.279508f,-0.404509f},{-0.172746f,0.237764f,-0.404509f}, {-0.237764f,0.172746f,-0.404509f},{-0.279509f,0.0908178f,-0.404509f},{-0.293893f,-2.56929e-08f,-0.404509f}, {-0.279508f,-0.0908178f,-0.404509f},{-0.237764f,-0.172746f,-0.404509f},{-0.172746f,-0.237764f,-0.404509f}, {-0.0908178f,-0.279509f,-0.404509f},{3.85393e-08f,-0.293893f,-0.404509f},{0.0908178f,-0.279508f,-0.404509f}, {0.172746f,-0.237764f,-0.404509f},{0.237764f,-0.172746f,-0.404509f},{0.279509f,-0.0908178f,-0.404509f}, {0.293893f,5.13857e-08f,-0.404509f},{0.279508f,0.0908179f,-0.404509f},{0.237764f,0.172746f,-0.404509f}, {0.172746f,0.237764f,-0.404509f},{0.0908178f,0.279509f,-0.404509f},{-6.75403e-09f,0.154508f,-0.475528f}, {-0.0477457f,0.146946f,-0.475528f},{-0.0908178f,0.125f,-0.475528f},{-0.125f,0.0908178f,-0.475528f}, {-0.146946f,0.0477457f,-0.475528f},{-0.154508f,-1.35081e-08f,-0.475528f},{-0.146946f,-0.0477458f,-0.475528f}, {-0.125f,-0.0908178f,-0.475528f},{-0.0908178f,-0.125f,-0.475528f},{-0.0477457f,-0.146946f,-0.475528f}, {2.02621e-08f,-0.154508f,-0.475528f},{0.0477458f,-0.146946f,-0.475528f},{0.0908178f,-0.125f,-0.475528f}, {0.125f,-0.0908178f,-0.475528f},{0.146946f,-0.0477457f,-0.475528f},{0.154508f,2.70142e-08f,-0.475528f}, {0.146946f,0.0477458f,-0.475528f},{0.125f,0.0908178f,-0.475528f},{0.0908178f,0.125f,-0.475528f}, {0.0477457f,0.146946f,-0.475528f},{0.0f,0.0f,-0.5f} }; static GLfloat normals [236][3] = { {-0.0247692f,0.156386f,0.987385f},{-0.0567021f,0.358002f,0.931997f},{-0.118514f,0.317702f,0.940755f}, {-0.0718829f,0.141078f,0.987385f},{-0.210889f,0.26553f,0.940755f},{-0.11196f,0.11196f,0.987385f}, {-0.28262f,0.187365f,0.940755f},{-0.141078f,0.0718829f,0.987385f},{-0.326687f,0.0908605f,0.940755f}, {-0.156386f,0.0247691f,0.987385f},{-0.338775f,-0.0145383f,0.940755f},{-0.156386f,-0.0247692f,0.987385f}, {-0.317702f,-0.118514f,0.940755f},{-0.141078f,-0.0718829f,0.987385f},{-0.26553f,-0.210889f,0.940755f}, {-0.11196f,-0.11196f,0.987385f},{-0.187365f,-0.28262f,0.940755f},{-0.0718829f,-0.141078f,0.987385f}, {-0.0908605f,-0.326687f,0.940755f},{-0.0247691f,-0.156386f,0.987385f},{0.0145383f,-0.338775f,0.940755f}, {0.0247692f,-0.156386f,0.987385f},{0.118514f,-0.317702f,0.940755f},{0.071883f,-0.141078f,0.987385f}, {0.210889f,-0.26553f,0.940755f},{0.11196f,-0.11196f,0.987385f},{0.28262f,-0.187365f,0.940755f}, {0.141078f,-0.0718829f,0.987385f},{0.326687f,-0.0908605f,0.940755f},{0.156386f,-0.0247691f,0.987385f}, {0.338775f,0.0145383f,0.940755f},{0.156386f,0.0247692f,0.987385f},{0.317702f,0.118514f,0.940755f}, {0.141078f,0.0718829f,0.987385f},{0.26553f,0.210889f,0.940755f},{0.11196f,0.11196f,0.987385f}, {0.187365f,0.28262f,0.940755f},{0.0718829f,0.141078f,0.987385f},{0.0908605f,0.326687f,0.940755f}, {0.0247692f,0.156386f,0.987385f},{-0.0991988f,0.626316f,0.773232f},{-0.187939f,0.556709f,0.809169f}, {-0.350773f,0.471385f,0.809169f},{-0.479271f,0.339919f,0.809169f},{-0.560855f,0.175179f,0.809169f}, {-0.587538f,-0.00670814f,0.809169f},{-0.556709f,-0.187939f,0.809169f},{-0.471385f,-0.350773f,0.809169f}, {-0.339919f,-0.479271f,0.809169f},{-0.175179f,-0.560855f,0.809169f},{0.00670817f,-0.587538f,0.809169f}, {0.187939f,-0.556709f,0.809169f},{0.350773f,-0.471385f,0.809169f},{0.479271f,-0.339919f,0.809169f}, {0.560855f,-0.175179f,0.809169f},{0.587538f,0.00670817f,0.809169f},{0.556709f,0.187939f,0.809169f}, {0.471385f,0.350773f,0.809169f},{0.339919f,0.479271f,0.809169f},{0.175179f,0.560855f,0.809169f}, {0.0717198f,0.452821f,0.888712f},{0.0717198f,0.452821f,0.888712f},{-0.131687f,0.831438f,0.539787f}, {-0.254546f,0.767756f,0.588011f},{-0.479337f,0.651521f,0.588011f},{-0.657208f,0.47151f,0.588011f}, {-0.770746f,0.245344f,0.588011f},{-0.808839f,-0.00483751f,0.588011f},{-0.767756f,-0.254546f,0.588011f}, {-0.651521f,-0.479337f,0.588011f},{-0.47151f,-0.657208f,0.588011f},{-0.245344f,-0.770746f,0.588011f}, {0.00483765f,-0.808839f,0.588011f},{0.254546f,-0.767756f,0.588011f},{0.479337f,-0.651521f,0.588011f}, {0.657208f,-0.47151f,0.588011f},{0.770746f,-0.245344f,0.588011f},{0.808839f,0.00483765f,0.588011f}, {0.767756f,0.254546f,0.588011f},{0.651521f,0.479337f,0.588011f},{0.47151f,0.657208f,0.588011f}, {0.245344f,0.770746f,0.588011f},{0.111299f,0.702714f,0.702713f},{0.111299f,0.702714f,0.702713f}, {-0.151237f,0.954874f,0.255623f},{-0.296279f,0.903673f,0.309184f},{-0.561028f,0.767888f,0.309184f}, {-0.77086f,0.556938f,0.309184f},{-0.905235f,0.29147f,0.309184f},{-0.950999f,-0.00252808f,0.309184f}, {-0.903673f,-0.296279f,0.309184f},{-0.767888f,-0.561028f,0.309184f},{-0.556938f,-0.77086f,0.309184f}, {-0.29147f,-0.905235f,0.309184f},{0.00252819f,-0.950999f,0.309184f},{0.296279f,-0.903672f,0.309184f}, {0.561028f,-0.767888f,0.309184f},{0.77086f,-0.556938f,0.309184f},{0.905235f,-0.29147f,0.309184f}, {0.950999f,0.00252819f,0.309184f},{0.903672f,0.296279f,0.309184f},{0.767888f,0.561028f,0.309184f}, {0.556938f,0.77086f,0.309184f},{0.29147f,0.905235f,0.309184f},{0.139737f,0.882265f,0.449536f}, {0.139737f,0.882265f,0.449536f},{-0.156222f,0.986348f,-0.0520741f},{-0.309017f,0.951056f,-8.90773e-08f}, {-0.587785f,0.809017f,-1.55249e-07f},{-0.809017f,0.587785f,-1.29798e-07f},{-0.951057f,0.309017f,-8.14421e-08f}, {-1.0f,-7.38069e-08f,-6.87168e-08f},{-0.951056f,-0.309017f,-3.30858e-08f},{-0.809017f,-0.587785f,-1.11983e-07f}, {-0.587785f,-0.809017f,-7.12618e-08f},{-0.309017f,-0.951057f,-8.90773e-08f},{1.39979e-07f,-1.0f,-1.32343e-07f}, {0.309017f,-0.951056f,-1.27253e-07f},{0.587785f,-0.809017f,-9.16224e-08f},{0.809017f,-0.587785f,-4.0721e-08f}, {0.951057f,-0.309017f,-7.8897e-08f},{1.0f,1.32343e-07f,-1.32343e-07f},{0.951056f,0.309017f,-8.90773e-08f}, {0.809017f,0.587785f,-1.32343e-07f},{0.587785f,0.809017f,-1.60339e-07f},{0.309017f,0.951057f,-9.92575e-08f}, {0.154555f,0.975821f,0.154555f},{0.154555f,0.975821f,0.154555f},{-0.146244f,0.923351f,-0.355016f}, {-0.291471f,0.905235f,-0.309184f},{-0.556938f,0.77086f,-0.309184f},{-0.767888f,0.561028f,-0.309184f}, {-0.903673f,0.296279f,-0.309184f},{-0.950999f,0.00252797f,-0.309184f},{-0.905235f,-0.291471f,-0.309184f}, {-0.77086f,-0.556938f,-0.309184f},{-0.561028f,-0.767888f,-0.309184f},{-0.296279f,-0.903673f,-0.309184f}, {-0.00252784f,-0.950999f,-0.309184f},{0.291471f,-0.905235f,-0.309184f},{0.556938f,-0.77086f,-0.309184f}, {0.767888f,-0.561028f,-0.309184f},{0.903673f,-0.296279f,-0.309184f},{0.950999f,-0.00252782f,-0.309184f}, {0.905235f,0.291471f,-0.309184f},{0.77086f,0.556938f,-0.309184f},{0.561028f,0.767888f,-0.309184f}, {0.296279f,0.903673f,-0.309184f},{0.154555f,0.97582f,-0.154555f},{0.154555f,0.97582f,-0.154555f}, {-0.122103f,0.770931f,-0.625105f},{-0.245344f,0.770746f,-0.588011f},{-0.47151f,0.657208f,-0.588011f}, {-0.651521f,0.479337f,-0.588011f},{-0.767756f,0.254546f,-0.588011f},{-0.808839f,0.00483744f,-0.588011f}, {-0.770746f,-0.245344f,-0.588011f},{-0.657208f,-0.47151f,-0.588011f},{-0.479337f,-0.651521f,-0.588011f}, {-0.254545f,-0.767756f,-0.588011f},{-0.00483734f,-0.808839f,-0.588011f},{0.245344f,-0.770746f,-0.588011f}, {0.47151f,-0.657208f,-0.588011f},{0.651521f,-0.479337f,-0.588011f},{0.767756f,-0.254545f,-0.588011f}, {0.808839f,-0.00483727f,-0.588011f},{0.770746f,0.245344f,-0.588011f},{0.657207f,0.47151f,-0.588011f}, {0.479337f,0.651521f,-0.588011f},{0.254545f,0.767756f,-0.588011f},{0.139737f,0.882264f,-0.449536f}, {0.139737f,0.882264f,-0.449536f},{-0.0858589f,0.542091f,-0.835922f},{-0.175179f,0.560855f,-0.809169f}, {-0.339919f,0.479271f,-0.809169f},{-0.471385f,0.350773f,-0.809169f},{-0.556709f,0.187939f,-0.809169f}, {-0.587538f,0.00670798f,-0.809169f},{-0.560855f,-0.175179f,-0.809169f},{-0.479271f,-0.339919f,-0.809169f}, {-0.350773f,-0.471385f,-0.809169f},{-0.187939f,-0.556709f,-0.809169f},{-0.00670795f,-0.587538f,-0.809169f}, {0.17518f,-0.560855f,-0.809169f},{0.339919f,-0.479271f,-0.809169f},{0.471385f,-0.350773f,-0.809169f}, {0.556709f,-0.187939f,-0.809169f},{0.587538f,-0.00670795f,-0.809169f},{0.560855f,0.17518f,-0.809169f}, {0.479271f,0.339919f,-0.809169f},{0.350773f,0.471385f,-0.809169f},{0.187939f,0.556709f,-0.809169f}, {0.111299f,0.702714f,-0.702713f},{0.111299f,0.702714f,-0.702713f},{-0.048858f,0.308477f,-0.949976f}, {-0.0908606f,0.326687f,-0.940755f},{-0.187365f,0.28262f,-0.940755f},{-0.26553f,0.210889f,-0.940755f}, {-0.317702f,0.118514f,-0.940755f},{-0.338775f,0.0145382f,-0.940755f},{-0.326687f,-0.0908606f,-0.940755f}, {-0.28262f,-0.187365f,-0.940755f},{-0.210889f,-0.26553f,-0.940755f},{-0.118514f,-0.317702f,-0.940755f}, {-0.0145382f,-0.338775f,-0.940755f},{0.0908606f,-0.326687f,-0.940755f},{0.187365f,-0.28262f,-0.940755f}, {0.26553f,-0.210889f,-0.940755f},{0.317702f,-0.118514f,-0.940755f},{0.338775f,-0.0145382f,-0.940755f}, {0.326687f,0.0908606f,-0.940755f},{0.28262f,0.187365f,-0.940755f},{0.210889f,0.26553f,-0.940755f}, {0.118514f,0.317702f,-0.940755f},{0.0717198f,0.452821f,-0.888712f},{0.0717198f,0.452821f,-0.888712f}, {-0.0247692f,0.156386f,-0.987385f},{-0.0718829f,0.141078f,-0.987385f},{-0.11196f,0.11196f,-0.987385f}, {-0.141078f,0.0718829f,-0.987385f},{-0.156386f,0.0247692f,-0.987385f},{-0.156386f,-0.0247692f,-0.987385f}, {-0.141078f,-0.071883f,-0.987385f},{-0.11196f,-0.11196f,-0.987385f},{-0.0718829f,-0.141078f,-0.987385f}, {-0.0247692f,-0.156386f,-0.987385f},{0.0247692f,-0.156386f,-0.987385f},{0.0718829f,-0.141078f,-0.987385f}, {0.11196f,-0.11196f,-0.987385f},{0.141078f,-0.0718829f,-0.987385f},{0.156386f,-0.0247692f,-0.987385f}, {0.156386f,0.0247692f,-0.987385f},{0.141078f,0.071883f,-0.987385f},{0.11196f,0.11196f,-0.987385f}, {0.0718829f,0.141078f,-0.987385f},{0.0247692f,0.156386f,-0.987385f} }; static GLfloat textures [230][2] = { {0.0f,1.0f},{0.0f,0.9f},{0.05f,0.9f}, {0.05f,1.0f},{0.1f,0.9f},{0.1f,1.0f}, {0.15f,0.9f},{0.15f,1.0f},{0.2f,0.9f}, {0.2f,1.0f},{0.25f,0.9f},{0.25f,1.0f}, {0.3f,0.9f},{0.3f,1.0f},{0.35f,0.9f}, {0.35f,1.0f},{0.4f,0.9f},{0.4f,1.0f}, {0.45f,0.9f},{0.45f,1.0f},{0.5f,0.9f}, {0.5f,1.0f},{0.55f,0.9f},{0.55f,1.0f}, {0.6f,0.9f},{0.6f,1.0f},{0.65f,0.9f}, {0.65f,1.0f},{0.7f,0.9f},{0.7f,1.0f}, {0.75f,0.9f},{0.75f,1.0f},{0.8f,0.9f}, {0.8f,1.0f},{0.85f,0.9f},{0.85f,1.0f}, {0.9f,0.9f},{0.9f,1.0f},{0.95f,0.9f}, {0.95f,1.0f},{1.0f,0.9f},{0.0f,0.8f}, {0.05f,0.8f},{0.1f,0.8f},{0.15f,0.8f}, {0.2f,0.8f},{0.25f,0.8f},{0.3f,0.8f}, {0.35f,0.8f},{0.4f,0.8f},{0.45f,0.8f}, {0.5f,0.8f},{0.55f,0.8f},{0.6f,0.8f}, {0.65f,0.8f},{0.7f,0.8f},{0.75f,0.8f}, {0.8f,0.8f},{0.85f,0.8f},{0.9f,0.8f}, {0.95f,0.8f},{1.0f,0.8f},{0.0f,0.7f}, {0.05f,0.7f},{0.1f,0.7f},{0.15f,0.7f}, {0.2f,0.7f},{0.25f,0.7f},{0.3f,0.7f}, {0.35f,0.7f},{0.4f,0.7f},{0.45f,0.7f}, {0.5f,0.7f},{0.55f,0.7f},{0.6f,0.7f}, {0.65f,0.7f},{0.7f,0.7f},{0.75f,0.7f}, {0.8f,0.7f},{0.85f,0.7f},{0.9f,0.7f}, {0.95f,0.7f},{1.0f,0.7f},{0.0f,0.6f}, {0.05f,0.6f},{0.1f,0.6f},{0.15f,0.6f}, {0.2f,0.6f},{0.25f,0.6f},{0.3f,0.6f}, {0.35f,0.6f},{0.4f,0.6f},{0.45f,0.6f}, {0.5f,0.6f},{0.55f,0.6f},{0.6f,0.6f}, {0.65f,0.6f},{0.7f,0.6f},{0.75f,0.6f}, {0.8f,0.6f},{0.85f,0.6f},{0.9f,0.6f}, {0.95f,0.6f},{1.0f,0.6f},{0.0f,0.5f}, {0.05f,0.5f},{0.1f,0.5f},{0.15f,0.5f}, {0.2f,0.5f},{0.25f,0.5f},{0.3f,0.5f}, {0.35f,0.5f},{0.4f,0.5f},{0.45f,0.5f}, {0.5f,0.5f},{0.55f,0.5f},{0.6f,0.5f}, {0.65f,0.5f},{0.7f,0.5f},{0.75f,0.5f}, {0.8f,0.5f},{0.85f,0.5f},{0.9f,0.5f}, {0.95f,0.5f},{1.0f,0.5f},{0.0f,0.4f}, {0.05f,0.4f},{0.1f,0.4f},{0.15f,0.4f}, {0.2f,0.4f},{0.25f,0.4f},{0.3f,0.4f}, {0.35f,0.4f},{0.4f,0.4f},{0.45f,0.4f}, {0.5f,0.4f},{0.55f,0.4f},{0.6f,0.4f}, {0.65f,0.4f},{0.7f,0.4f},{0.75f,0.4f}, {0.8f,0.4f},{0.85f,0.4f},{0.9f,0.4f}, {0.95f,0.4f},{1.0f,0.4f},{0.0f,0.3f}, {0.05f,0.3f},{0.1f,0.3f},{0.15f,0.3f}, {0.2f,0.3f},{0.25f,0.3f},{0.3f,0.3f}, {0.35f,0.3f},{0.4f,0.3f},{0.45f,0.3f}, {0.5f,0.3f},{0.55f,0.3f},{0.6f,0.3f}, {0.65f,0.3f},{0.7f,0.3f},{0.75f,0.3f}, {0.8f,0.3f},{0.85f,0.3f},{0.9f,0.3f}, {0.95f,0.3f},{1.0f,0.3f},{0.0f,0.2f}, {0.05f,0.2f},{0.1f,0.2f},{0.15f,0.2f}, {0.2f,0.2f},{0.25f,0.2f},{0.3f,0.2f}, {0.35f,0.2f},{0.4f,0.2f},{0.45f,0.2f}, {0.5f,0.2f},{0.55f,0.2f},{0.6f,0.2f}, {0.65f,0.2f},{0.7f,0.2f},{0.75f,0.2f}, {0.8f,0.2f},{0.85f,0.2f},{0.9f,0.2f}, {0.95f,0.2f},{1.0f,0.2f},{0.0f,0.1f}, {0.05f,0.1f},{0.1f,0.1f},{0.15f,0.1f}, {0.2f,0.1f},{0.25f,0.1f},{0.3f,0.1f}, {0.35f,0.1f},{0.4f,0.1f},{0.45f,0.1f}, {0.5f,0.1f},{0.55f,0.1f},{0.6f,0.1f}, {0.65f,0.1f},{0.7f,0.1f},{0.75f,0.1f}, {0.8f,0.1f},{0.85f,0.1f},{0.9f,0.1f}, {0.95f,0.1f},{1.0f,0.1f},{0.05f,1.1f}, {0.0f,1.1f},{0.1f,1.1f},{0.15f,1.1f}, {0.2f,1.1f},{0.25f,1.1f},{0.3f,1.1f}, {0.35f,1.1f},{0.4f,1.1f},{0.45f,1.1f}, {0.5f,1.1f},{0.55f,1.1f},{0.6f,1.1f}, {0.65f,1.1f},{0.7f,1.1f},{0.75f,1.1f}, {0.8f,1.1f},{0.85f,1.1f},{0.9f,1.1f}, {0.95f,1.1f},{1.0f,1.1f} }; /*Material indicies*/ /*{material index,face count}*/ static int material_ref [1][2] = { {0,360} }; struct DIB2D{ BITMAPINFOHEADER *Info; RGBQUAD *palette; BYTE *bits; }; struct GLTXTLOAD{ GLint format; GLint perpixel; GLint Width; GLint Height; BYTE* bits; }; /* BOOL LoadDIB(char*file,DIB2D*dib) Only trueColor and 256 color ucompressed bitmaps supported */ BOOL LoadDIB(char*file,DIB2D*dib) { BOOL result=FALSE; HANDLE hfile=CreateFile(file,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING ,FILE_ATTRIBUTE_NORMAL,0); if(hfile!=INVALID_HANDLE_VALUE) { DWORD readed; int size=GetFileSize(hfile,0); if(size>sizeof(BITMAPFILEHEADER)) { BITMAPFILEHEADER bmfh; ReadFile(hfile,&bmfh,sizeof(BITMAPFILEHEADER),&readed,0); if((readed==sizeof(BITMAPFILEHEADER)) && (bmfh.bfType==0x4d42)) { dib->Info=(BITMAPINFOHEADER*)(new BYTE[size-sizeof(BITMAPFILEHEADER)]); ReadFile(hfile,dib->Info,size-sizeof(BITMAPFILEHEADER),&readed,0); dib->bits=(BYTE*)(dib->Info+1); if(dib->Info->biBitCount==8) { dib->palette=(RGBQUAD*)dib->bits; if(dib->Info->biClrUsed)dib->bits+=dib->Info->biClrUsed*4;else dib->bits+=1024; }else{ dib->palette=NULL; } result=TRUE; } } CloseHandle(hfile); } return result; }; long ScanBytes(int pixWidth, int bitsPixel) { return (((long)pixWidth*bitsPixel+31) / 32) * 4; } BOOL ScaleImage(DIB2D&dib,GLTXTLOAD&p) { GLint glMaxTexDim; // OpenGL maximum texture dimension GLint XDMaxTexDim=512; // user maximum texture dimension GLint minsize =2; double xPow2, yPow2; int ixPow2, iyPow2; int xSize2, ySize2; GLint m_iWidth=dib.Info->biWidth; GLint m_iHeight=dib.Info->biHeight; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glMaxTexDim); glMaxTexDim = min(XDMaxTexDim, glMaxTexDim); if (m_iWidth <= glMaxTexDim) xPow2 = log((double)m_iWidth) / log(2.0); else xPow2 = log((double)glMaxTexDim) / log(2.0); if (m_iHeight <= glMaxTexDim) yPow2 = log((double)m_iHeight) / log(2.0); else yPow2 = log((double)glMaxTexDim) / log(2.0); ixPow2 = (int)xPow2; iyPow2 = (int)yPow2; if (xPow2 != (double)ixPow2) ixPow2++; if (yPow2 != (double)iyPow2) iyPow2++; xSize2 = 1 << ixPow2; ySize2 = 1 << iyPow2; if(xSize2<minsize)xSize2=minsize; if(ySize2<minsize)ySize2=minsize; if(((xSize2==m_iWidth) && (ySize2==m_iHeight))) { if(dib.Info->biBitCount==24){ p.format=GL_BGR_EXT; p.perpixel=3; return FALSE; } if(dib.Info->biBitCount==32) { p.format=GL_BGRA_EXT; p.perpixel=4; return FALSE; } } BYTE *bits=(BYTE *)dib.bits; if(dib.Info->biBitCount==8){ // convert to TRUECOLOR int _perline=ScanBytes(8,m_iWidth); int perline=ScanBytes(24,m_iWidth); bits= new BYTE[perline*m_iHeight * sizeof(BYTE)]; for(int y=0;y<m_iHeight;y++){ BYTE *_b=((BYTE *)dib.bits)+y*_perline; BYTE *b=bits+y*perline; for(int x=0;x<m_iWidth;x++){ RGBQUAD _p=dib.palette[*_b]; _b++; *b=_p.rgbBlue;b++; *b=_p.rgbGreen;b++; *b=_p.rgbRed;b++; } } } BOOL isAlpha=(dib.Info->biBitCount==32); int _mem_size=xSize2 * ySize2 * sizeof(BYTE); if(isAlpha){ _mem_size*=4; p.perpixel=4; p.format=GL_BGRA_EXT; }else { _mem_size*=3; p.perpixel=3; p.format=GL_BGR_EXT; } BYTE *pData = (BYTE*)new BYTE[_mem_size]; if (!pData) return FALSE; if(isAlpha){ gluScaleImage(GL_BGRA_EXT, m_iWidth, m_iHeight, GL_UNSIGNED_BYTE, bits, xSize2, ySize2, GL_UNSIGNED_BYTE, pData); } else gluScaleImage(GL_RGB, m_iWidth, m_iHeight, GL_UNSIGNED_BYTE, bits, xSize2, ySize2, GL_UNSIGNED_BYTE, pData); if(bits!=dib.bits)delete bits; // m_pBits = pData; m_iWidth = xSize2 ; m_iHeight = ySize2 ; p.Width=m_iWidth; p.Height=m_iHeight; p.bits=pData; return TRUE ; } void LoadTexture(char*filename) { DIB2D dib; GLTXTLOAD load; if(LoadDIB(filename,&dib)) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if(ScaleImage(dib,load)) { glTexImage2D(GL_TEXTURE_2D,0,load.perpixel, load.Width,load.Height,0, load.format,GL_UNSIGNED_BYTE, load.bits); delete load.bits; }else{ glTexImage2D(GL_TEXTURE_2D,0,load.perpixel, dib.Info->biWidth,dib.Info->biHeight, 0,load.format,GL_UNSIGNED_BYTE,dib.bits); } delete dib.Info; } //DeleteObject(hbitmap); }; void MyMaterial(GLenum mode,GLfloat *f,GLfloat alpha) { GLfloat d[4]; d[0]=f[0]; d[1]=f[1]; d[2]=f[2]; d[3]=alpha; glMaterialfv (GL_FRONT_AND_BACK,mode,d); } /* * SelectMaterial uses OpenGL commands to define facet colors. * * Returns: * Nothing */ void SelectMaterial(int i) { // // Define the reflective properties of the 3D Object faces. // glEnd(); GLfloat alpha=materials[i].alpha; MyMaterial (GL_AMBIENT, materials[i].ambient,alpha); MyMaterial (GL_DIFFUSE, materials[i].diffuse,alpha); MyMaterial (GL_SPECULAR, materials[i].specular,alpha); MyMaterial (GL_EMISSION, materials[i].emission,alpha); glMaterialf (GL_FRONT_AND_BACK,GL_SHININESS,materials[i].phExp); glEnd(); if(materials[i].texture>-1) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,texture_maps[materials[i].texture].id); } else glDisable(GL_TEXTURE_2D); glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES); }; GLint Gen3DObjectList() { int i; int j; GLuint texture_name; glGenTextures(1,&texture_name); texture_maps[0].id=texture_name; glBindTexture(GL_TEXTURE_2D,texture_name); LoadTexture(texture_maps[0].name); GLint lid=glGenLists(1); int mcount=0; int mindex=0; glNewList(lid, GL_COMPILE); glBegin (GL_TRIANGLES); for(i=0;i<sizeof(face_indicies)/sizeof(face_indicies[0]);i++) { if(!mcount) { SelectMaterial(material_ref[mindex][0]); mcount=material_ref[mindex][1]; mindex++; } mcount--; for(j=0;j<3;j++) { int vi=face_indicies[i][j]; int ni=face_indicies[i][j+3];//Normal index int ti=face_indicies[i][j+6];//Texture index glNormal3f (normals[ni][0],normals[ni][1],normals[ni][2]); glTexCoord2f(textures[ti][0],textures[ti][1]); glVertex3f (vertices[vi][0],vertices[vi][1],vertices[vi][2]); } } glEnd (); glEndList(); return lid; }; /////////////////////////////////////////////////////////////////// void init () { glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse); glLightfv (GL_LIGHT0, GL_POSITION, position); glEnable (GL_LIGHT0); glEnable (GL_LIGHTING); glShadeModel (GL_SMOOTH); glClearColor ( 0.0, 0.0, 0.0, 0.0); glClearDepth ( 1.0); glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL); glEnable (GL_COLOR_MATERIAL); glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); } /////////////////////////////////////////////////////////////////// void display () { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity (); glTranslated ( 0.0, 0.0,-22.0); glRotated ( rterre, 0.0, 1.0, 0.0); rterre+=0.5; glScalef ( 10.0, 10.0, 10.0); terre=Gen3DObjectList (); glCallList (terre); glLoadIdentity (); glTranslated ( 0.0, 0.0,-22.0); glRotated ( orbite, 0.0, 1.0, 0.0); orbite+=orbitespeed; glTranslated ( 15.0, 0.0, 0.0); glRotated (rlune, 0.0, 1.0, 0.0); rlune+=1.0; glutSolidSphere ( 1.0, 30, 30); glFlush (); glutSwapBuffers (); } /////////////////////////////////////////////////////////////////// void keyboard (unsigned char key, int x, int y) { switch (key) { case 27: exit (0); break; default: break; } } /////////////////////////////////////////////////////////////////// void arrow_keys (int a_keys, int x, int y) { switch (a_keys) { case GLUT_KEY_RIGHT: orbitespeed+=0.1; break; case GLUT_KEY_LEFT: if (orbitespeed>0.1) { orbitespeed-=0.1; } break; default: break; } } /////////////////////////////////////////////////////////////////// void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); if (h==0) gluPerspective (80,(float) w, 1.0, 5000.0); else gluPerspective (80,(float)w/(float) h, 1.0, 5000.0); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); } /////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { glutInit (&argc, argv); glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize (640, 480); //glutInitWindowPosition (100, 100); glutCreateWindow ("Space" ); //glutFullScreen (); init (); glutDisplayFunc (display); glutIdleFunc (display); glutReshapeFunc (reshape); glutKeyboardFunc (keyboard); glutSpecialFunc (arrow_keys); glutMainLoop (); return 0; } |
Alload | http://www.xdsoft.com/explorer/ |
XuTi | ou trouver le programme en question??? |
XuTi | ou trouver le programme en question??? |
XuTi | ou trouver le programme en question??? |
Alload | Please |
Alload | Personne utilisant ce programme pourrait me dire exactement comment optimiser le code? Pour pas charger les textures à chaque rendu, etc...
SVP |
Hercule | Regarde comment ils initialisent les textures (il faut pas que ca le fasse à chaque rendu).
il te faut au moins le tableau de coordonnées de textures pour que les textures soient bien placées. |
Alload | J'ai essayé de changer les options, ben tout marche bien tant que je n'exporte pas les matériaux. Donc j'ai toute la sphère impec mais sans texture. J'ai essayé de mettre la texture manuellement, ça marche sauf qu'elle n'est plus bien placée, quelqu'un a une idée pour m'aider?
Thanks. |
Alload | Voilà, j'ai fait une sphère texturée avec 3D Studio Max 3 puis je l'ai exporté en fichier .3DS. Ensuite j'ai ouvert ce fichier avec 3D Exploration et je l'ai sauvegardé en C++. Je mets le code C++ dans mon programme OpenGL, je compile et je lance le prog.
Et ben merde, j'ai même pas 1 frame par seconde. J'ai pas mis de trop de faces dans la sphère. Comment résoudre ce problème? Parce que modéliser les objets avec 3DSMax puis avoir leur code avec 3D Exploration me semblait une très bonne méthode. Please help me!!! |