braindam...@lowtown.se wrote: >> braindam...@lowtown.se wrote: >> >>> I'm trying to simply draw a rectangle with a color. I've managed to do >>> this in PyOpenGL alone, but I find it eluding me in pyglet. >>> >>> There's no problem drawing the GL_QUADS without the color option. It >>> shows >>> up nice and white on the screen. When I try to add a color, it just goes >>> black. >>> >>> pyglet.graphics.draw(4, pyglet.gl.GL_QUADS, ('v2i', tuplewithpoints), >>> ('c3B', tuplewithallpointsnormalcolors)) >>> >>> >>> There's two questions. Is there a way of assigning the color to this >>> quad >>> with only one variable instead of four? I don't want to give each vertex >>> a >>> color when all of them are the same. >>> How do I get colors to work at all? heh.. >>> >>> The reference and programmers guide offer little explanation. >>> >>> >> Leave out the c3B color-per-vertex stuff, and set the color with >> glColor3f(r,g,b) before calling the pyglet.graphics.draw(...). This >> assumes you are not doing lighting, which is the default, or specified >> with glDisable(GL_LIGHTING). >> >> If you *are* doing lighting with glEnable(GL_LIGHTING) then glColor is >> ignored and you need to supply many lighting and material properties >> with calls to glLight, and glMaterial -- but that's another story... >> >> Gary Herron >> >> > > That did the trick alright. I had missed that the pyglet.gl gave all the > openGL functions. Thanks! >
Glad to help. > I'm a bit curious what the c3B is for though. > If you want the color of an object to vary vertex-by-vertex you can associate a (different) color with each vertex. OpenGL will interpolate those colors across the object. Gary Herron > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to pyglet-users@googlegroups.com To unsubscribe from this group, send email to pyglet-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---