Hi,
Is there a way to ensure that a redisplay occurs?
Here's an example situation: I let the user change the
background color. A pop up window appears and
the user selects the new color. The window disappears
and then I change the background color and call
glutPostRedisplay(). Unfortunately, the background
color doesn't change right away.
It only occurs (I don't know why) when the user
clicks in the OpenGL window.
Thanks.
|
|
0
|
|
|
|
Reply
|
flarkino (12)
|
8/21/2008 2:55:51 PM |
|
"Flark" <flarkino@yahoo.com> wrote in message
news:2eeb07cf-f47d-4217-9779-8a505bfad954@59g2000hsb.googlegroups.com...
> Hi,
>
> Is there a way to ensure that a redisplay occurs?
>
> Here's an example situation: I let the user change the
> background color. A pop up window appears and
> the user selects the new color. The window disappears
> and then I change the background color and call
> glutPostRedisplay(). Unfortunately, the background
> color doesn't change right away.
>
> It only occurs (I don't know why) when the user
> clicks in the OpenGL window.
>
> Thanks.
Sounds like you are forgetting a flush or swapbuffers in your display
routine. Print out where you do a postredisplay and then also in your
display routine to see if it really is getting called but you've got a logic
problem.
jbw
|
|
0
|
|
|
|
Reply
|
jbwest
|
8/21/2008 4:03:49 PM
|
|
On Aug 21, 12:03=A0pm, "jbwest" <jbw...@comcast.net> wrote:
> Sounds like you are forgetting a flush or swapbuffers in your display
> routine. Print out where you do a postredisplay and then also in your
> display routine to see if it really is getting called but you've got a lo=
gic
> problem.
Neither of these work. I wonder if perhaps GLUI is affecting things?
1.
update_glui_statictext ();
glutPostRedisplay ();
glFlush ();
2.
update_glui_statictext ();
glutSwapBuffers ();
glFlush ();
|
|
0
|
|
|
|
Reply
|
Flark
|
8/21/2008 5:24:44 PM
|
|
Incidentally what I am trying to do is
cause a redisplay of a GLUI static text item
from within a callback before returning to
the GLUT event loop. I need to display
some information, then do some work,
then return to GLUI, preferably without
switching to a multithreaded approach.
|
|
0
|
|
|
|
Reply
|
Flark
|
8/21/2008 5:55:01 PM
|
|
You must activate your opengl context, that's all.
"Flark" <flarkino@yahoo.com> schrieb im Newsbeitrag
news:3373e0ad-ad76-4f63-88cb-c6c2c411b51b@e39g2000hsf.googlegroups.com...
>
> Incidentally what I am trying to do is
> cause a redisplay of a GLUI static text item
> from within a callback before returning to
> the GLUT event loop. I need to display
> some information, then do some work,
> then return to GLUI, preferably without
> switching to a multithreaded approach.
>
>
|
|
0
|
|
|
|
Reply
|
NewsReader
|
8/21/2008 6:56:12 PM
|
|
"Flark" <flarkino@yahoo.com> wrote in message
news:3373e0ad-ad76-4f63-88cb-c6c2c411b51b@e39g2000hsf.googlegroups.com...
>
> Incidentally what I am trying to do is
> cause a redisplay of a GLUI static text item
> from within a callback before returning to
> the GLUT event loop. I need to display
> some information, then do some work,
> then return to GLUI, preferably without
> switching to a multithreaded approach.
>
No can do. glutPostRedisplay just queues a redisplay for the glutMainLoop,
it doesn't immediately cause a redraw.
"glutPostRedisplay marks the normal plane of current window as needing to be
redisplayed. glutPostWindowRedisplay works the specified window as needing
to be redisplayed. After either call, the next iteration through
glutMainLoop, the window's display callback will be called to redisplay the
window's normal plane."
You need to queue the redisplay, return to glut main loop, when the
redisplay happens, then fire the work proc. This is the classic "progress
meter" mistake.
|
|
0
|
|
|
|
Reply
|
jbwest
|
8/22/2008 12:02:59 AM
|
|
Hi,
I'm new to OpenGL. I also have the problem for which the screen get
updated only when the mouse enters the window (although I'm calling
glutPostRedisplay).
I'm swapping the buffers and also have tried to flush, but nothing
changed. What am I missing?
Thanks in advance.
Alessandro
On 22 ago, 02:02, "jbwest" <jbw...@comcast.net> wrote:
> "Flark" <flark...@yahoo.com> wrote in message
>
> news:3373e0ad-ad76-4f63-88cb-c6c2c411b51b@e39g2000hsf.googlegroups.com...
>
>
>
> > Incidentally what I am trying to do is
> > cause a redisplay of a GLUI static text item
> > from within a callback before returning to
> > the GLUT event loop. I need to display
> > some information, then do some work,
> > then return to GLUI, preferably without
> > switching to a multithreaded approach.
>
> No can do. glutPostRedisplay just queues a redisplay for the glutMainLoop,
> it doesn't immediately cause a redraw.
>
> "glutPostRedisplay marks the normal plane of current window as needing to be
> redisplayed. glutPostWindowRedisplay works the specified window as needing
> to be redisplayed. After either call, the next iteration through
> glutMainLoop, the window's display callback will be called to redisplay the
> window's normal plane."
>
> You need to queue the redisplay, return to glut main loop, when the
> redisplay happens, then fire the work proc. This is the classic "progress
> meter" mistake.
|
|
0
|
|
|
|
Reply
|
Alessandro
|
9/11/2008 10:57:23 PM
|
|
On 12 sep, 00:57, Alessandro <alessandro.dena...@gmail.com> wrote:
> Hi,
> I'm new to OpenGL. I also have the problem for which the screen get
> updated only when the mouse enters the window (although I'm calling
> glutPostRedisplay).
> I'm swapping the buffers and also have tried to flush, but nothing
> changed. What am I missing?
> Thanks in advance.
>
> Alessandro
Apparently the problem was that I was calling glutPostRedisplay from
another thread. By calling it from a gl timer function it works fine.
|
|
0
|
|
|
|
Reply
|
Alessandro
|
9/12/2008 12:41:36 AM
|
|
|
7 Replies
257 Views
(page loaded in 1.663 seconds)
|