[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Using PyOpenGL for 2D graphics
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Using PyOpenGL for 2D graphics
- From: Luke Paireepinart <rabidpoobear@xxxxxxxxx>
- Date: Mon, 16 Jul 2007 04:20:52 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 16 Jul 2007 05:21:05 -0400
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=TOjReszwWQcoz5HOkxwFnIPMT2TsSGezwh3eqnuyx/jAaBFcvb6lyD/DUklrMCjctomogDWAGQGPG0TWiXDgxFFXQn1RgzKO2LLMVDvo8ppsdNo9QlxOMvKd+a5G+Wduqa5BJkox/qsxp7GRJ4B9DvovPyWMBKikd8069uisvmM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=WLxWLGpAwkJ/cRKExzJYZjKoK7Es6WXnQ+sdJr37znbFQILX3D2/GKhC9oL6Tnf7PFxiQp3ty7Euh4gf2c6RoPSw7zm6sBK28lOJOlXX/HvJVBFPDgSZOdwTA24stiVk2mrmtthY55HwboWNDJ9JuaCyJlXI+qJQgu35dZmt5+4=
- In-reply-to: <200707160735.l6G7ZFYs027776@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <200707160735.l6G7ZFYs027776@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Thunderbird 1.5.0.12 (Windows/20070509)
Richard Jones wrote:
[snip other stuff not relevant to me teasing Richard]
But fundamentally, GFX* is just using a GL context, and pygame and pyglet both provide one of
those.
Quick, untested translation of Simon's example to pyglet:
1 from pyglet import window, image
2 from gfx import gl
3
4 w = window.Window(800, 600)
w is window here...
5 gl.init((800,600)) # I assume this is just setting up a projection :)
6
7 im = image.load('ball.png')
8 texture_id = im.texture.id
9 w,h = im.width, im.height
and, whoops, you reassigned it to the width here :D
Good thing this isn't *tested* code or I'd be wondering about you,
Richard ;)
10 while not w.has_exit:
11 w.dispatch_events()
12 gl.draw_quad((0,0),((0,0),(0,h),(w,h),(w,0)), texture_id=texture_id)
13 w.flip()
I was confused as to how you were flipping an integer... 2s complement? :D
-Luke