On Tue, Mar 24, 2009 at 10:30 PM, Jen <[email protected]> wrote:
>
> 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?

All colors in rabbyt (and pyglet) are in the range 0..1.  That's how
they are with OpenGL.  You get used to it pretty quick :-)

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

Disable texturing before drawing your lines:

glDisable(GL_TEXTURE_2D)

Rendering the sprite enables texturing, which causes your line to be
drawn using the star texture.  But since you don't specify texture
coordinates, only the last texture coordinate is used.  This ends up
being one of the texture corners, which is 100% transparent.

MWM

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to