Hey everyone.
I'm trying to have a wxScrolledWindow with a wxGLCanvas for a client area.
So far so good, except for one problem. I've uploaded pictures to illustrate
skiffmapA: The window before any scroll (OK)
skiffmapB: The window after scrolling right 1 "tick" (OK)
skiffmapC: The window after scrolling back left (messed up)
C and A should look identical. It's as if the left column of C simply didn't get refreshed after the scroll.
Things I noticed:
1) this problem persists for scrolling in all directions. I just took the screenshots of scrolling left, but scrolling right/up/down all have the same problem.
2) this problem persists when I click the scroll arrows, or in the 'page scroll' void on either side of the scrollbar, but does not happen when I drag the scroll bar. Dragging the scroll bar has no ill effects at all.
3) if I force refresh the window (dragging it offscreen, or put another window on top of it), it will correct itself.
With #3 in mind I tried catching the wxScrolledWinEvent messages and tried to force a Refresh and Update when scrolls were detected, but that didn't help any.
How can I fix this problem?
I'm using wx 2.8.8.0 on Ubuntu with GCC via Code::Blocks.
Any help appreciated!
Problem with wxScrolledWindow + wxGLCanvas
Problem with wxScrolledWindow + wxGLCanvas
- Attachments
-
- skiffmapA.png (7.52 KiB) Viewed 2813 times
-
- skiffmapB.png (7.5 KiB) Viewed 2813 times
-
- skiffmapC.png (7.54 KiB) Viewed 2813 times
Yes, and when you've got to implementing zoom you'd find that scrollbars are just a waste of screen space, and you will implement pan/zoom navigation entirely inside your GLCanvas, just like everybody else It really is much more simple that way.Auria wrote:Hi,
I would definitely not recommend putting a GL canvas inside a scrolled window; I'd rather recommend putting single scrollbars around the GL canvas, and render the contents of the pane according to the position of the scrollbars.
Auria:
That makes sense. I'll give that a go. Thanks.
yuri:
You mean like draw my own scroll bars via OpenGL instead of using the window managers? What's the benefit of that?
Seems to me like it would just be tons more work and would clash with the user's display scheme... and would be unintuitive, and wouldn't function in all the normal ways a scroll bar does, etc, etc.
That makes sense. I'll give that a go. Thanks.
yuri:
You mean like draw my own scroll bars via OpenGL instead of using the window managers? What's the benefit of that?
Seems to me like it would just be tons more work and would clash with the user's display scheme... and would be unintuitive, and wouldn't function in all the normal ways a scroll bar does, etc, etc.
No, I mean do it without scrollbars at all.Disch wrote: You mean like draw my own scroll bars via OpenGL instead of using the window managers? What's the benefit of that?
Scrollbar is GUI element to scroll in one given direction.
That's fine in may cases where user mostly "scrools", like word doc or excel spreadsheet.
You CAN use scrollbars too, but most of the time your users would like to PAN instead of SCROLL, that is move your canvas in two dimenstions at once following mouse pointer. One can do it with SCROLL, moving one bar then another, but that's not very convenient.
Using opengl you may easily implement PAN yourself, without scrollbars. Look like navigation is done with GoogleEarch, there is no scrollbars on screen at all. And if you ever come to implement zoom and rotate - you'll need to do it using opengl camera anyway, so why bother with separate approach at all? Just set up opengl camera and probably toggle or two on toolbar to select between zoom/pan/rotate, then move camera appropriately upon receiving mouse events.
-
- Experienced Solver
- Posts: 86
- Joined: Wed Apr 18, 2007 6:10 am
- Location: Shanghai China