salut,
ca va peut etre paraitre ridicule mais ca fait maintenant 3 longues heures que j'essaie de dessiner un point aux coordonnées (x, y) avec openGL, j'arrive a saturation, meme pas je suis arrivé a faire apparaitre un point !!!!!!
si je fait un quad ou quelque autre forme, c'est no pb mais un point, impossible !!!!!!!! PFF;
bon, le code qui est tiré des exemples wxWIDGETS que je comprends pas:
Initialisation du wxGLCanvas:
void
MyCanvas::InitGL(void) {
SetCurrent();
/* set viewing projection */ glMatrixMode(GL_PROJECTION);
glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 1.0f, 3.0f);
/* position viewer */ glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0f, 0.0f, 0.0f);
/* position object */ glRotatef(30.0f, 1.0f, 0.0f, 0.0f);
glRotatef(30.0f, 0.0f, 1.0f, 0.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
}
ensuite, tout simplement j'apelle cette fonction dans un paintEvent:
void
MyCanvas::InitialRender(void) {
wxPaintDC dc(
this); #ifndef
__WXMOTIF__ if (!GetContext()) return; #endif
SetCurrent();
// Init OpenGL once, but after SetCurrent if (!m_init) {
InitGL();
m_init =
true; }
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 1.0f, 3.0f);
glMatrixMode(GL_MODELVIEW);
/* clear color and depth buffers */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if( m_gllist == 0 ) {
m_gllist = glGenLists( 1 );
glNewList( m_gllist, GL_COMPILE_AND_EXECUTE );
for( float i = 0.0f; i < 100.0f; i++ ) {
glBegin(GL_POINTS);
//red glColor3f(1.0f,0.0f,0.0f);
glVertex2f( i, 50.0f );
glEnd( );
}
glEndList();
}
else {
glCallList(m_gllist);
}
glFlush();
SwapBuffers();
voila, logiquement une ligne de points devrait s'afficher mais quetchi, je craque un peu la je dois avouer........
A l'aiiiiiide
@+;
satellite34
http://www.rootscommunity.com/