[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] 3D sample code



 
My previous response indicated that the Lamina demo should work with an installed Ocemp GUI.  Actually, it will not work with the 0.2 version, but needs the 0.1 version;  It needs the dirty-rectangle list from update, to know when to regenerate the texture.  Marcus does maintain both versions.
 
Would an example without a GUI, using regular pygame 2d drawing methods, be helpful?  
 
David
 
On 6/11/07, David <dvkeeney@xxxxxxxxx> wrote:
 
Kris, thank you for trying Lamina.
 
la.py is at:
http://pitchersduel.python-hosting.com/file/branches/Spyre/la.py
 
It is a vector library.  I should add it to the distribution archive for Lamina.
 
My docs could be clearer, but 'GUI_Constructor()' refers to whatever constructor your GUI library uses. 
 
Import your gui library, then call its own gui constructor in lieu of the 'GUI_Constructor' line.  The 'gui.draw()' line also
needs tailoring to match the rendering method of your chosen gui.   If you have either Ocemp or PGU gui's installed,
one of the included demos should work (with the addition of the la library).
 
My apologies for the missing file.
 
David

 
On 6/8/07, kschnee@xxxxxxxxxx < kschnee@xxxxxxxxxx> wrote:
On Fri, June 8, 2007 1:09 pm, David wrote:
>> You're right that you cant use any of the regular SDL drawing functions
>>  with OpenGL - or any other accelarated 3D API. You can work with 2D
>> graphics in OpenGL though, by drawing texture quads. If you wrap that in
>> a simplified interface, then the code doesn't look much different from
>> what you are used to in 2D PyGame.
>>
>
>
> For such a simplified interface, you might find Lamina useful.
>
>
> http://cheeseshop.python.org/pypi/Lamina/0.1.2

It does sound useful. When I tried the demos, though, they said "no module
named la." I figured this might mean "lamina," but changing it to that
didn't help. Then I thought it might be something from OcempGUI (which I
don't have installed), so I tried running a very basic demo:

<code>
## Hacked-together Lamina test

import lamina
from pygame import display, key, init, event
from pygame import time as pytime
from pygame.locals import *
import OpenGL.GL as ogl
import OpenGL.GLU as oglu

# create gui with appropriate constructor
gui = GUI_Constructor()

# create LaminaPanelSurface
gui_screen = lamina.LaminaPanelSurface( (640,480), (-1,1,2,2) )

# draw widgets on surface
gui.draw( gui_screen.surf )
</code>

Result:
Traceback (most recent call last):
File "C:/Documents and Settings/Owner/Desktop/lamina/lamina_test_k.py",
line 12, in ?
   gui = GUI_Constructor()
NameError: name 'GUI_Constructor' is not defined

That happens even with spyre and lamina in the same directory.




--
dkeeney@xxxxxxxxxxxxxxxx
Pitcher's Duel -> pitchersduel.python-hosting.com



--
dkeeney@xxxxxxxxxxxxxxxx
Pitcher's Duel -> pitchersduel.python-hosting.com