On Mar 24, 8:03 am, Nicolas Rougier <[email protected]> wrote:
> If your clear method clear the screen with a black color then you're
> drawing a black line over a black background. Try something like
> pyglet.gl.glColor4f(1.0, 0, 0, 1.0) instead.
Yes, I was indeed having problems with the background colors. :( Am I
correct that the values for each (R, G, B, A) have to be between 0 and
1? Let's say that I wanted a nice color (blue R=125, G=167, B=217 or
hex #7da7d9). I tried to clear the background color with rabbyt.clear
((125,167,217,1)). That didn't give me the results I expected so when
I looked up the documentation it stated the maximum value was 1! This
seemed very weird - I thought the documentation had a typo at first.
Wouldn't actual RGB values be easier for the developer to enter?
But anyway - my question wasn't about Rabbyt's clear method - I'm
still trying to draw the lines with Pyglet.
Here's the entire thing if you want to see the behavior that I'm
trying to describe:
import rabbyt
from pyglet.window import Window
from pyglet import clock
from pyglet import image
from pyglet.graphics import *
from pyglet.gl import *
import os.path
rabbyt.data_directory = os.path.dirname(__file__)
clock.schedule(rabbyt.add_time)
window = Window(width=800, height=600, caption='Line Test')
rabbyt.set_default_attribs()
clockDisplay = clock.ClockDisplay()
mySprite = rabbyt.Sprite("star.png")
while not window.has_exit:
clock.tick()
window.dispatch_events()
rabbyt.clear((1,0,0,1))
pyglet.gl.glColor4f(0, 0, 0, 1.0)
pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (0, 0,
800, 600)))
mySprite.render()
clockDisplay.draw()
window.flip()
When I run it I see (very briefly) a white screen - then I see (for an
instant) my black line) and then everything is covered over with the
(now red) background (counter visible at bottom left).
I think I'm missing something Pyglet related to get the lines to
'stay' on the screen.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---