Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Dave LeCompte (really)
Ian Mallett [EMAIL PROTECTED] wrote:
 Try looking at glOrtho2D() or something like that...

Yes, glOrtho() or glOrtho2D() both work.


 Why do you want to use
 PyOpenGL for 2D-ness?  It's much better suited to 3D stuff.

Well, just because OpenGL was designed for 3D doesn't mean it's not also a
very good tool for 2D.

Some reasons I prefer OpenGL for 2D to SDL's drawing code:

- performance
- sub-pixel positioning
- scaling/rotation
- blending
- vertex coloring
- lots of good documentation, lots of sample code, lots of tips on
optimizing performance available on the web

Basically, a lot of the graphical features I might want to use in a 3D
renderer, I might also want to use in a 2D renderer.


 I've always
 found it easier to use pygame for 2D games.  Oh, and ummm...  Don't tell
 Silicon Graphics, but I've found pygame is much much faster at 2D.

I'm in the other camp - I find OpenGL easy and fast, and if I want to
reuse code from a 2D game in a later 3D project, the port will be much
easier than if I have to rewrite it from SDL to OpenGL.

-Dave LeCompte


Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Ian Mallett

On 7/7/07, Dave LeCompte (really) [EMAIL PROTECTED] wrote:


Ian Mallett [EMAIL PROTECTED] wrote:
 Try looking at glOrtho2D() or something like that...

Yes, glOrtho() or glOrtho2D() both work.


 Why do you want to use
 PyOpenGL for 2D-ness?  It's much better suited to 3D stuff.

Well, just because OpenGL was designed for 3D doesn't mean it's not also a
very good tool for 2D.

Some reasons I prefer OpenGL for 2D to SDL's drawing code:

- performance
- sub-pixel positioning
- scaling/rotation
- blending
- vertex coloring
- lots of good documentation, lots of sample code, lots of tips on
optimizing performance available on the web

Basically, a lot of the graphical features I might want to use in a 3D
renderer, I might also want to use in a 2D renderer.


 I've always
 found it easier to use pygame for 2D games.  Oh, and ummm...  Don't tell
 Silicon Graphics, but I've found pygame is much much faster at 2D.

I'm in the other camp - I find OpenGL easy and fast, and if I want to
reuse code from a 2D game in a later 3D project, the port will be much
easier than if I have to rewrite it from SDL to OpenGL.



Yes, by far an large, OpenGL is better at 3D, but 2D?  I don't know.  My
experience has been that OpenGL is slower, but then again, I was new to that
sort of thing.  It would be good to run a few tests to confirm one way or
the other.  And yes, you are right.  Porting code would be much easier
without those changes.

-Dave LeCompte




Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Patrick Mullen

Opengl will be slower than sdl on computers with either bad graphics cards
or bad graphics drivers, but in general it is much much faster.  On the
order of 10 times faster or more for some things.  But you have to code the
opengl way, and not the sdl way.

Directly modifying pixels in a texture is going to be slower than blitting
pixels to the screen, so you will want to use another interface to draw
pixels to a texture and then replace the texture for it to be update on the
screen.  If you can find a way to accomplish what you want without changing
or editing textures, it will probably work a bit better.  On more advanced
cards you can use pixel rendering functions to offset this issue, but that
is less portable.

Another common slowdown with using opengl for 2d is badly sized textures.
Most cards will either have graphical errors or run slowly if any texture is
not a power of 2 in size (256x256, 512x512 etc).  This is not much of a
problem, since you can use scaling of polygons rather than scaling of a
textures pixels in order to make anything look the right size on screen.

Finally, polygon count does matter.  If you use tiles and make a giant map,
say, 10,000 x 10,000, and then blit that whole map to the screen, it will
run incredibly slow.  You have to be just as careful in opengl on how much
data you pass to the renderer as you would have to watch the number and size
of your blits in sdl.

Lastly, display lists or other batch techniques to limit the amount of
functions python has to call are a must.  Python function calls are slow, so
if you are telling opengl to draw each vertex of the entire scene every
frame, it could possibly be slower than the blits would just due to the
python overhead.

I'd like to see what your test was that ran slower in opengl than sdl.
Everything I've done has ran 100-300 fps in opengl versus 40-60fps being
about the max  I've EVER seen SDL run anything.


Re: [pygame] File Copying

2007-07-08 Thread Luke Paireepinart

Ian Mallett wrote:

New issue:  If I do something like:

font = pygame.font.SysFont(Times New Roman, 12)
FontObject = font.render(this is line 1
this is line 2
this is line 3, 1, (255,255,255), (3,3,3))
surface.blit(FontObject, (0,0))

instead of putting a newline thing it puts a rectangle and a space.  I 
remember the docs saying to do it that way though...

The font object's render method doesn't do newlines.
It says that in the docs.
You have to render each line of text seperately.
-Luke


Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread altern

Charles Joseph Christie II(e)k dio:
So, I'm trying to find a single good newbie tutorial for using PyOpenGL for 2D 
graphics. I haven't found a single one yet, although I have found a few that 
focus on C++. Some people recommended that I take a look at the NEHE 
tutorials that were re-coded in python on the python page, but those only go 
from 1 to 10. Does anyone know where I could find a good starting point (it 
doesn't have to be a super-noobish tutorial, just something to give me 
examples on how to start) for using PyOpenGL in conjunction with Pygame for 
making something?




hi charles

you might get some ideas from this basic example. Not very impressive 
graphics ;) but it touches some basic concepts of how to deal with 2D in 
OpenGL. You could avoid using pygame by using GLUT instead but I think 
using pygame is much nicer and flexible.


2D using pyopengl with pygame
https://devel.goto10.org/filedetails.php?repname=ixipath=%2Fpython%2Fpygame_opengl.pyrev=0sc=0

and in case you are interested on using GLUT
https://devel.goto10.org/filedetails.php?repname=ixipath=%2Fpython%2Fglut_opengl.pyrev=0sc=0

good luck

enrike


Re: [pygame] multicpu machine for testing some pygame code?

2007-07-08 Thread Ian Mallett

I think I can do that.  My OS is Windows Vista Home Premium.

On 7/8/07, René Dudfield [EMAIL PROTECTED] wrote:


hi,

I mean you need to compile pygame from source.  From the source code
which is in subversion:

http://www.pygame.org/wiki/cvs

What OS are you using?

Cheers,

On 7/9/07, Ian Mallett [EMAIL PROTECTED] wrote:
 I've got a dual core comp.  What do you mean by subversion pygame?


 On 7/8/07, René Dudfield [EMAIL PROTECTED]  wrote:
  Hello,
 
  if someone has a multicore, or multi cpu system... can you please test
  some code for me?
 
  I'm trying to get some code into pygame to make it work better for
  multicore machines... but I need to test it some more.
 
  You'll need to be able to compile subversion pygame.
 
 
  Cheers,
 





Re: [pygame] multicpu machine for testing some pygame code?

2007-07-08 Thread Richard Goedeken
Rene,

I have a dual core machine at home, and 4-way and 8-way machines at
work.  I can get and build the SVN trunk; just email me the code or
instructions.

Richard


René Dudfield wrote:
 Hello,
 
 if someone has a multicore, or multi cpu system... can you please test
 some code for me?
 
 I'm trying to get some code into pygame to make it work better for
 multicore machines... but I need to test it some more.
 
 You'll need to be able to compile subversion pygame.
 
 
 Cheers,
 
 


Re: [pygame] multicpu machine for testing some pygame code?

2007-07-08 Thread René Dudfield

Thanks Richard - that'd be great!

I'll try and improve the code first... then send you some test code.

Thanks.

On 7/9/07, Richard Goedeken [EMAIL PROTECTED] wrote:

Rene,

I have a dual core machine at home, and 4-way and 8-way machines at
work.  I can get and build the SVN trunk; just email me the code or
instructions.

Richard


René Dudfield wrote:
 Hello,

 if someone has a multicore, or multi cpu system... can you please test
 some code for me?

 I'm trying to get some code into pygame to make it work better for
 multicore machines... but I need to test it some more.

 You'll need to be able to compile subversion pygame.


 Cheers,





Re: [pygame] playing a list of songs

2007-07-08 Thread Dave LeCompte (really)
Jason Coggins [EMAIL PROTECTED] wrote:
 I am having trouble figuring out how to play a list of .mp3 files.  I have
 tried using the for loop to cycle through the list but it repeatedly
 starts
 playing the first song in the list but never gets to the end of the song
 before it starts playing it again.

Two things you could do:

1) use pygame.mixer.music.play() to play the first song, and then
immediately use pygame.mixer.music.queue() on the remaining songs in your
list.

2) periodically call pygame.mixer.music.get_busy() to check to see if the
current song has finished, then play() another song.


-Dave LeCompte


Re: [pygame] File Copying

2007-07-08 Thread Ian Mallett

Yes, I know, it just seems a little weird- text with no return function?
I'm probably just used to notepad and similar programs.

On 7/8/07, Luke Paireepinart [EMAIL PROTECTED] wrote:


Ian Mallett wrote:
 OK, that too bad.  I don't suppose pygame has a suggestion box.
 (Other than that in the docs).
You could easily write a class that did multi-line text.
That's probably why it's not included in Pygame.
All the text processing you need to do - centering text, word-wrap, etc.
- are all things you do yourself
in python, and you pass the text for each line after it's been processed
to the font rendering.
Part of the reason for this is probably because that's how SDL does it.
HTH,
-Luke

 On 7/8/07, *Luke Paireepinart*  [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Ian Mallett wrote:
  New issue:  If I do something like:
 
  font = pygame.font.SysFont(Times New Roman, 12)
  FontObject = font.render(this is line 1
  this is line 2
  this is line 3, 1, (255,255,255), (3,3,3))
  surface.blit(FontObject, (0,0))
 
  instead of putting a newline thing it puts a rectangle and a
 space.  I
  remember the docs saying to do it that way though...
 The font object's render method doesn't do newlines.
 It says that in the docs.
 You have to render each line of text seperately.
 -Luke






Re: [pygame] duration of song

2007-07-08 Thread Ian Mallett

http://www.pygame.org/docs/ref/mixer.html#Sound.get_length

On 7/8/07, Jason Coggins [EMAIL PROTECTED] wrote:


Does anyone know of a method to determine how long (in time) a music file
is?

Jason




Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Jasper
Using openGL for 2D allows you to take advantage of 3D graphics cards 
for smooth scrolling and zooming, or to tilt otherwise 2D game boards 
into 2D.  I also suspect that it'll let you handle more objects on the 
screen at once (especially if they're duplicates), although I haven't 
done comparison tests for this.


I posted some code along these lines several years ago, extended from 
something that Bob Ippolito had posted earlier.  Search through the 
archives and you should come across something.  If there is enough 
interest, I can also post my more recent code, but it's a bit more 
special case, lacking in simple examples, and probably more involved 
than someone new to OpenGL is looking for (it includes things like 
texture tiling, texture animation, billboarding, display list 
optimization, etc).


The NeHe tutorials are pretty good (even though their programming style 
is weak).  You only really need the first 10 or so to get started; 
afterwards you can look at the later ones and still follow what they're 
doing, even if they aren't in Python.


-Jasper

Ian Mallett wrote:
Try looking at glOrtho2D() or something like that...  Why do you want 
to use PyOpenGL for 2D-ness?  It's much better suited to 3D stuff.  
I've always found it easier to use pygame for 2D games.  Oh, and 
ummm...  Don't tell Silicon Graphics, but I've found pygame is much 
much faster at 2D.


On 7/7/07, *Charles Joseph Christie II* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


So, I'm trying to find a single good newbie tutorial for using
PyOpenGL for 2D
graphics. I haven't found a single one yet, although I have found
a few that
focus on C++. Some people recommended that I take a look at the NEHE
tutorials that were re-coded in python on the python page, but
those only go
from 1 to 10. Does anyone know where I could find a good starting
point (it
doesn't have to be a super-noobish tutorial, just something to give me
examples on how to start) for using PyOpenGL in conjunction with
Pygame for
making something?






Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Greg Ewing

Ian Mallett wrote:
Don't tell Silicon Graphics, but I've found pygame is much much faster 
at 2D.


That's rather surprising, assuming you have hardware acceleration.

It probably has to do with how you're sending the coordinates
to OpenGL. Making lots of calls to glVertex() from Python will
be inefficient, even more so than it would in C, due to the
slowness of Python function calls.

Putting your coordinates into an array and using one of the
array-oriented calls ought to be a lot better.

Another useful technique is to put frequently-used sequences
of operations into display lists, then you can invoke them
with just a single Python call.

--
Greg


Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread JoN
Quoting Jasper [EMAIL PROTECTED]:

 Greg Ewing wrote:
  Another useful technique is to put frequently-used sequences
  of operations into display lists, then you can invoke them
  with just a single Python call.
 This last optimization gave me my biggest improvement in OpenGL speed, 
 dramatically increasing the FPS when drawing lots of identical sprites.  
 It ended up being the only optimization I needed.
 
 -Jasper
 

Gives you an idea of the hoops game-houses go through to squeeze every drop of
performance out of big scenes, eh!

Jon




Come and visit Web Prophets Website at http://www.webprophets.net.au



Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Charles Joseph Christie II
On Sunday 08 July 2007 09:09:23 pm Dave LeCompte (really) wrote:
 Greg Ewing [EMAIL PROTECTED] wrote:
  Making lots of calls to glVertex() from Python will
  be inefficient, even more so than it would in C, due to the
  slowness of Python function calls.

 And it's not just the Python function calls (which we know are slow) - the
 PyOpenGL wrapper actually does error checking for you on every call, so it
 can raise an assertion if something goes wrong. The overhead of this error
 checking adds to the function call slowness.

 Even more reason to use display lists or otherwise group your data.


 -Dave LeCompte

All of this information is very helpful! I'm glad I asked you guys ;)

I've downloaded the Python version of NeHe 1-10,  and I'll take a look at it 
soon.

One of the reasons I wanted to get into OpenGL, although I probably won't be 
learning it until A LOT later, is things like particle effects and other 
types of visual effects (I know a lot of people who used Direct3D in their 2D 
games to do such things), and plus I had assumed that OpenGL draws more 
things much quicker if you have Direct Rendering and code it properly.

Plus, I'm learning 3D modeling and, although 3D graphics for games don't seem 
as good as well polished 2D graphics to me, I'd like to at least experiment 
with the idea as soon as I stop sucking at Blender. Plus, if I ever want to 
make that Tetris Attack clone (in the far future) with the 3D mode, well, it 
has to be in 3D :P

Also, kinda off-topic, I've found an idea for my first game that is so simple, 
that even I can't screw it up.
...I think. (Plus, the game is awesomely addictive)
http://jayisgames.com/archives/2007/05/speed_cluster_2.php

A simple game concept, yes? I think I could do it. I'm positive, in fact. I 
could practice all sorts of simple concepts, like randomization, 2D graphics, 
simple logic, and different types of input, like keyboard and mouse. Oh, and 
I can finally learn how to make a menu. I still have no clue how to do that 
(or make any other screens, scenes and popup menus in games).


Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Ian Mallett

On 7/8/07, Jasper [EMAIL PROTECTED] wrote:


Ian Mallett wrote:
 On 7/8/07, *Jasper* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

 Using openGL for 2D allows you to take advantage of 3D graphics
cards
 for smooth scrolling and zooming, or to tilt otherwise 2D game
boards
 into 2D.  I also suspect that it'll let you handle more objects on
the
 screen at once (especially if they're duplicates), although I
haven't
 done comparison tests for this.


 into 3D, but yes.

Right, sorry about that.



OK, just making sure :-)

Also, to chime in with further posts after the one I replied to:

In my experience OpenGL also performs vastly better than straight SDL.
I routinely have hundreds of sprites on screen animated at 60 FPS, even
while smoothly zooming/panning large textured maps, which SDL just
doesn't handle.

-Jasper



Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Ian Mallett

Yes, display lists were the single thing that increased my speed as well-
tripling it to over 60fps with huge maps and objects with my thousands of
quads (I really must start using triangles).

On 7/8/07, Dave LeCompte (really) [EMAIL PROTECTED] wrote:


Greg Ewing [EMAIL PROTECTED] wrote:

 Making lots of calls to glVertex() from Python will
 be inefficient, even more so than it would in C, due to the
 slowness of Python function calls.

And it's not just the Python function calls (which we know are slow) - the
PyOpenGL wrapper actually does error checking for you on every call, so it
can raise an assertion if something goes wrong. The overhead of this error
checking adds to the function call slowness.

Even more reason to use display lists or otherwise group your data.


-Dave LeCompte



[pygame] Testing if a File Exists

2007-07-08 Thread Ian Mallett

Hi,
Exactly what it sounds like.  Using pygame.image.load([file]) will return
an error if the file doesn't exist.  How do you test if it exists without
actually loading it, and without crashing?  Thanks.
Ian


Re: [pygame] Testing if a File Exists

2007-07-08 Thread John Eikenberry
Ian Mallett wrote:

 Hi,
 Exactly what it sounds like.  Using pygame.image.load([file]) will return
 an error if the file doesn't exist.  How do you test if it exists without
 actually loading it, and without crashing?  Thanks.

os.path.exists(path)

http://docs.python.org/lib/module-os.path.html

-- 

John Eikenberry
[EMAIL PROTECTED] - http://zhar.net]
__
It is difficult to produce a television documentary that is both incisive
and probing when every twelve minutes one is interrupted by twelve dancing
rabbits singing about toilet paper. - Rod Serling



Re: [pygame] Testing if a File Exists

2007-07-08 Thread Ian Mallett

So, how exactly do try/except things work?  I've seen them in various
programs but I dn't know what they really do.  I was just about to ask, and
this seemed the perfect opportunity...

On 7/8/07, Dave LeCompte (really) [EMAIL PROTECTED] wrote:


John Eikenberry [EMAIL PROTECTED] wrote:
 Ian Mallett wrote:

 Hi,
 Exactly what it sounds like.  Using pygame.image.load([file]) will
 return
 an error if the file doesn't exist.  How do you test if it exists
 without
 actually loading it, and without crashing?  Thanks.

 os.path.exists(path)

 http://docs.python.org/lib/module-os.path.html

Some consider it more pythonic to just try the call and deal with the
exception:

try:
  pygame.image.load(imagefile)
except pygame.error:
  # handle the error here


-Dave LeCompte



Re: [pygame] Testing if a File Exists

2007-07-08 Thread Charles Joseph Christie II
On Sunday 08 July 2007 10:17:06 pm Ian Mallett wrote:
 So, how exactly do try/except things work?  I've seen them in various
 programs but I dn't know what they really do.  I was just about to ask, and
 this seemed the perfect opportunity...

 On 7/8/07, Dave LeCompte (really) [EMAIL PROTECTED] wrote:
  John Eikenberry [EMAIL PROTECTED] wrote:
   Ian Mallett wrote:
   Hi,
   Exactly what it sounds like.  Using pygame.image.load([file]) will
   return
   an error if the file doesn't exist.  How do you test if it exists
   without
   actually loading it, and without crashing?  Thanks.
  
   os.path.exists(path)
  
   http://docs.python.org/lib/module-os.path.html
 
  Some consider it more pythonic to just try the call and deal with the
  exception:
 
  try:
pygame.image.load(imagefile)
  except pygame.error:
# handle the error here
 
 
  -Dave LeCompte

Try and except: Try to execute the command. If it works, it works. If an 
exception is raised, instead execute the command in the except block.


Re: [pygame] Testing if a File Exists

2007-07-08 Thread Ian Mallett

Alright, got it.  Thanks!

On 7/8/07, Charles Joseph Christie II [EMAIL PROTECTED] wrote:


On Sunday 08 July 2007 10:17:06 pm Ian Mallett wrote:
 So, how exactly do try/except things work?  I've seen them in various
 programs but I dn't know what they really do.  I was just about to ask,
and
 this seemed the perfect opportunity...

 On 7/8/07, Dave LeCompte (really) [EMAIL PROTECTED] wrote:
  John Eikenberry [EMAIL PROTECTED] wrote:
   Ian Mallett wrote:
   Hi,
   Exactly what it sounds like.  Using pygame.image.load([file])
will
   return
   an error if the file doesn't exist.  How do you test if it exists
   without
   actually loading it, and without crashing?  Thanks.
  
   os.path.exists(path)
  
   http://docs.python.org/lib/module-os.path.html
 
  Some consider it more pythonic to just try the call and deal with
the
  exception:
 
  try:
pygame.image.load(imagefile)
  except pygame.error:
# handle the error here
 
 
  -Dave LeCompte

Try and except: Try to execute the command. If it works, it works. If an
exception is raised, instead execute the command in the except block.



Re: [pygame] File Copying

2007-07-08 Thread Ethan Glasser-Camp
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave LeCompte (really) wrote:
 It's pretty simple to split your string on carriage returns (and/or line
 feeds), create surfaces for each line of text, and blit those surfaces to
 the destination surface.

But this would be a nice addition to pygame, as I'm sure a lot of
games do it. Maybe combine with
http://www.pygame.org/wiki/TextWrapping?parent=CookBook ?

Ethan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGkaZShRlgoLPrRPwRAlVaAJ99H+vWEXq0rmua/nWIeJCqx5uOaACgk+F/
yB/hnzqo17jR5jKPhUfX4vs=
=24kD
-END PGP SIGNATURE-


Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread kschnee
On Mon, July 9, 2007 12:51 am, Jasper wrote:
 Using openGL for 2D allows you to take advantage of 3D graphics cards
 for smooth scrolling and zooming, or to tilt otherwise 2D game boards into
 2D.  I also suspect that it'll let you handle more objects on the
 screen at once (especially if they're duplicates), although I haven't done
 comparison tests for this.

I came across a set of tutorials besides NeHe that are worth referring to,
but I've not got the link on me at the moment.

I'm probably repeating myself, but:

I've been interested in using OpenGL with Pygame for some time, and got to
the point of writing a cube-based rotating landscape and a
triangle-based textured landscape with a billboarded sprite.
Unfortunately, I found that I didn't know how to combine OpenGL 3D
graphics with any sort of 2D graphics operations, since you can't just
draw an OpenGL screen and then use Pygame graphics functions to paint atop
it. That means no interface and no text, hence no game. I've tried several
times to use various libraries purportedly for doing that sort of thing,
but have not been able to make any of them work in the limited time
available to me, especially using Windows and my homebrew GUI module.
Every so often I go at it and give up again.

What I'd like is a stupidly simple textured 3D landscape with billboarded
sprites, maybe even viewed from a constant camera angle, with a
decent-looking skybox and an easy way to draw my interface atop that. I'd
even be happy using a flat landscape, ie. a plane that can be tilted and
zoomed. The particular requirements of my game do require, though, that I
load a really big array of heights at once, or be able to load new points
on the fly. For now I've got a working Pygame 2D system using tiles.

What do you think of PyOgre? I haven't looked into it lately, but the last
time I worked with it:
-Creating a small landscape with a nice sky was easy
-The official interface system, CEGUI, wasn't working in Python and I had
to cobble together a barely-working UI of my own
-It wasn't clear to me how to do sprites

When working with 3D there's also the concern with the use of sprites vs.
3D characters. The latter seem to be a lot harder to do, and don't look as
good for the same level of skill.



Re: [pygame] File Copying

2007-07-08 Thread Ian Mallett

On 7/8/07, Ethan Glasser-Camp [EMAIL PROTECTED] wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave LeCompte (really) wrote:
 It's pretty simple to split your string on carriage returns (and/or line
 feeds), create surfaces for each line of text, and blit those surfaces
to
 the destination surface.

But this would be a nice addition to pygame, as I'm sure a lot of
games do it. Maybe combine with
http://www.pygame.org/wiki/TextWrapping?parent=CookBook ?



I second that.

Ethan

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGkaZShRlgoLPrRPwRAlVaAJ99H+vWEXq0rmua/nWIeJCqx5uOaACgk+F/
yB/hnzqo17jR5jKPhUfX4vs=
=24kD
-END PGP SIGNATURE-



Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Ian Mallett

Never tried that...  The way I do 2D interfaces is to draw them after
everything else at the near clipping plane after a call to glLoadIdentity()

On 7/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


On Mon, July 9, 2007 12:51 am, Jasper wrote:
 Using openGL for 2D allows you to take advantage of 3D graphics cards
 for smooth scrolling and zooming, or to tilt otherwise 2D game boards
into
 2D.  I also suspect that it'll let you handle more objects on the
 screen at once (especially if they're duplicates), although I haven't
done
 comparison tests for this.

I came across a set of tutorials besides NeHe that are worth referring to,
but I've not got the link on me at the moment.

I'm probably repeating myself, but:

I've been interested in using OpenGL with Pygame for some time, and got to
the point of writing a cube-based rotating landscape and a
triangle-based textured landscape with a billboarded sprite.
Unfortunately, I found that I didn't know how to combine OpenGL 3D
graphics with any sort of 2D graphics operations, since you can't just
draw an OpenGL screen and then use Pygame graphics functions to paint atop
it. That means no interface and no text, hence no game. I've tried several
times to use various libraries purportedly for doing that sort of thing,
but have not been able to make any of them work in the limited time
available to me, especially using Windows and my homebrew GUI module.
Every so often I go at it and give up again.

What I'd like is a stupidly simple textured 3D landscape with billboarded
sprites, maybe even viewed from a constant camera angle, with a
decent-looking skybox and an easy way to draw my interface atop that. I'd
even be happy using a flat landscape, ie. a plane that can be tilted and
zoomed. The particular requirements of my game do require, though, that I
load a really big array of heights at once, or be able to load new points
on the fly. For now I've got a working Pygame 2D system using tiles.

What do you think of PyOgre? I haven't looked into it lately, but the last
time I worked with it:
-Creating a small landscape with a nice sky was easy
-The official interface system, CEGUI, wasn't working in Python and I had
to cobble together a barely-working UI of my own
-It wasn't clear to me how to do sprites

When working with 3D there's also the concern with the use of sprites vs.
3D characters. The latter seem to be a lot harder to do, and don't look as
good for the same level of skill.




Re: [pygame] Using PyOpenGL for 2D graphics

2007-07-08 Thread Peter Nicolai

check out Opioid2D

On 7/8/07, Ian Mallett [EMAIL PROTECTED] wrote:

Never tried that...  The way I do 2D interfaces is to draw them after
everything else at the near clipping plane after a call to glLoadIdentity()


On 7/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 On Mon, July 9, 2007 12:51 am, Jasper wrote:
  Using openGL for 2D allows you to take advantage of 3D graphics cards
  for smooth scrolling and zooming, or to tilt otherwise 2D game boards
into
  2D.  I also suspect that it'll let you handle more objects on the
  screen at once (especially if they're duplicates), although I haven't
done
  comparison tests for this.

 I came across a set of tutorials besides NeHe that are worth referring to,
 but I've not got the link on me at the moment.

 I'm probably repeating myself, but:

 I've been interested in using OpenGL with Pygame for some time, and got to
 the point of writing a cube-based rotating landscape and a
 triangle-based textured landscape with a billboarded sprite.
 Unfortunately, I found that I didn't know how to combine OpenGL 3D
 graphics with any sort of 2D graphics operations, since you can't just
 draw an OpenGL screen and then use Pygame graphics functions to paint atop
 it. That means no interface and no text, hence no game. I've tried several
 times to use various libraries purportedly for doing that sort of thing,
 but have not been able to make any of them work in the limited time
 available to me, especially using Windows and my homebrew GUI module.
 Every so often I go at it and give up again.

 What I'd like is a stupidly simple textured 3D landscape with billboarded
 sprites, maybe even viewed from a constant camera angle, with a
 decent-looking skybox and an easy way to draw my interface atop that. I'd
 even be happy using a flat landscape, ie. a plane that can be tilted and
 zoomed. The particular requirements of my game do require, though, that I
 load a really big array of heights at once, or be able to load new points
 on the fly. For now I've got a working Pygame 2D system using tiles.

 What do you think of PyOgre? I haven't looked into it lately, but the last
 time I worked with it:
 -Creating a small landscape with a nice sky was easy
 -The official interface system, CEGUI, wasn't working in Python and I had
 to cobble together a barely-working UI of my own
 -It wasn't clear to me how to do sprites

 When working with 3D there's also the concern with the use of sprites vs.
 3D characters. The latter seem to be a lot harder to do, and don't look as
 good for the same level of skill.