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

  FORUM HardWare.fr
  Programmation
  Delphi/Pascal

  afficher une sphere avec Glut sous delphi3

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

afficher une sphere avec Glut sous delphi3

n°517771
Atman
Posté le 18-09-2003 à 23:38:00  profilanswer
 

Je n'arrive pas a me servir de glut (pour opengl c'est ok) si une ame charitable pouvait me donner un bout de code pour afficher une sphere.

mood
Publicité
Posté le 18-09-2003 à 23:38:00  profilanswer
 

n°517812
red factio​n
Posté le 19-09-2003 à 03:01:52  profilanswer
 

Code :
  1. #include <gl/glut.h>
  2. void Reshape(int width, int height);
  3. void Draw();
  4. int Win1;
  5. int main( int argc, char *argv[ ], char *envp[ ] )
  6. {
  7. glutInit(&argc,argv);
  8. glutInitWindowSize(640,480);
  9. glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
  10. Win1 = glutCreateWindow("test" );
  11. glutReshapeFunc(Reshape);
  12. glutDisplayFunc(Draw);
  13. glutMainLoop();
  14. return 0;
  15. }
  16. void Reshape(int width, int height)
  17. {
  18. glViewport(0,0,width,height);
  19. glMatrixMode(GL_PROJECTION);
  20. glLoadIdentity();
  21. gluPerspective(45,float(width)/float(height),1,100);
  22. glMatrixMode(GL_MODELVIEW);
  23. }
  24. void Draw()
  25. {
  26. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  27. glMatrixMode(GL_MODELVIEW);
  28. glLoadIdentity();
  29. gluLookAt(0,0,10,0,0,0,0,1,0);
  30.         glutSolidSphere(0.4,50,50) ;
  31. glutSwapBuffers();
  32. glutPostRedisplay();
  33. }


 
 
pas teste mais ca devrait fonctionner
 
 
 
void glutSolidSphere  ( GLdouble radius , GLint slices , GLint stacks );  
 
radius The radius of the sphere.  
slices  
The number of subdivisions around the Z axis (similar to lines of longitude).  
stacks  
The number of subdivisions along the Z axis (similar to lines of latitude).  
 
ma bonte me perdra  :o
 
 
EDIT : javais pas fait attention , cest du c mais a mon avis ca ne posera pas trop des problemes pour la conversion


Message édité par red faction le 19-09-2003 à 03:09:16
n°518468
Atman
Posté le 19-09-2003 à 19:21:02  profilanswer
 

red faction a écrit :

Code :
  1. #include <gl/glut.h>
  2. void Reshape(int width, int height);
  3. void Draw();
  4. int Win1;
  5. int main( int argc, char *argv[ ], char *envp[ ] )
  6. {
  7. glutInit(&argc,argv);
  8. glutInitWindowSize(640,480);
  9. glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
  10. Win1 = glutCreateWindow("test" );
  11. glutReshapeFunc(Reshape);
  12. glutDisplayFunc(Draw);
  13. glutMainLoop();
  14. return 0;
  15. }
  16. void Reshape(int width, int height)
  17. {
  18. glViewport(0,0,width,height);
  19. glMatrixMode(GL_PROJECTION);
  20. glLoadIdentity();
  21. gluPerspective(45,float(width)/float(height),1,100);
  22. glMatrixMode(GL_MODELVIEW);
  23. }
  24. void Draw()
  25. {
  26. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  27. glMatrixMode(GL_MODELVIEW);
  28. glLoadIdentity();
  29. gluLookAt(0,0,10,0,0,0,0,1,0);
  30.         glutSolidSphere(0.4,50,50) ;
  31. glutSwapBuffers();
  32. glutPostRedisplay();
  33. }


 
 
pas teste mais ca devrait fonctionner
 
 
 
void glutSolidSphere  ( GLdouble radius , GLint slices , GLint stacks );  
 
radius The radius of the sphere.  
slices  
The number of subdivisions around the Z axis (similar to lines of longitude).  
stacks  
The number of subdivisions along the Z axis (similar to lines of latitude).  
 
ma bonte me perdra  :o
 
 
EDIT : javais pas fait attention , cest du c mais a mon avis ca ne posera pas trop des problemes pour la conversion


 
Merci beaucoup mais comme tu l'as noté, le delphi c'est pas du C :sweat:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Delphi/Pascal

  afficher une sphere avec Glut sous delphi3

 

Sujets relatifs
Telecharger au lieu d'afficher[PHP] Afficher le résultat d'une grosse requête ?
[Windows & vfw] Afficher des avi transparents[DELPHI] Avec le chart, comment afficher plusieur courbes ?
Afficher une JWindow en premier plan sans qu'elle ai le focusafficher un texte dans une case selon le choix d'une liste
[VC++] Pb afficher dans EDIT sans bouton[Power Point] Afficher un chrono ?
[PHP]Afficher une imagen crée en php + afficher du txt[php] Recuperer l'extension d'un fichier pour l'afficher
Plus de sujets relatifs à : afficher une sphere avec Glut sous delphi3


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