Les sous fenetres en glut n'en font qu'a leurs tetes

Résolu
whikie Messages postés 99 Date d'inscription vendredi 24 juin 2005 Statut Membre Dernière intervention 17 septembre 2005 - 12 juil. 2005 à 21:10
whikie Messages postés 99 Date d'inscription vendredi 24 juin 2005 Statut Membre Dernière intervention 17 septembre 2005 - 13 juil. 2005 à 15:31
Bonjour,

je voudrais comprendre le placement des glutSubWindow.

Voici les infos que j'ai :
glutCreateSubWindow
La fonction glutCreateSubWindow crée une sous-fenêtre à l'intérieur d'une fenêtre parent.


<OL>
<LI>Usage
int glutCreateSubWindow ( int win, int x, int y, int width, int height );


win,

Identificateur de la fenêtre parent.
,
----

x ,

Coordonnées en pixels de la position en x relativement à la fenêtre parent.
,
----

y,

Coordonnées en pixels de la position en y relativement à la fenêtre parent.
,
----

width,

Largeur en pixels.
,
----

height,

Hauteur en pixels.

</LI></OL>
Il est à remarquer que l'origine se trouve dans le coin supérieur gauche de la fenêtre.

Donc si je cree une sous fenetre a la position 50,50 je devrais trouver ma sous fenetre a 50 pixels du bord de ma fenetre principale non ?

Ben ca se passe pas comme prevu, le code fonctionne pourtant

C'est un melange de tuto trouvé ici (merci Keniiyk) et d'essai :

#include<gl/glut.h>


static float RX=0.0;
static float RY=0.0;
static float RZ=0.0;


int principale,deux,trois,quatre;


void Reshape(int width, int height)
{
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,(float)width/(float)height,0.01,20);
glMatrixMode(GL_MODELVIEW);
}


void InitGL(void)
{
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
}


void Draw()
{
int changer,souviens;
souviens=glutGetWindow();
if (souviens==1) {changer=2;} else {changer=1;}


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


glLoadIdentity();
gluLookAt(1,changer,1,0,-1,0,0,1,0);


glRotatef(RX,1.0f,0,0);
glRotatef(RY,0,1.0f,0);
glRotatef(RZ,0,0,1.0f);


glColor3f(1.0f,0,0);
glBegin(GL_QUADS);
glVertex3f(1.0f,1.0f,1.0f);
glVertex3f(1.0f,-1.0f,1.0f);
glVertex3f(-1.0f,-1.0f,1.0f);
glVertex3f(-1.0f,1.0f,1.0f);
glEnd();


glColor3f(0,1.0f,0);
glBegin(GL_QUADS);


glVertex3f(1.0f,1.0f,-1.0f);
glVertex3f(1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f,1.0f,-1.0f);
glEnd();


glColor3f(0,0,1.0f);
glBegin(GL_QUADS);


glVertex3f(1.0f,1.0f,1.0f);
glVertex3f(1.0f,-1.0f,1.0f);
glVertex3f(1.0f,-1.0f,-1.0f);
glVertex3f(1.0f,1.0f,-1.0f);
glEnd();


glColor3f(0,1.0f,1.0f);
glBegin(GL_QUADS);


glVertex3f(-1.0f,1.0f,1.0f);
glVertex3f(-1.0f,-1.0f,1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f,1.0f,-1.0f);
glEnd();


glColor3f(1.0f,1.0f,0);
glBegin(GL_QUADS);


glVertex3f(-1.0f,1.0f,-1.0f);
glVertex3f(-1.0f,1.0f,1.0f);
glVertex3f(1.0f,1.0f,1.0f);
glVertex3f(1.0f,1.0f,-1.0f);
glEnd();


glColor3f(1.0f,0,1.0f);
glBegin(GL_QUADS);


glVertex3f(-1.0f,-1.0f,-1.0f);
glVertex3f(-1.0f,-1.0f,1.0f);
glVertex3f(1.0f,-1.0f,1.0f);
glVertex3f(1.0f,-1.0f,-1.0f);
glEnd();


glutSwapBuffers();
glutPostRedisplay();
}


void idle()
{
RX+=1.0f;
RY+=2.0f;
RZ+=3.0f;
glutPostRedisplay();
}


int main( int argc, char *argv[ ])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(800,600); //Optionnel
principale=glutCreateWindow("Ma première fenêtre OpenGL !");
glutReshapeFunc(Reshape);
glutDisplayFunc(Draw);
//glutFullScreen(); //Optionnel
deux=glutCreateSubWindow(1,100,100,100,100);
glutSetWindow(deux);
glutReshapeFunc(Reshape);
glutDisplayFunc(Draw);
trois=glutCreateSubWindow(1,300,300,100,100);
glutSetWindow(trois);
glutReshapeFunc(Reshape);
glutDisplayFunc(Draw);
quatre=glutCreateSubWindow(1,315,250,135,50);
glutSetWindow(quatre);
glutReshapeFunc(Reshape);
glutDisplayFunc(Draw);


InitGL();


glutIdleFunc(idle);
glutMainLoop();


return 0;
}

Je developpe en Dev-c++ version 4.9.9.2 sous windows XP service pack 2

Merci d'avance

23 réponses

mondrone Messages postés 246 Date d'inscription mercredi 5 janvier 2005 Statut Membre Dernière intervention 11 mars 2012
13 juil. 2005 à 09:46
une petite question au passage tien le fait de mal config les optiond
du compileur peut peut etre generer des erreurs suplémentaires ?
Dans Outils/Options du compileur, tu asmis des options pour le
compileur ou c'est vierge ? Paske sic'est le cas tu peux essayer de
desactiver les options, ca fonctionne sans !

<hr size="2" width="100%"> Qui ne tente rien...

Ne risque pas d'avoir grand chose !!!

<hr siz="">
0
whikie Messages postés 99 Date d'inscription vendredi 24 juin 2005 Statut Membre Dernière intervention 17 septembre 2005
13 juil. 2005 à 10:03
Salut Mondrone

Ben non c'est pas ca non plus .

Outils/options du compilateur/compilateur
Default compiler

Outils/options du compilateur/options
tout est a no

Outils/options du compilateur/repertoire
binaires : C:\Dev-Cpp\bin
les autres repertoires sont vides

Outils/options du compilateur/programmes
tous les programmes correspondent

Je me demande si faudrait pas tout desinstaller et tous reinstaller
0
whikie Messages postés 99 Date d'inscription vendredi 24 juin 2005 Statut Membre Dernière intervention 17 septembre 2005
13 juil. 2005 à 15:31
merci beaucoup

apres 2 relance de compilations ?!? le programme s'est enfin comporté comme prevu

par contre j'ai mis dans priojet/option du projet:/paramet..

lib/libopenglut.a
-lglu32
-lopengl32
-lwinmm
-lgdi32
lib/libglut32.a

ca a l'air de ne fonctionner que comme ca...

Encore merci pour ta patience
0
Rejoignez-nous