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

SDL Discussion :

Problème affichage avec TTF_RenderText_Shaded


Sujet :

SDL

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut Problème affichage avec TTF_RenderText_Shaded
    Bonjour,

    Je débute avec SDL et openGL. je suis entrain de crée un menu graphique et pour cela je souhaite mapper du texte sur des quads.
    Le problème que je rencontre c'est au niveau de la couleur de mon text affiché. Moi je demande du text noir sur un fond vert mais le texte sera affiché en blanc sur un fond noir !!

    PS : j'arrive a visualiser un text sur un un fond transparent avec la fonction TTF_RenderText_Blended(police,"test",couleurVerte); mais je cherche a afficher sur un fond coloré.

    Merci pour votre aide j'en ai vraiment besoin .

    Le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
     
    	if(TTF_Init() == -1) //initialisation de SDL_TTF
        {
            fprintf(stderr, "Erreur d'initialisation de TTF_Init : %s\n", TF_GetError());
            exit(EXIT_FAILURE);
        }
     
     
    	// chargement de la police
    	police = TTF_OpenFont("arial.ttf", 48);
    	 if (police== NULL) {
            printf("TTF_OpenFont: %s\n", TTF_GetError());
            exit(3);
        }
     
     
    fond = TTF_RenderText_Shaded(police,"test", couleurNoire, couleurVerte);
     if ( fond  == NULL)
        {
            printf("Couldn't create String %s \n", SDL_GetError());
            exit(7);
        }
     
    glGenTextures(1, &tex);
     
     if (tex == 0) {
            puts("err while gen tex");
            exit(4);
        }
    glBindTexture(GL_TEXTURE_2D, tex);	
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     
     
    	// choix du format en fonction du nombres d'octets par pixel
       switch (fond->format->BytesPerPixel) {
            case 1:
                internalFormat = 1;
                format = GL_LUMINANCE;
                break;
     
            case 2:
                internalFormat = 2;
                format = GL_LUMINANCE_ALPHA;
                break;
     
            case 3:
                internalFormat = 3;
                format = GL_RGB;
                break;
     
            case 4:
                internalFormat = 4;
                format = GL_RGBA;
                break;
     
            default:
                printf ("unknown pixel format (%d byte(s) per pixel). Exiting.\n",
                        fond->format->BytesPerPixel);
                exit (5);
        }
     
     
    	buildResult = gluBuild2DMipmaps(GL_TEXTURE_2D, internalFormat,
                                        fond->w, fond->h,
                                        format, GL_UNSIGNED_BYTE,
                                        fond->pixels);
     
     
    	printf("resultat: %d (%s)\n"
               "octets par pixel:%d\n",buildResult ,
               gluErrorString(buildResult),
               fond->format->BytesPerPixel);
     
     
         SDL_FreeSurface(fond);

  2. #2
    Expert éminent sénior
    Avatar de Kannagi
    Homme Profil pro
    cyber-paléontologue
    Inscrit en
    Mai 2010
    Messages
    3 214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cyber-paléontologue

    Informations forums :
    Inscription : Mai 2010
    Messages : 3 214
    Points : 10 140
    Points
    10 140
    Par défaut
    Je vois pas le problème, si tu veux un texte noir sur du fond vert.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    TTF_RenderText_Blended(police,"test",couleurVerte);
    Tu sais que ce code signifie que ton texte sera vert ? O_o

    voila pour un texte noir :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    SDL_Color couleurnoir = {0, 0, 0};
    TTF_RenderText_Blended(police,"test",couleurnoir);
    apres si tu veux un quad vert en fond avec opengl
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
        glBegin(GL_QUADS);
     
        glColor3ub(0,255,0); //face vert
        glVertex3d(1,1,1);
        glVertex3d(1,1,-1);
        glVertex3d(-1,1,-1);
        glVertex3d(-1,1,1);
        glEnd();
    Apres pour les coordonnées du quad change les par rapport a ta camera

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    si j'utilise
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    TTF_RenderText_Blended(police,"test",couleurnoir);
    j'aurai un texture avec un fond transparent. Mais mapper cette texture sur un quad le rend transparent aussi !!

    donc ca ne résout pas mon problème

  4. #4
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    si j'essaye de faire autrement.
    je mappe une image ( juste un fond vert) comme une texture ( sans le texte pour l'instant)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     fond = IMG_Load ("cadrevert.bmp" );
     
    	if ( !fond )
       {
          printf ( "IMG_Load: %s\n", IMG_GetError () );
          exit (6);
       }
    ensuite je crée ma texture
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    glGenTextures(1, &tex);
     
     if (tex == 0) {
            puts("err while gen tex");
            exit(4);
        }
    glBindTexture(GL_TEXTURE_2D, tex);	
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     
     
    	// choix du format en fonction du nombres d'octets par pixel
       switch (fond->format->BytesPerPixel) {
            case 1:
                internalFormat = 1;
                format = GL_LUMINANCE;
                break;
     
            case 2:
                internalFormat = 2;
                format = GL_LUMINANCE_ALPHA;
                break;
     
            case 3:
                internalFormat = 3;
                format = GL_RGB;
                break;
     
            case 4:
                internalFormat = 4;
                format = GL_RGBA;
                break;
     
            default:
                printf ("unknown pixel format (%d byte(s) per pixel). Exiting.\n",
                        fond->format->BytesPerPixel);
                exit (5);
        }
     
     
    	buildResult = gluBuild2DMipmaps(GL_TEXTURE_2D, internalFormat,
                                        fond->w, fond->h,
                                        format, GL_UNSIGNED_BYTE,
                                        fond->pixels);
     
     
    	printf("resultat: %d (%s)\n"
               "octets par pixel:%d\n",buildResult ,
               gluErrorString(buildResult),
               fond->format->BytesPerPixel);
     
     
         SDL_FreeSurface(fond);
    et enfin j'affiche mon quad
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    glBegin(GL_QUADS);
     
    				glTexCoord2f (0.0f, 0.0f);
    				glVertex3f(-0.1,0.1,-2);				
    				 glTexCoord2f (1.0f, 0.0f);
    				 glVertex3f(0.3,0.1,-2);				
    				glTexCoord2f (1.0f, 1.0f);
    				glVertex3f(0.3,-0.1,-2);				
    				glTexCoord2f (0.0f, 1.0f);				
    				glVertex3f(-0.1,-0.1,-2); 
    			glEnd();
    Au final je n'ai pas un quad vert mais banc !!!
    je ne vois pas d'ou peut venir cette erreur de couleur

  5. #5
    Expert éminent sénior
    Avatar de Kannagi
    Homme Profil pro
    cyber-paléontologue
    Inscrit en
    Mai 2010
    Messages
    3 214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cyber-paléontologue

    Informations forums :
    Inscription : Mai 2010
    Messages : 3 214
    Points : 10 140
    Points
    10 140
    Par défaut
    Ah je comprend le plem, ben tu fais 2 quad identique(coordonnée et taille) un avec la texture (texte) et un autre avec la couleur vert.

  6. #6
    Expert éminent sénior
    Avatar de Kannagi
    Homme Profil pro
    cyber-paléontologue
    Inscrit en
    Mai 2010
    Messages
    3 214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cyber-paléontologue

    Informations forums :
    Inscription : Mai 2010
    Messages : 3 214
    Points : 10 140
    Points
    10 140
    Par défaut
    Alors pour la texture il faut mettre glTexImage2D avant le glBegin(GL_QUADS);

    Pour ton quad tu as oublier de mettre glColor3ub(0,255,0); //face vert
    (que j'ai mis en code un peu plus en haut ).

  7. #7
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    j'ai fait exactement comme tu m'avais suggéré
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
     
    glBegin(GL_QUADS);		
    		glBindTexture (GL_TEXTURE_2D, tex);
    		glTexCoord2f (0.0f, 0.0f);
    		glVertex3f(-0.1,0.1,-2);				
    		glTexCoord2f (1.0f, 0.0f);
    		glVertex3f(0.3,0.1,-2);				
    		glTexCoord2f (1.0f, 1.0f);
    		glVertex3f(0.3,-0.1,-2);				
    		glTexCoord2f (0.0f, 1.0f);				
    		glVertex3f(-0.1,-0.1,-2); 
    glEnd();
     
    glBegin(GL_QUADS);
    		glColor3ub(0,255,0);			
    		glVertex3f(-0.1,0.1,-2);								
    		glVertex3f(0.3,0.1,-2);								
    		glVertex3f(0.3,-0.1,-2);									
    		glVertex3f(-0.1,-0.1,-2); 
    glEnd();
    mais c'est toujours le même prob du text sur fond transparent

  8. #8
    Expert éminent sénior
    Avatar de Kannagi
    Homme Profil pro
    cyber-paléontologue
    Inscrit en
    Mai 2010
    Messages
    3 214
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cyber-paléontologue

    Informations forums :
    Inscription : Mai 2010
    Messages : 3 214
    Points : 10 140
    Points
    10 140
    Par défaut
    chez moi ce code marche :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     
    glDisable(GL_TEXTURE_2D);
     
    glBegin(GL_QUADS);
    		glColor3ub(0,255,0);
    		glVertex3f(-1,-1,-3);
    		glVertex3f(-1,1,-3);
    		glVertex3f(1,1,-3);
    		glVertex3f(1,-1,-3);
    glEnd();
     
    glEnable(GL_TEXTURE_2D);
     
    glBindTexture (GL_TEXTURE_2D, tex) ;
     
     
       glBegin(GL_QUADS);
    		glTexCoord2f (0.0f, 0.0f);
    		glVertex3f(-0.1,0.1,-2);
    		glTexCoord2f (1.0f, 0.0f);
    		glVertex3f(0.3,0.1,-2);
    		glTexCoord2f (1.0f, 1.0f);
    		glVertex3f(0.3,-0.1,-2);
    		glTexCoord2f (0.0f, 1.0f);
    		glVertex3f(-0.1,-0.1,-2);
    glEnd();

  9. #9
    Expert éminent sénior

    Avatar de fearyourself
    Homme Profil pro
    Ingénieur Informaticien Senior
    Inscrit en
    Décembre 2005
    Messages
    5 121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur Informaticien Senior
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2005
    Messages : 5 121
    Points : 11 877
    Points
    11 877
    Par défaut
    Puis-je demander pourquoi tu n'utilises pas : TTF_RenderText_Shaded ?

    Jc

  10. #10
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    c'est ce qui ne marche pas dans mon code :
    TTF_RenderText_Sheded(police,"testaaaaaaaaaaaaaaaa", couleurNoire, couleurVerte);
    me donne toujours un texte blan sur un fond noir !!!
    je pense que ça dois venir de ma configuration OpenGL mais je ne sais pas d'ou exactement

  11. #11
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    26 859
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 26 859
    Points : 218 580
    Points
    218 580
    Billets dans le blog
    120
    Par défaut
    Peut on voir le code complet, ou du moins, la fonction complète (que l'on puisse tester chez nous). Merci.
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  12. #12
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    ma fonction d'initialisation
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
     
    SDL_Color couleurNoire = {0, 0, 0};
    SDL_Color couleurVerte = {0,0xff,0};
    void Init()
    {    
     
    	glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE);	
     
    	//Définit la position de la fenêtre sur l'écran
    	glutInitWindowPosition(0,0);
     
    	//Définit la taille de la fenêtre à l'écran
    	glutInitWindowSize(600, 800);
     
    	//Création de la fenètre de nom simple
        glutCreateWindow("nom de fenetre");
     
    	// Mise en place de la vue OpenGL
        glViewport(0, 0, w, h);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
     
    	// Mise en place de la perspective	
        gluPerspective(45.0f,(GLfloat)w/(GLfloat)h,0.1f,1000.0f);
     
    	glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
     
     
        lightDiffuse[0]=  1.0f;
    	lightDiffuse[1]=  1.0f;
    	lightDiffuse[2]=  1.0f;
    	lightDiffuse[3]=  1.0f;
     
    	light2Pos[0]=  50.0f;
    	light2Pos[1]=  50.0f;
    	light2Pos[2]=  -50.0f;
    	light2Pos[3]=  0.0f;
     
    	light1Pos[0]=  -50.0f;
    	light1Pos[1]=  50.0f;
    	light1Pos[2]=  50.0f;
    	light1Pos[3]=  0.0f;
     
    	glLightfv(GL_LIGHT1, GL_DIFFUSE, lightDiffuse); 
    	glLightfv(GL_LIGHT2, GL_DIFFUSE, lightDiffuse); 
     
    	glLightfv(GL_LIGHT1, GL_SPECULAR, lightDiffuse); 
    	glLightfv(GL_LIGHT2, GL_SPECULAR, lightDiffuse); 
     
    	glLightfv(GL_LIGHT1, GL_POSITION, light1Pos); 
    	glLightfv(GL_LIGHT2, GL_POSITION, light2Pos); 
    	glEnable(GL_LIGHT1);
    	glEnable(GL_LIGHT2);
    	glEnable(GL_LIGHTING);
     
     
    	glClearColor(0.3F,0.7F,0.9F,1.0F);
    	glShadeModel (GL_SMOOTH);
     
    	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    	glEnable(GL_BLEND);
     
    	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    	glEnable(GL_DEPTH_TEST);
    	glEnable(GL_COLOR_MATERIAL);
     
     
     
    	if(TTF_Init() == -1) //initialisation de SDL_TTF
        {
            fprintf(stderr, "Erreur d'initialisation de TTF_Init : %s\n", TTF_GetError());
            exit(EXIT_FAILURE);
        }
     
     	// chargement de la police
    	police = TTF_OpenFont("arial.ttf", 48);
    	 if (police== NULL) {
            printf("TTF_OpenFont: %s\n", TTF_GetError());
            exit(3);
        }
    	ecran = TTF_RenderText_Shaded(police,"test",  couleurNoire, couleurVerte);
     
    glGenTextures(1, &tex);
     if (tex == 0) {
            puts("err while gen tex");
            exit(4);
        }
        glBindTexture(GL_TEXTURE_2D, tex);	
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     
     
    	// choix du format en fonction du nombres d'octets par pixel
       switch (ecran->format->BytesPerPixel) {
            case 1:
                internalFormat = 1;
                format = GL_LUMINANCE;
                break;
     
            case 2:
                internalFormat = 2;
                format = GL_LUMINANCE_ALPHA;
                break;
     
            case 3:
                internalFormat = 3;
                format = GL_RGB;
                break;
     
            case 4:
                internalFormat = 4;
                format = GL_RGBA;
                break;
     
            default:
                printf ("unknown pixel format (%d byte(s) per pixel). Exiting.\n",
                        ecran->format->BytesPerPixel);
                exit (5);
        }
     
     
    	buildResult = gluBuild2DMipmaps(GL_TEXTURE_2D, internalFormat,
                                        ecran->w, ecran->h,
                                        format, GL_UNSIGNED_BYTE,
                                        ecran->pixels);
     
     
    	printf("resultat: %d (%s)\n"
               "octets par pixel:%d\n",buildResult ,
               gluErrorString(buildResult),
               ecran->format->BytesPerPixel);
     
     
         SDL_FreeSurface(ecran);
    	 glutFullScreen();
     
     
     
    }
    ma fonction d'affichage
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    void myDisplayFunc()
    {
      glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      glLoadIdentity(); 
      gluLookAt(xPos ,yPos, zPos, xPos+cos(camAngle), yPos-0.2f,  zPos+sin(camAngle), 0, 1, 0);   
      glLoadIdentity ();    
      glEnable (GL_TEXTURE_2D);
      glBindTexture (GL_TEXTURE_2D, tex);
      glBegin(GL_QUADS);	
    	glTexCoord2f (0.0f, 0.0f);
    	glVertex3f(-0.1,0.1,-2);				
    	glTexCoord2f (1.0f, 0.0f);
    	glVertex3f(0.3,0.1,-2);				
    	glTexCoord2f (1.0f, 1.0f);
    	glVertex3f(0.3,-0.1,-2);				
    	glTexCoord2f (0.0f, 1.0f);				
    	glVertex3f(-0.1,-0.1,-2); 
    glEnd();
     
    glDisable (GL_TEXTURE_2D);  
      glFlush();
      glutSwapBuffers();
     
    }//myDisplayFunc()

  13. #13
    Expert éminent sénior

    Avatar de fearyourself
    Homme Profil pro
    Ingénieur Informaticien Senior
    Inscrit en
    Décembre 2005
    Messages
    5 121
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Ingénieur Informaticien Senior
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2005
    Messages : 5 121
    Points : 11 877
    Points
    11 877
    Par défaut
    1) Ton code est mal indenté
    2) Tu mélanges du glut,sdl,ttf,opengl... Tu ne voudrais pas ouvrir la fenêtre en SDL pur avec opengl, déjà cela simplifierait le code un peu
    3) Tu utilises des variables globales, vire le maximum de variables globale, en principe tu n'en a jamais besoin
    4) Fait un SDL_SaveBMP pour sauvegarder ce que te retourne TTF, tu pourras vérifier si c'est TTF ou OpenGL qui plante.

    Jc

  14. #14
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    1- oui tu as surement raison. ça vient du faite que je suis entrain de créer un menu graphique pour une application en 3D en openGL et je n'ai pas trouvé d'autre moyen de le réaliser à part la bibliothèque SDL
    2- je n'ai pas de variables globales. ce sont les paramètres de mon application qui gèrent ma scène 3D j'ai juste simplifié au max le code que j'ai posté ici
    3- c'est confirmé, c'est openGL qui plante . La question maintenant c'est comment réglé le problème !!

  15. #15
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    26 859
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 26 859
    Points : 218 580
    Points
    218 580
    Billets dans le blog
    120
    Par défaut
    OpenGL qui plante. C'est un peu gros.
    Je veux bien qu'il y ai quelques petits problème avec l'utilisation conjointe de SDL et OpenGL, mais dire qu'il plante, je ne pense pas.

    Dans la théorie (j'ai pas trop lu le code, trop pas assez beau), il faut suivre cet enchainement:
    dessin OpenGL (scène 2D ou 3D)
    dessin au dessus avec SDL (du texte par exemple)
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  16. #16
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    Peux tu etre plus précis stp !!

  17. #17
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    26 859
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 26 859
    Points : 218 580
    Points
    218 580
    Billets dans le blog
    120
    Par défaut
    Juste que, le dessin avec OpenGL doit être fait avant d'écrire le texte avec SDL.
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

  18. #18
    Futur Membre du Club
    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    14
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 14
    Points : 5
    Points
    5
    Par défaut
    ben justement c'est ca le problème . le menu permet de choisir ce qu'on vas dessiner dans la scène

  19. #19
    Responsable 2D/3D/Jeux


    Avatar de LittleWhite
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2008
    Messages
    26 859
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Mai 2008
    Messages : 26 859
    Points : 218 580
    Points
    218 580
    Billets dans le blog
    120
    Par défaut
    Citation Envoyé par nice.girl1983 Voir le message
    ben justement c'est ca le problème . le menu permet de choisir ce qu'on vas dessiner dans la scène
    Et ?
    Cela ne veut pas dire que vous ne pouvez pas dessiner la scène avant le menu. L'utilisateur ne verra aucune différence. Et si rien n'est sélectionné dans le menu, vous faites une scène noire
    Vous souhaitez participer à la rubrique 2D/3D/Jeux ? Contactez-moi

    Ma page sur DVP
    Mon Portfolio

    Qui connaît l'erreur, connaît la solution.

Discussions similaires

  1. Alignement de div, problème affichage avec IE
    Par tofito dans le forum Mise en page CSS
    Réponses: 3
    Dernier message: 06/05/2008, 16h26
  2. Problème affichage avec MessageBox
    Par farfadet dans le forum C++
    Réponses: 5
    Dernier message: 02/07/2007, 13h10
  3. Problème affichage avec ATI Mobility FireGL v3200
    Par MoDDiB dans le forum NxEngine
    Réponses: 2
    Dernier message: 25/06/2007, 09h33
  4. Problème affichage avec MSN
    Par CLion dans le forum Messagerie instantanée
    Réponses: 4
    Dernier message: 11/12/2006, 16h45
  5. [PHP-JS] Problème affichage avec structure if
    Par kitty2006 dans le forum Langage
    Réponses: 31
    Dernier message: 07/09/2006, 18h01

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