lc
2014-07-14 13:19:48 UTC
I'm experiencing some problems with OpenGL and dc.DrawText. I tested the
code with Windows XP (it works) and Windows 7 (it doesn't works).
To show the problem, I used the cube sample and edit the code to show a
zoom rectangule when the user drags the mouse with the left button pressed.
Also, in the center of the screen, I shown the x-coordinate of the mouse.
Both drawings are made using wxPaintDC, but only the first (the rectangle)
works fine. The dc.drawText doesn't correctly update the drawings under
Windows 7.
The modified cube code is in the link:
- cube.cpp: http://pastebin.com/axLgyU7N
- cube.h: http://pastebin.com/YzTa0ZeA
To make it easier to analyse my code, I put a // TODO comment in all code
I've added. The main code is in the end of method TestGLCanvas::OnPaint:
if (showZoomRectangule) {
wxPen pen;
pen.SetColour(0,0,0);
pen.SetWidth(1);
pen.SetStyle(wxSOLID);
dc.SetPen(pen);
// DrawRectangle desenha ele preenchido. Desenhar linhas.
dc.DrawLine(xP1, yP1, xP1, yP2);
dc.DrawLine(xP1, yP2, xP2, yP2);
dc.DrawLine(xP2, yP2, xP2, yP1);
dc.DrawLine(xP1, yP1, xP2, yP1);
dc.SetTextForeground(wxColour(255,0,0));
// FIXME: PROBLEM HERE
dc.DrawText(wxString::FromDouble(xP2), GetSize().x/2, GetSize().y/2);
}
I don't know if this is the right way to draw the text or if there is a
better way. Anyone can help me with some thoughts about this?
Thank you,
Leandro
ps.: sorry for my english. I'm not a native english speaker.
code with Windows XP (it works) and Windows 7 (it doesn't works).
To show the problem, I used the cube sample and edit the code to show a
zoom rectangule when the user drags the mouse with the left button pressed.
Also, in the center of the screen, I shown the x-coordinate of the mouse.
Both drawings are made using wxPaintDC, but only the first (the rectangle)
works fine. The dc.drawText doesn't correctly update the drawings under
Windows 7.
The modified cube code is in the link:
- cube.cpp: http://pastebin.com/axLgyU7N
- cube.h: http://pastebin.com/YzTa0ZeA
To make it easier to analyse my code, I put a // TODO comment in all code
I've added. The main code is in the end of method TestGLCanvas::OnPaint:
if (showZoomRectangule) {
wxPen pen;
pen.SetColour(0,0,0);
pen.SetWidth(1);
pen.SetStyle(wxSOLID);
dc.SetPen(pen);
// DrawRectangle desenha ele preenchido. Desenhar linhas.
dc.DrawLine(xP1, yP1, xP1, yP2);
dc.DrawLine(xP1, yP2, xP2, yP2);
dc.DrawLine(xP2, yP2, xP2, yP1);
dc.DrawLine(xP1, yP1, xP2, yP1);
dc.SetTextForeground(wxColour(255,0,0));
// FIXME: PROBLEM HERE
dc.DrawText(wxString::FromDouble(xP2), GetSize().x/2, GetSize().y/2);
}
I don't know if this is the right way to draw the text or if there is a
better way. Anyone can help me with some thoughts about this?
Thank you,
Leandro
ps.: sorry for my english. I'm not a native english speaker.
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users