QT sous Visual C++ 2008 : SOUS XP

controlleur Messages postés 65 Date d'inscription mercredi 27 janvier 2010 Statut Membre Dernière intervention 16 avril 2013 - 24 juil. 2011 à 15:17
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 - 25 juil. 2011 à 09:03
Bonjour
j'ai rencontré une erreur l'or de l’exécution de mon programme :
l'erreur c'est qu'il me dise que les QComboBox et QSlider que j'ai déclaré ne sont pas connus :

voici mon programme :


#include <stdio.h>
#include <stdlib.h>
#include "camera.h"
#include "textures.h"
#include <glaux.h> //Used for loading the textures
#include <glut.h>
#include <windows.h>
#include <QtGui/qcombobox>
#include <QtGui/qslider>
#include <QtGui/qvboxlayout>
#include <QtGui/QWidget>
CCamera Camera;

GLfloat YRotated = 0.0;

COGLTexture Tex1, Tex2;

void InitTextures(void)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);

Tex1.LoadFromFile("tex1.bmp");
Tex2.LoadFromFile("tex2.bmp");

glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

}

void DrawCube(void)
{
//Draws a cube with two shaded, two one-colored and two textured faces
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
//front:
glVertex3f(-0.5,-0.5,0.5);
glVertex3f(-0.5,0.5,0.5);
glVertex3f(0.5,0.5,0.5);
glVertex3f(0.5,-0.5,0.5);

//back:
glColor3f(0.0,0.0,1.0);
glVertex3f(-0.5,-0.5,-0.5);
glVertex3f(0.5,-0.5,-0.5);
glVertex3f(0.5,0.5,-0.5);
glVertex3f(-0.5,0.5,-0.5);

//top:
glColor3f(0.0,0.6,1.0);
glVertex3f(-0.5,0.5,-0.5);
glVertex3f(0.5,0.5,-0.5 );
glColor3f(1.0,0.6,1.0);
glVertex3f(0.5,0.5,0.5);
glVertex3f(-0.5,0.5,0.5);

//bottom:
glColor3f(0.0,0.6,0.0);
glVertex3f(-0.5,-0.5,-0.5);
glColor3f(0.6,0.6,0.6);
glVertex3f(-0.5,-0.5,0.5);
glColor3f(1.0,1.0,0.3);
glVertex3f(0.5,-0.5,0.5);
glColor3f(0.0,1.0,0.0);
glVertex3f(0.5,-0.5,-0.5);
glEnd();
glEnable(GL_TEXTURE_2D);

Tex1.SetActive();
glBegin(GL_QUADS);
//left:
glTexCoord2f(1.0,0.0);
glVertex3f(-0.5,-0.5,-0.5);
glTexCoord2f(1.0,1.0);
glVertex3f(-0.5,0.5,-0.5);
glTexCoord2f(0.0,1.0);
glVertex3f(-0.5,0.5,0.5);
glTexCoord2f(0.0,0.0);
glVertex3f(-0.5,-0.5,0.5);
glEnd();
//right:
Tex2.SetActive();
glBegin(GL_QUADS);
glTexCoord2f(0.0,0.0);
glVertex3f(0.5,-0.5,-0.5);
glTexCoord2f(1.0,0.0);
glVertex3f(0.5,-0.5,0.5);
glTexCoord2f(1.0,1.0);
glVertex3f(0.5,0.5,0.5);
glTexCoord2f(0.0,1.0);
glVertex3f(0.5,0.5,-0.5);
glEnd();

glDisable(GL_TEXTURE_2D);

glBegin(GL_QUADS);
glColor4f(.4f,.45f,.5f,1); // bottom color
glVertex2f(0,0);
glVertex2f(1,0);
glColor4f(.8f,.9f,.8f,1); // top color
glVertex2f(1,1);
glVertex2f(0,1);
glEnd();

glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);

// have to clear the depth bit... otherwise nothing gets painted afterwards
// glClear(GL_DEPTH_BUFFER_BIT);

}

void reshape(int x, int y)
{
if (y 0 || x 0) return;

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(40.0,(GLdouble)x/(GLdouble)y,0.5,20.0);

glMatrixMode(GL_MODELVIEW);
glViewport(0,0,x,y);
}

void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
Camera.Render();
glRotatef(YRotated,0.0,1.0,0.0);
DrawCube();

glFlush();
glutSwapBuffers();

}



int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(1000,700);

comboTrackingMode = new QComboBox;
comboTrackingMode->addItem("Independent");
comboTrackingMode->addItem("Follow");
comboTrackingMode->addItem("Backseat driver");
comboTrackingMode->addItem("Fixed observer follow");

GDslider = new QSlider(Qt::Horizontal);
GDslider->setRange(0,255);

QVBoxLayout *mainLayout = new QVBoxLayout;

mainLayout->addWidget(comboTrackingMode);
mainLayout->addWidget(GDslider);
setLayout(mainLayout);

glutCreateWindow("Textures and BfC");
//glFrontFace(GL_CW); //Clockwise is front in "DrawCube()"

//glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
Camera.Move( F3dVector(0.0, 0.0, 3.0 ));
//Camera.MoveForwards( 1.0 );
InitTextures();

glutDisplayFunc(Display);
glutReshapeFunc(reshape);
glutKeyboardFunc(KeyDown);
glutIdleFunc(Idle);
glutMainLoop();
return 0;
}




Merci d'avance pour vos réponses

1 réponse

BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 103
25 juil. 2011 à 09:03
Hello,
Je message dit vrai...ou bien tu ne nous montre pas tout:
- où est la déclaration de comboTrackingMode ?
- et celle de GDslider ?


@+
Buno
----------------------------------------
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
0
Rejoignez-nous