IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GLUT Discussion :

besoin de votre aide SVP


Sujet :

GLUT

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 1
    Points : 1
    Points
    1
    Par défaut besoin de votre aide SVP
    Bonjour à tous
    Est ce quelqu'un pourrait me dire pourquoi les coordonées s'affichent sur l'axe z=0 de mon programme.C'est très important car c'est pour un projet à rendre dans 2 jours.
    Si quelqu'un pouvait m'aider,ça serait très très gentil et ça m'aiderait beaucoup car là je suis coincé.

    Merci d'avance pour vos réponses

    Paula

    Voici le code de mon programme :

    #include <GL/glut.h>
    #include <stdio.h>


    #define TIMER 10
    #define CUBE 2

    int tab2[50][50];


    double eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz;
    float xcoord, ycoord, zcoord;



    int xbar, ybar, zbar;

    int direct_x, direct_y, direct_z;

    int tableau[15][15][15];




    void initialise_tableau()
    {
    int i,j,k;
    for (i=0; i<15; i++)
    for (j=0; j<15; j++)
    for (k=0; k<15; k++)
    tableau[i][j][k] = 0 ;

    //for (i=0; i<15; i++)
    // for (j=10; j>8; j--)
    // for (k=0; k<13; k++)
    // tableau[i][j][k] = 0 ;

    }


    void initialise(){
    int i,j;
    for(i=0;i<50;i++){
    for(j=0;j<50;j++){
    if( (i%2)&& (j%2) == 0){
    tab2[i][j]=4;
    }
    else{
    tab2[i][j]==478;
    }
    }
    }
    }




    static void reshape(int w,int h)
    {
    glViewport( 0, 0, (GLint)w, (GLint)h );
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    gluPerspective(16, w/(float)h, 1, 100) ;
    glMatrixMode( GL_MODELVIEW );
    }



    static void timer(int value)
    {
    glutPostRedisplay() ;
    glutTimerFunc(TIMER, timer, value++) ;
    }




    static void keyboard(unsigned char k,int x,int y){
    switch(k){
    case 'q':
    case 'Q':
    case 27:
    glutLeaveMainLoop();
    break;


    case '1':
    eyex += 1;
    break;
    case '4':
    eyex += -1;
    break;
    case '2':
    eyey += 1;
    break;
    case '5':
    eyey += -1;
    break;
    case '3':
    eyez += 1;
    break;
    case '6':
    eyez += -1;
    break;

    case 'a':
    xcoord += 1;
    break;
    case 'z':
    xcoord += -1;
    break;
    case 'e':
    ycoord += 1;
    break;
    case 'r':
    ycoord += -1;
    break;
    case 't':
    zcoord += 1;
    break;
    case 'y':
    zcoord += -1;
    break;


    }
    }






    void tracer_point2(){
    int i,j;
    int k;
    glBegin(GL_POINTS);

    for(i=0;i<50;i++){
    for(j=0;j<50;j++){
    if( (i%2)&& (j%2) == 0){
    glColor3f(1.0,1.0,0);
    k=tab2[i][j];
    glVertex3f(i,k,j);
    }
    else{
    glColor3f(0.0,1.0,1.0);
    k=tab2[i][j];
    glVertex3f(i,k,j);
    }
    }
    }
    glEnd();
    }














    void carre(int i , int j, int k){
    glBegin(GL_LINE_STRIP);
    glVertex3f(i,0.0,k);
    glVertex3f(i+1 ,0.0,k);
    glVertex3f(i+1,0.0,k+1);
    glVertex3f(i,0.0,k+1);
    glEnd();
    }

    void sol () {
    int i;
    int k;

    glColor3f(0.5,0.5,0.5);
    glBegin(GL_POLYGON);
    glVertex3f(0.0,0.0,0.0);
    glVertex3f(15.0 ,0.0,0.0);
    glVertex3f(15.0,0.0,15.0);
    glVertex3f(0.0,0.0,15.0);
    glEnd();


    }

    void repere(){



    int x,y;


    //x=lfmt[I_NDIMX];
    //y=lfmt[I_NDIMY];


    glBegin(GL_LINES);
    glColor3f(1.0,0.0,0.0);
    glVertex3f(0,0,0);
    glVertex3f(215,0,0);
    glEnd();

    glBegin(GL_LINES);
    glColor3f(0.0,1.0,0.0);
    glVertex3f(0,0,0);
    glVertex3f(0,505,0);
    glEnd();

    glBegin(GL_LINES);
    glColor3f(0.0,0.0,1.0);
    glVertex3f(0,0,0);
    glVertex3f(0,0,215);
    glEnd();

    }





    void init () {
    eyex = 82;
    eyey = 4;
    eyez = 16;
    centerx = 7;
    centery =7;
    centerz = 0;


    upx = upz = 0;
    upy = 1;
    initialise_tableau();
    //glEnable(GL_DEPTH_TEST);



    }











    static void display() {
    int i,j,k;

    glLoadIdentity();
    gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy,
    upz);
    glClear(GL_COLOR_BUFFER_BIT);


    tracer_point2();

    repere();


    glFlush();
    glutSwapBuffers();

    }


    int main(int argc,char*argv[]) {
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE);
    glutCreateWindow("PROJET");
    glutDisplayFunc(display);
    glutPostRedisplay();
    glutKeyboardFunc(keyboard);
    glutTimerFunc(TIMER,timer,0);
    glutReshapeFunc(reshape);
    init();
    glutMainLoop();
    return 0;
    }

  2. #2
    Membre habitué
    Profil pro
    Étudiant
    Inscrit en
    Février 2004
    Messages
    125
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2004
    Messages : 125
    Points : 139
    Points
    139
    Par défaut
    Si tu détaillais un peu plus ton problème car tu as l'air de dessiner plein de trucs, là, qu'est ce qui foire exactement ?
    Et surtout la prochaine fois, utlise la balise CODE !!!

    MacBook - MacOS X.5.4
    C, Objective-C
    OpenGL, GLUT, Cocoa

  3. #3
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Points : 15 920
    Points
    15 920
    Par défaut
    Pense aussi a editer ton titre pour le rendre plus explicite...

    Les regles du forum

  4. #4
    Modérateur
    Avatar de ToTo13
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Janvier 2006
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Chercheur en informatique
    Secteur : Santé

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 793
    Points : 9 860
    Points
    9 860
    Par défaut
    En bref :
    - détaille ton problème
    - lèves tout tes commentaires, ça allègera ton code
    - réécrit tout en utilisant la balise /code.
    Consignes aux jeunes padawans : une image vaut 1000 mots !
    - Dans ton message respecter tu dois : les règles de rédaction et du forum, prévisualiser, relire et corriger TOUTES les FAUTES (frappes, sms, d'aurteaugrafe, mettre les ACCENTS et les BALISES) => ECRIRE clairement et en Français tu DOIS.
    - Le côté obscur je sens dans le MP => Tous tes MPs je détruirai et la réponse tu n'auras si en privé tu veux que je t'enseigne.(Lis donc ceci)
    - ton poste tu dois marquer quand la bonne réponse tu as obtenu.

Discussions similaires

  1. XML ,XCODE ,application iphone : j'ai Besoin de votre aide SVP:)
    Par Clean-boy dans le forum XML/XSL et SOAP
    Réponses: 0
    Dernier message: 23/05/2011, 04h15
  2. [Alimentation] besoin de votre aide svp
    Par crisvalere dans le forum Composants
    Réponses: 1
    Dernier message: 28/04/2011, 21h06
  3. [JTABLE] Besoin de votre aide SVP
    Par vpourchet dans le forum Débuter
    Réponses: 17
    Dernier message: 11/04/2008, 11h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo