Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1807 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  probleme execution animation opengl

 


Sujet(s) à lire :
    - Visual C++
 

 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

probleme execution animation opengl

n°2115938
encours
Posté le 10-12-2011 à 20:38:40  profilanswer
 

bonsoir,
dans mon programme opengl c++, j'ai une voiture qui roule sur une route mais alors je la fais rouler d'un pas de 0.1 et au lieu qu'il roule d'une facon continu elle roule discret comme si elle fait des pas (surement c'est probleme de memoire ) puis elle reste de bouger apres un certain nombre de pas meme si la boucle est pour l'infini
je sais pas pourquoi
voila le code de main (il reste un .h qui contient des fonctions): je souhaite que vous me detectez le probleme :
 
 
 

Code :
  1. #include "stdafx.h"
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <time.h>
  5. #include <math.h>
  6. #include <Windows.h>
  7. #include <GL/glut.h>
  8. #include "drawing_functions.h"
  9. #include "SOIL.h"
  10. //#include "glm.h"
  11. //#include "drawmodel.h"
  12. //#include "glm.c"
  13. /* l'heure systeme
  14.  
  15. SYSTEMTIME Time;
  16.  
  17.     GetLocalTime(&Time);
  18.  
  19.     printf("Nous sommes le : %02d/%02d/%04d.\n",
  20.     Time.wDay, Time.wMonth, Time.wYear);
  21.  
  22.     printf("Et il est : %02dh %02dmn %02ds %03dms.\n",
  23.     Time.wHour, Time.wMinute, Time.wSecond, Time.wMilliseconds);
  24.  
  25. */
  26. float yy = 1.8;
  27. GLuint texture[2];
  28. int LoadGLTextures()         // Load Bitmaps And Convert To Textures
  29. {
  30. /* load an image file directly as a new OpenGL texture */
  31. texture[0] = SOIL_load_OGL_texture( "facmodif.bmp",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  32. texture[1] = SOIL_load_OGL_texture( "vert2.bmp",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  33. texture[2] = SOIL_load_OGL_texture( "arriere.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  34. texture[3] = SOIL_load_OGL_texture( "couleur.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  35. texture[4] = SOIL_load_OGL_texture( "vitre.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  36. texture[5] = SOIL_load_OGL_texture( "parebrise.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  37. texture[6] = SOIL_load_OGL_texture( "terrain.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  38. texture[7] = SOIL_load_OGL_texture( "mur.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  39. texture[8] = SOIL_load_OGL_texture( "facade.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  40. texture[9] = SOIL_load_OGL_texture( "facade2.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  41. texture[10] = SOIL_load_OGL_texture("zlij.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  42. texture[11] = SOIL_load_OGL_texture("porte.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  43. texture[12] = SOIL_load_OGL_texture("marbre.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  44. texture[13] = SOIL_load_OGL_texture("trotoir1.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  45. texture[14] = SOIL_load_OGL_texture("mur_deniere.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  46. texture[15] = SOIL_load_OGL_texture("sol.png",SOIL_LOAD_AUTO,SOIL_CREATE_NEW_ID,SOIL_FLAG_INVERT_Y);
  47. //if(texture[0] == 0)
  48.  //return false;
  49. //Typical Texture Generation Using Data From The Bitmap
  50. //glBindTexture(GL_TEXTURE_2D, texture[0]);
  51. //glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
  52. //glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
  53. return true;          // Return Success
  54. }
  55. static void key(unsigned char k, int x, int y)
  56. {
  57.   switch (k) {
  58.   case 27:  //Echaper
  59.     exit(0);
  60.     break;
  61.   default:
  62.     return;
  63.   }
  64.   glutPostRedisplay();
  65. }
  66. void Dessiner()
  67. {
  68. //for(;;){
  69.  //yy = yy -0.1 ;
  70. /*
  71. */
  72. glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
  73.     glMatrixMode( GL_MODELVIEW );
  74.     glLoadIdentity( );
  75.     gluLookAt(5.5,6.5,7,0,0,0,0,0,1);
  76. //drawRectangle3D(1.15,1.15,0.1,1.55,1.15,0.1,1.55,7,0.1,1.15,7,0.1);
  77. LoadGLTextures();
  78. //glColor3ub(255,255,255);
  79. glBindTexture(GL_TEXTURE_2D, texture[6]);
  80. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);       
  81. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  82. glMatrixMode(GL_TEXTURE);
  83. glLoadIdentity();
  84. //glScalef(2,2,2);
  85. glEnable(GL_TEXTURE_2D);
  86. glColor3ub(0,255,0);
  87. glBegin(GL_QUADS);
  88.  glTexCoord2i(0,0); glVertex3d(1.55,1.55,0.1);
  89.  glTexCoord2i(20,0); glVertex3d(1.15,6,0);
  90.  glTexCoord2i(20,20); glVertex3d(6,6,0);
  91.  glTexCoord2i(0,20); glVertex3d(6,1.15,0);
  92. glEnd();
  93. glDisable(GL_TEXTURE_2D);
  94. glMatrixMode( GL_MODELVIEW );
  95.     //glLoadIdentity( );
  96. glColor3ub(63,63,63);
  97. drawRectangle(1,6,-1,6,-1,-19,1,-19,0.01); // route horizontale
  98. drawRectangle(6,1,6,-1,-12,-1,-12,1,0.011); // route verticale
  99. glColor3f(1,1,1);
  100. drawRectangle(0.99,1.1,0.7,1.1,0.7,1.6,0.99,1.6,0.11);//les places des pietons de la route vers la droite  
  101. drawRectangle(0.64,1.1,0.4,1.1,0.4,1.6,0.64,1.6,0.11);
  102. drawRectangle(0.34,1.1,0.1,1.1,0.1,1.6,0.34,1.6,0.11);
  103. drawRectangle(0.04,1.1,-0.2,1.1,-0.2,1.6,0.04,1.6,0.11);
  104. drawRectangle(-0.26,1.1,-0.5,1.1,-0.5,1.6,-0.26,1.6,0.11);
  105. drawRectangle(-0.56,1.1,-0.84,1.1,-0.84,1.6,-0.56,1.6,0.11);
  106. drawRectangle(0.99,-1.1,0.7,-1.1,0.7,-1.6,0.99,-1.6,0.11);//les places des pietons de la route vers la gauche  
  107. drawRectangle(0.64,-1.1,0.4,-1.1,0.4,-1.6,0.64,-1.6,0.11);
  108. drawRectangle(0.34,-1.1,0.1,-1.1,0.1,-1.6,0.34,-1.6,0.11);
  109. drawRectangle(0.04,-1.1,-0.2,-1.1,-0.2,-1.6,0.04,-1.6,0.11);
  110. drawRectangle(-0.26,-1.1,-0.5,-1.1,-0.5,-1.6,-0.26,-1.6,0.11);
  111. drawRectangle(-0.56,-1.1,-0.84,-1.1,-0.84,-1.6,-0.56,-1.6,0.11);
  112. drawRectangle(-1.1,0.99,-1.1,0.7,-1.6,0.7,-1.6,0.99,0.11);//les places des pietons de la route vers la haut  
  113. drawRectangle(-1.1,0.64,-1.1,0.4,-1.6,0.4,-1.6,0.64,0.11);
  114. drawRectangle(-1.1,0.34,-1.1,0.1,-1.6,0.1,-1.6,0.34,0.11);
  115. drawRectangle(-1.1,0.04,-1.1,-0.2,-1.6,-0.2,-1.6,0.04,0.11);
  116. drawRectangle(-1.1,-0.26,-1.1,-0.5,-1.6,-0.5,-1.6,-0.26,0.11);
  117. drawRectangle(-1.1,-0.56,-1.1,-0.84,-1.6,-0.84,-1.6,-0.56,0.11);
  118. drawRectangle(1.1,0.99,1.1,0.7,1.6,0.7,1.6,0.99,0.11);//les places des pietons de la route vers la bas  
  119. drawRectangle(1.1,0.64,1.1,0.4,1.6,0.4,1.6,0.64,0.11);
  120. drawRectangle(1.1,0.34,1.1,0.1,1.6,0.1,1.6,0.34,0.11);
  121. drawRectangle(1.1,0.04,1.1,-0.2,1.6,-0.2,1.6,0.04,0.11);
  122. drawRectangle(1.1,-0.26,1.1,-0.5,1.6,-0.5,1.6,-0.26,0.11);
  123. drawRectangle(1.1,-0.56,1.1,-0.84,1.6,-0.84,1.6,-0.56,0.11);
  124. int j ;
  125. for(j=0;j<15;j++){
  126. drawRectangle(0.04,1.8+j,-0.04,1.8+j,-0.04,2.4+j,0.04,2.4+j,0.11);//les rectangles au milieu du route droite
  127. drawRectangle(0.04,-1.8-j,-0.04,-1.8-j,-0.04,-2.4-j,0.04,-2.4-j,0.11);//les rectangles au milieu du route gauche
  128. drawRectangle(1.8+j,0.04,1.8+j,-0.04,2.4+j,-0.04,2.4+j,0.04,0.11);//les rectangles au milieu du route bas
  129. drawRectangle(-1.8-j,0.04,-1.8-j,-0.04,-2.4-j,-0.04,-2.4-j,0.04,0.11);//les rectangles au milieu du route haut
  130. }
  131. float i,y=1;
  132. for(i = 1;i<25;i++){
  133. glColor3ub(255,0,0);
  134. drawRectangle3D(-1,y,0,-1,y+0.3,0,-1,y+0.3,0.1,-1,y,0.1);// les trotoires du route droite vers (haut) rouge
  135. drawRectangle3D(-1,y,0.1,-1,y+0.3,0.1,-1.15,y+0.3,0.1,-1.15,y,0.1);
  136. //if(y>4 || y<2.5){// pour l'entrée du terrain
  137. drawRectangle3D(1,y,0,1,y+0.3,0,1,y+0.3,0.1,1,y,0.1);// les trotoires du route droite vers (bas) rouge
  138. drawRectangle3D(1,y,0.1,1,y+0.3,0.1,1.15,y+0.3,0.1,1.15,y,0.1);
  139. //}
  140. drawRectangle3D(-y,-1,0,-y-0.3,-1,0,-y-0.3,-1,0.1,-y,-1,0.1);// les trotoires du route haut vers (gauche) rouge
  141. drawRectangle3D(-y,-1,0.1,-y-0.3,-1,0.1,-y-0.3,-1.15,0.1,-y,-1.15,0.1);
  142. drawRectangle3D(-y,1,0,-y-0.3,1,0,-y-0.3,1,0.1,-y,1,0.1);// les trotoires du route haut vers (droite) rouge
  143. drawRectangle3D(-y,1,0.1,-y-0.3,1,0.1,-y-0.3,1.15,0.1,-y,1.15,0.1);
  144. drawRectangle3D(y,-1,0,y+0.3,-1,0,y+0.3,-1,0.1,y,-1,0.1);// les trotoires du route bas vers (gauche) rouge
  145. drawRectangle3D(y,-1,0.1,y+0.3,-1,0.1,y+0.3,-1.15,0.1,y,-1.15,0.1);
  146. drawRectangle3D(y,1,0,y+0.3,1,0,y+0.3,1,0.1,y,1,0.1);// les trotoires du route bas vers (droite) rouge
  147. drawRectangle3D(y,1,0.1,y+0.3,1,0.1,y+0.3,1.15,0.1,y,1.15,0.1);
  148. drawRectangle3D(-1,-y,0,-1,-y-0.3,0,-1,-y-0.3,0.1,-1,-y,0.1);// les trotoires du route gauche (vres haut)
  149. drawRectangle3D(-1,-y,0.1,-1,-y-0.3,0.1,-1.15,-y-0.3,0.1,-1.15,-y,0.1);
  150. drawRectangle3D(1,-y,0,1,-y-0.3,0,1,-y-0.3,0.1,1,-y,0.1);// les trotoires du route gauche (vres bas)
  151. drawRectangle3D(1,-y,0.1,1,-y-0.3,0.1,1.15,-y-0.3,0.1,1.15,-y,0.1);
  152. y= y +0.3;
  153. glColor3ub(255,255,255);
  154. drawRectangle3D(-1,y,0,-1,y+0.3,0,-1,y+0.3,0.1,-1,y,0.1);// les trotoires du route droite vers (haut) blanc
  155. drawRectangle3D(-1,y,0.1,-1,y+0.3,0.1,-1.15,y+0.3,0.1,-1.15,y,0.1);
  156. //if(y>4 || y<2.5){// pour l'entrée du terrain
  157. drawRectangle3D(1,y,0,1,y+0.3,0,1,y+0.3,0.1,1,y,0.1);// les trotoires du route droite vers (bas) blanc
  158. drawRectangle3D(1,y,0.1,1,y+0.3,0.1,1.15,y+0.3,0.1,1.15,y,0.1);
  159. //}
  160. drawRectangle3D(-1,-y,0,-1,-y-0.3,0,-1,-y-0.3,0.1,-1,-y,0.1);// les trotoires du route gauche vers (haut) blanc
  161. drawRectangle3D(-1,-y,0.1,-1,-y-0.3,0.1,-1.15,-y-0.3,0.1,-1.15,-y,0.1);
  162. drawRectangle3D(1,-y,0,1,-y-0.3,0,1,-y-0.3,0.1,1,-y,0.1);// les trotoires du route gauche vers (bas) blanc
  163. drawRectangle3D(1,-y,0.1,1,-y-0.3,0.1,1.15,-y-0.3,0.1,1.15,-y,0.1);
  164. drawRectangle3D(-y,-1,0,-y-0.3,-1,0,-y-0.3,-1,0.1,-y,-1,0.1);// les trotoires du route haut vers (gauche) blanc
  165. drawRectangle3D(-y,-1,0.1,-y-0.3,-1,0.1,-y-0.3,-1.15,0.1,-y,-1.15,0.1);
  166. drawRectangle3D(-y,1,0,-y-0.3,1,0,-y-0.3,1,0.1,-y,1,0.1);// les trotoires du route haut vers (droite) blanc
  167. drawRectangle3D(-y,1,0.1,-y-0.3,1,0.1,-y-0.3,1.15,0.1,-y,1.15,0.1);
  168. drawRectangle3D(y,-1,0,y+0.3,-1,0,y+0.3,-1,0.1,y,-1,0.1);// les trotoires du route bas vers (gauche) blanc
  169. drawRectangle3D(y,-1,0.1,y+0.3,-1,0.1,y+0.3,-1.15,0.1,y,-1.15,0.1);
  170. drawRectangle3D(y,1,0,y+0.3,1,0,y+0.3,1,0.1,y,1,0.1);// les trotoires du route bas vers (droite) blanc
  171. drawRectangle3D(y,1,0.1,y+0.3,1,0.1,y+0.3,1.15,0.1,y,1.15,0.1);
  172. y= y +0.3;
  173. }
  174. // trotoir droit bas
  175. glColor3ub(130,130,130);
  176. drawRectangle3DTexture(texture,1.15,1.15,0.1,1.55,1.15,0.1,1.55,7,0.1,1.15,7,0.1);
  177. drawRectangle3DTexture(texture,1.55,1.15,0.1,1.55,1.55,0.1,7,1.55,0.1,7,1.15,0.1);
  178. //trotoir droit haut
  179. drawRectangle3DTexture(texture,-1.15,1.15,0.1,-1.55,1.15,0.1,-1.55,7,0.1,-1.15,7,0.1);
  180. drawRectangle3DTexture(texture,-1.55,1.15,0.1,-1.55,1.55,0.1,-7,1.55,0.1,-7,1.15,0.1);
  181. //trotoir devant usine
  182. drawRectangle3DTexture(texture,-1.15,-1.15,0.1,-1.55,-1.15,0.1,-1.55,-17,0.1,-1.15,-17,0.1);
  183. drawRectangle3DTexture(texture,-1.55,-1.15,0.1,-1.55,-1.55,0.1,-17,-1.55,0.1,-17,-1.15,0.1);
  184. //trotoir devant devant usine
  185. drawRectangle3DTexture(texture,1.15,-1.15,0.1,1.55,-1.15,0.1,1.55,-7,0.1,1.15,-7,0.1);
  186. drawRectangle3DTexture(texture,1.55,-1.15,0.1,1.55,-1.55,0.1,7,-1.55,0.1,7,-1.15,0.1);
  187. //mur droit haut
  188. /*
  189. */
  190. mur_villa(texture);
  191. dernier_batiment(texture);
  192. /*
  193. * le mur de l'immeuble et son image
  194. */ 
  195. glColor3ub(255,255,255);
  196. glBindTexture(GL_TEXTURE_2D, texture[0]);
  197. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);       
  198. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  199. glMatrixMode(GL_TEXTURE);
  200. glLoadIdentity();
  201. //glScalef(2,2,2);
  202. glEnable(GL_TEXTURE_2D);
  203. glBegin (GL_QUADS);
  204.    glTexCoord2i(0,0); glVertex3f (-1.55,1.55,0.1);
  205.    glTexCoord2i(1,0); glVertex3f (-1.55,7,0.1);
  206.    glTexCoord2i(1,1); glVertex3f (-1.55,7,2);
  207.    glTexCoord2i(0,1); glVertex3f (-1.55,1.55,2);
  208.    glEnd ();
  209.    glMatrixMode(GL_MODELVIEW);// les autres murs du meme immeuble
  210. drawRectangle3D(-1.55,1.55,0.1,-1.55,7,0.1,-1.55,7,2,-1.55,1.55,2);
  211. drawRectangle3D(-1.55,1.55,0.1,-7,1.55,0.1,-7,1.55,2,-1.55,1.55,2);
  212. drawRectangle3D(-1.55,1.55,2,-7,1.55,2,-7,7,2,-1.55,7,2);//plafon
  213. /*-------- le feu rouge  a cote du mur
  214. */
  215. GLUquadric* params = gluNewQuadric();
  216. glPushMatrix();
  217. glTranslated(-1.24,1.52,0);    // changement repere
  218.     glColor3ub(155,155,155);
  219. gluCylinder(params,0.05,0.05,1.1,20,1);
  220.     glTranslated(0,0,0.47);     // changement repere
  221. glColor3ub(255,0,0);
  222. // la texture et le feu tricolore
  223. glColor3ub(255,255,255);
  224. glBindTexture(GL_TEXTURE_2D, texture[1]);
  225. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);       
  226. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  227. glMatrixMode(GL_TEXTURE);
  228. glEnable(GL_TEXTURE_2D);
  229. glBegin (GL_QUADS);
  230.    glTexCoord2i(0,0); glVertex3f (0.11,0.11,0);
  231.    glTexCoord2i(1,0); glVertex3f (-0.11,0.11,0);
  232.    glTexCoord2i(1,1); glVertex3f (-0.11,0.11,0.7);
  233.    glTexCoord2i(0,1); glVertex3f (0.11,0.11,0.7);
  234.    glEnd ();
  235.    glDisable(GL_TEXTURE_2D);
  236. //gluDeleteQuadric(params);
  237. glMatrixMode(GL_MODELVIEW);
  238. glPopMatrix();
  239. /*
  240. */ //le deuxieme feu tricolore
  241. glPushMatrix();
  242. glTranslated(-1.66,-1.27,0);    // changement repere
  243.     glColor3ub(42,42,42);
  244. gluCylinder(params,0.05,0.05,1.1,20,1);
  245.     glTranslated(0,0,0.47);     // changement repere
  246. glBegin (GL_QUADS);
  247.   /* glTexCoord2i(0,1);*/ glVertex3f (-0.11,-0.11,0);
  248.    /*glTexCoord2i(1,1);*/ glVertex3f (-0.11,0.11,0);
  249.    /*glTexCoord2i(1,0);*/ glVertex3f (-0.11,0.11,0.7);
  250.    /*glTexCoord2i(0,0);*/ glVertex3f (-0.11,-0.11,0.7);
  251.    glEnd ();
  252.    glDisable(GL_TEXTURE_2D);
  253. //gluDeleteQuadric(params);
  254. glMatrixMode(GL_MODELVIEW);
  255. glPopMatrix();
  256. /*
  257. */ //le troisieme feu tricolore
  258. glPushMatrix();
  259. glTranslated(+1.27,-1.53,0);    // changement repere
  260.     glColor3ub(42,42,42);
  261. gluCylinder(params,0.05,0.05,1.1,20,1);
  262.     glTranslated(0,0,0.47);     // changement repere
  263. glBegin (GL_QUADS);
  264.   /* glTexCoord2i(0,1);*/ glVertex3f (0.11,-0.11,0);
  265.    /*glTexCoord2i(1,1);*/ glVertex3f (-0.11,-0.11,0);
  266.    /*glTexCoord2i(1,0);*/ glVertex3f (-0.11,-0.11,0.7);
  267.    /*glTexCoord2i(0,0);*/ glVertex3f (0.11,-0.11,0.7);
  268.    glEnd ();
  269.    glDisable(GL_TEXTURE_2D);
  270. //gluDeleteQuadric(params);
  271. glMatrixMode(GL_MODELVIEW);
  272. glPopMatrix();
  273. /*
  274. */ //le quatrieme feu tricolore
  275. glPushMatrix();
  276. glTranslated(+1.59,+1.3,0);    // changement repere
  277.     glColor3ub(42,42,42);
  278. gluCylinder(params,0.05,0.05,1.1,20,1);
  279.     glTranslated(0,0,0.47);     // changement repere
  280. glBindTexture(GL_TEXTURE_2D, texture[1]);
  281. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);       
  282. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  283. glMatrixMode(GL_TEXTURE);
  284. glEnable(GL_TEXTURE_2D);
  285. glColor3ub(255,255,255);
  286. glBegin (GL_QUADS);
  287.    glTexCoord2i(0,0); glVertex3f (0.11,-0.11,0);
  288.   glTexCoord2i(1,0); glVertex3f (0.11,0.11,0);
  289.   glTexCoord2i(1,1); glVertex3f (0.11,0.11,0.7);
  290.   glTexCoord2i(0,1); glVertex3f (0.11,-0.11,0.7);
  291.    glEnd ();
  292.    glDisable(GL_TEXTURE_2D);
  293. gluDeleteQuadric(params);
  294. glMatrixMode(GL_MODELVIEW);
  295. glPopMatrix();
  296. /*
  297. */
  298. drawVoiturealler(texture,yy);
  299. //glFlush();
  300. glutSwapBuffers();
  301. /*
  302. */
  303. /*GetLocalTime(&Time);
  304. differ_time = Time.wMilliseconds - current_time;
  305. if (differ_time < 4 & differ_time > 0)
  306.         {
  307.             Sleep(4 - differ_time);
  308.         }
  309. // - -- - - - - - - -  
  310.  */
  311. //}
  312. /*
  313. */
  314. //
  315. }
  316. void Idle(){
  317. yy = yy -0.1;
  318. glutPostRedisplay();
  319. }
  320. int main(int argc, char** argv)
  321. {
  322. glutInit(&argc, argv);
  323. glutInitDisplayMode(  GLUT_RGBA | GLUT_DOUBLE |GLUT_DEPTH );
  324. glutInitWindowSize(1000,590);
  325. glutInitWindowPosition(50,50);
  326. glutCreateWindow("fenetre OpenGl" );
  327. glMatrixMode( GL_PROJECTION );
  328.     glLoadIdentity();
  329. gluPerspective(40,(double)640/480,1,100);
  330.     glEnable(GL_DEPTH_TEST);
  331. glutDisplayFunc(Dessiner);
  332. glutIdleFunc(Idle);
  333. //Dessiner();
  334. glutKeyboardFunc(key);
  335. glutMainLoop();
  336. return 0;
  337. }


merci

mood
Publicité
Posté le 10-12-2011 à 20:38:40  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  probleme execution animation opengl

 

Sujets relatifs
Problème de définition d'une constante avec des simple quote[VBA Excel] Problème vlookup ne rappatriant que des zéros (RESOLU !)
Problème de décalage horaire avec un CalendarVBA Exel problème copie feuille
colorer surface bezier opengl C++Problème-écriture-image-GIF
Problème-écriture-image-GIFBluegriffon - probleme de code
probleme importation .CSV vers MySQLerreur d'exécution script
Plus de sujets relatifs à : probleme execution animation opengl


Copyright © 1997-2018 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR