Discussion:
Problems with OpenGL e dc.DrawText
lc
2014-07-14 13:19:48 UTC
Permalink
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.
--
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
Vadim Zeitlin
2014-07-14 15:21:37 UTC
Permalink
On Mon, 14 Jul 2014 06:19:48 -0700 (PDT) lc wrote:

l> I'm experiencing some problems with OpenGL and dc.DrawText. I tested the
l> code with Windows XP (it works) and Windows 7 (it doesn't works).
l>
l> To show the problem, I used the cube sample and edit the code to show a
l> zoom rectangule when the user drags the mouse with the left button pressed.
l> Also, in the center of the screen, I shown the x-coordinate of the mouse.
l> Both drawings are made using wxPaintDC, but only the first (the rectangle)
l> works fine. The dc.drawText doesn't correctly update the drawings under
l> Windows 7.
l>
l> The modified cube code is in the link:
l> - cube.cpp: http://pastebin.com/axLgyU7N
l> - cube.h: http://pastebin.com/YzTa0ZeA

Sorry, I won't be able to look at this any time soon, and to avoid this
code being lost when the pastebin expires, could you please open a ticket
in our Trac instead?

l> To make it easier to analyse my code, I put a // TODO comment in all code
l> I've added.

It also would be much more convenient if you could please make a patch
against the sample with your changes (see
http://trac.wxwidgets.org/wiki/HowToSubmitPatches if you hadn't done this
before).

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
lc
2014-07-14 16:08:10 UTC
Permalink
Em segunda-feira, 14 de julho de 2014 12h21min41s UTC-3, Vadim Zeitlin
escreveu:
VZ>Sorry, I won't be able to look at this any time soon, and to avoid this
VZ>code being lost when the pastebin expires, could you please open a
ticket
VZ>in our Trac instead?

Of course. I opened the ticket #16382 with this case.

VZ>It also would be much more convenient if you could please make a patch
VZ>against the sample with your changes (see
VZ>http://trac.wxwidgets.org/wiki/HowToSubmitPatches if you hadn't done
this
VZ>before).

In fact there are no problems with the cube-sample. I just changed it to
simulate the problem I'm experiencing with my real application. It is kind
of a minimal application with the problem.

Regards
--
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
Loading...