Salut
voila je travaille avec c++builder 6 et opengl.
j'ai essayer le code suivant :
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
 
#include <windows.h>
#include <stdio.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glut.h>
 
 
void init(void)
{
   glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.5f);				// Black Background
  glEnable ( GL_COLOR_MATERIAL );
   glColorMaterial ( GL_FRONT, GL_AMBIENT_AND_DIFFUSE );
 
	glEnable ( GL_TEXTURE_2D );
   glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
 
}
 
void reshape( int w, int h )
{   float ratio ;
 
	if(h == 0)
		h = 1;
 
       ratio = 1.0f * w / h;
	// Reset the coordinate system before modifying
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
 
	// Set the viewport to be the entire window
    glViewport(0, 0, w, h);
 
	// Set the clipping volume
       //	gluPerspective(80,ratio,1,200);
	glMatrixMode(GL_MODELVIEW);
        	glLoadIdentity();
 
}
 
void display( void )
{
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 glutSolidCube(1.0);
   glutSwapBuffers();
}
 
void keyboard ( unsigned char key, int x, int y )  // Create Keyboard Function
{
  switch ( key ) {
    case 27:        // When Escape Is Pressed...
      exit ( 0 );   // Exit The Program
      break;        // Ready For Next Case
    default:        // Now Wrap It Up
      break;
  }
}
 
void arrow_keys ( int a_keys, int x, int y )  // Create Special Function (required for arrow keys)
{
  switch ( a_keys ) {
    case GLUT_KEY_UP:     // When Up Arrow Is Pressed...
      glutFullScreen ( ); // Go Into Full Screen Mode
      break;
    case GLUT_KEY_DOWN:               // When Down Arrow Is Pressed...
      glutReshapeWindow ( 500, 500 ); // Go Into A 500 By 500 Window
      break;
    default:
      break;
  }
}
 
void main ( int argc, char** argv )
{
  glutInit            ( &argc, argv );
  glutInitDisplayMode ( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA );
  glutInitWindowPosition (0,0);
  glutInitWindowSize  ( 500, 500 );
  glutCreateWindow    ( "cube" );
  init ();
  glutFullScreen      ( );
  glutDisplayFunc     ( display );
  glutReshapeFunc     ( reshape );
  glutKeyboardFunc    ( keyboard );
  glutSpecialFunc     ( arrow_keys );
  glutIdleFunc			 ( display );
  glutMainLoop        ( );
}
ça marche trés bien et m'affiche un cube solide

mais maintenant je veux que le cube ne s'affiche pas quand j'execute mais plutot quand je clique un boutton "cube" !!!

j'ai ça
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
void __fastcall TForm1::dessiner_cubeClick(TObject *Sender)
{
dessiner_cube->Checked=true;
}
qu'est ce que j'écris dans cette fonction pour afficher le cube ?? j'appelle display , main ou quoi exactement !!

merci d'avance