bonjour, j'ai un problème au niveau des évènements liés à une fonction,
lorsque je compile toute se passe bien mais lorsque j'exécute le programme, il y a une erreur de segmentation. j'ai essayé d'utiliser gdb.
Voici ce qui traite des évènements:
Voici la fonction OnSize:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 BEGIN_EVENT_TABLE(GLCanvas, wxGLCanvas) EVT_PAINT(GLCanvas::OnPaint) EVT_SIZE(GLCanvas::OnSize) // problème ici EVT_ERASE_BACKGROUND(GLCanvas::OnEraseBackground) END_EVENT_TABLE()
quand j'utilise gdb voici ce qui me donne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 // Methode pour le redimensionnement void GLCanvas::OnSize( wxSizeEvent& event ) { wxGLCanvas::OnSize( event ); int w, h; GetClientSize(&w, &h); glViewport(0,0,(GLint)w,(GLint)h); }
la ligne 62 correspond à glViewport(0,0,(GLint)w,(GLint)h);
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 [Thread debugging using libthread_db enabled] bt Program received signal SIGSEGV, Segmentation fault. 0x00c96516 in glViewport () from /usr/lib/mesa/libGL.so.1 (gdb) bt #0 0x00c96516 in glViewport () from /usr/lib/mesa/libGL.so.1 #1 0x0806211b in GLCanvas::OnSize (this=0x8112440, event=...) at glcanvas.cpp:62 #2 0x0087fa9f in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const () from /usr/lib/libwx_baseu-2.8.so.0 #3 0x0091e209 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0 #4 0x0091f2d4 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/lib/libwx_baseu-2.8.so.0 #5 0x0091f3d3 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0 #6 0x001358de in ?? () from /usr/lib/libwx_gtk2u_gl-2.8.so.0 #7 0x01301438 in g_cclosure_marshal_VOID__BOXED () from /usr/lib/libgobject-2.0.so.0 #8 0x012f4252 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
je pense qu'il y a une erreur au niveu de l'appel à glViewport, mais je narrive pas la corriger. Pouvez vous m'aider sur ce sujet?
Merci de votre compréhension
Partager