bibliolytic
bibliolytic

Reputation: 125

Pyglet GL_QUADS and GL_POLYGON not working properly

I'm trying to write a simple game and for some reason the graphics primitives aren't working properly on my machine (Win7/NVIDIA Quadro K2100M). I'm trying to draw a rectangle but whenever I use GL_QUADS or GL_POLYGON it comes with a weird bend in it. It works with GL_QUAD_STRIP, oddly, but that's really not ideal since I don't want the ones I"m drawing to be connected. I really have no idea what the problem could be...

Example code:

import pyglet

window = pyglet.window.Window(width=400, height=400)
batch = pyglet.graphics.Batch()
white = [255]*4
batch.add(4, pyglet.gl.GL_QUADS, None, ('v2i',[10,10,10,50,390,10,390,50]), ('c4B',white*4))

batch.add(4, pyglet.gl.GL_POLYGON, None, ('v2i',[10,60,10,110,390,60,390,110]), ('c4B',white*4))
batch.add(4, pyglet.gl.GL_QUAD_STRIP, None, ('v2i',[10,120,10,170,390,120,390,170]), ('c4B',white*4))



@window.event
def on_draw():
    batch.draw()

pyglet.app.run()

How that looks on my computer

Upvotes: 1

Views: 1930

Answers (1)

bibliolytic
bibliolytic

Reputation: 125

I'm so stupid: I put the points in the wrong order so it drew (top left, bottom left, top right, bottom right) and of course this would be the result X_X

Upvotes: 1

Related Questions