Updated test with .flip() Still fails on Windows to draw after the first
draw/flush/dispatch. Still work ok on Linux no matter if flip() is used or
not. pyglet failed under Wine so no way to test without Windows system I am
afraid.
On Friday, December 28, 2012 11:58:59 PM UTC+3, anatoly techtonik wrote:
>
> I'm afraid that without window.flip() may break pyglet on other platforms
> with pyglet.gl.Config(double_buffer=False). Does it work the same way for
> Linux? I think that for the proper test another label should be drawn after
> the "After." string is printed.
>
> On Thursday, December 27, 2012 8:44:12 PM UTC+3, Anonymouse wrote:
>>
>> I'm on linux (ubuntu 12.10). Maybe try adding a window.flip() after
>> label.draw()?
>>
>> On 24 December 2012 23:09, anatoly techtonik <[email protected]> wrote:
>>
>>> Exactly. It draws only after "After." is displayed and I press Enter.
>>> Are you on a Windows Vista too?
>>>
>>>
>>> On Tue, Dec 25, 2012 at 12:56 AM, Anonymouse <[email protected]>wrote:
>>>
>>>> You mean it doesn't draw after you press enter for the first time?
>>>> Because it does for me.
>>>>
>>>>
>>>> On 24 December 2012 22:28, anatoly techtonik <[email protected]> wrote:
>>>>
>>>>> Doesn't help. Here is the script with added event logger for the
>>>>> window. On my machine the output is:
>>>>>
>>>>> >py testdraw.py
>>>>> on_activate()
>>>>> on_show()
>>>>> on_resize(width=640, height=480)
>>>>> on_expose()
>>>>> Before Label draw.
>>>>> on_deactivate()
>>>>> After.
>>>>> Done.
>>>>>
>>>>>
>>>>>
>>>>> import pyglet
>>>>>
>>>>> wincfg = pyglet.gl.Config(double_buffer=False)
>>>>> window = pyglet.window.Window(config=wincfg)
>>>>> window.push_handlers(pyglet.window.event.WindowEventLogger())
>>>>> window.dispatch_events()
>>>>>
>>>>> raw_input("Before Label draw.")
>>>>>
>>>>> label = pyglet.text.Label('[]',
>>>>> font_name='Lucida Console',
>>>>> font_size=14,
>>>>> x=10, y=10)
>>>>> label.draw()
>>>>> pyglet.gl.glFlush()
>>>>> window.dispatch_events()
>>>>>
>>>>> raw_input("After.")
>>>>>
>>>>> label.draw()
>>>>> pyglet.gl.glFlush()
>>>>> window.dispatch_events()
>>>>>
>>>>> raw_input("Done.")
>>>>>
>>>>>
>>>>> On Tue, Dec 25, 2012 at 12:06 AM, Anonymouse <[email protected]>wrote:
>>>>>
>>>>>> I can't be sure, but I think it's because you need to
>>>>>> dispatch_events() once before drawing anything so that an on_resize
>>>>>> event
>>>>>> gets handled, which will set the projection matrix for the window. If
>>>>>> you
>>>>>> draw before it, the projection matrix is probably such that you can't
>>>>>> see
>>>>>> wherever the text gets drawn. So call window.dispatch_events() once
>>>>>> before
>>>>>> drawing and it does display.
>>>>>>
>>>>>>
>>>>>> On 24 December 2012 16:30, anatoly techtonik <[email protected]>wrote:
>>>>>>
>>>>>>> Why pyglet doesn't display label on the first iteration?
>>>>>>> On my Vista machine it is visible only after I hit Enter the second
>>>>>>> time.
>>>>>>>
>>>>>>> import pyglet
>>>>>>>
>>>>>>> wincfg = pyglet.gl.Config(double_buffer=False)
>>>>>>> window = pyglet.window.Window(config=wincfg)
>>>>>>>
>>>>>>> label = pyglet.text.Label('[]',
>>>>>>> font_name='Lucida Console',
>>>>>>> font_size=14,
>>>>>>> x=10, y=10)
>>>>>>> label.draw()
>>>>>>> pyglet.gl.glFlush()
>>>>>>> window.dispatch_events()
>>>>>>>
>>>>>>> raw_input("Done.")
>>>>>>>
>>>>>>> label.draw()
>>>>>>> pyglet.gl.glFlush()
>>>>>>> window.dispatch_events()
>>>>>>>
>>>>>>> raw_input("Done.")
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "pyglet-users" group.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msg/pyglet-users/-/Tr5ouPliAKMJ.
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected].
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/pyglet-users?hl=en.
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "pyglet-users" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected].
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/pyglet-users?hl=en.
>>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "pyglet-users" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/pyglet-users?hl=en.
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "pyglet-users" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/pyglet-users?hl=en.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "pyglet-users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/pyglet-users?hl=en.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pyglet-users/-/RZt4YEZiGdkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.
import pyglet
wincfg = pyglet.gl.Config(double_buffer=False)
window = pyglet.window.Window(config=wincfg)
window.push_handlers(pyglet.window.event.WindowEventLogger())
window.dispatch_events()
raw_input("Before Label draw.")
label = pyglet.text.Label('[]',
font_name='Lucida Console',
font_size=14,
x=10, y=10)
label.draw()
#window.flip()
pyglet.gl.glFlush()
window.dispatch_events()
raw_input("After.")
label = pyglet.text.Label('[]',
font_name='Lucida Console',
font_size=14,
x=15, y=15)
label.draw()
pyglet.gl.glFlush()
window.dispatch_events()
raw_input("Done.")