Re: [pygame] OpenGL stretch of a pygame.Surface

2014-07-30 Thread VertPingouin
Ok I now create my texture once.

I'm having some issues with this

> You're creating an extra copy of the texture data here.
> To avoid that, you could use surfarray to create a surface
> backed by a numpy array, do your drawing into that, and
> then pass the numpy array directly to glTexImage2D.

As I understand it, you suggest a surface with a surfarray.pixel2d bound
to it. But I can't blit on such surface beacause it's locked. Did you
mean drawing directly in surfarray or just create and update a
surfarray.2darray which involve to do a copy of the native screen also ?


Thanks for all your advises everyone. 


Le mercredi 30 juillet 2014 à 11:15 +1200, Greg Ewing a écrit :
> sylvain.boussekey wrote:
>  > I managed to do it in opengl but perfs are poor.
> 
> A few things to consider:
> 
>  > textureData = pygame.image.tostring(textureSurface, "RGBA", 1)
> 
> * You're creating an extra copy of the texture data here.
> To avoid that, you could use surfarray to create a surface
> backed by a numpy array, do your drawing into that, and
> then pass the numpy array directly to glTexImage2D.
> 
>  > texture = glGenTextures(1)
>  > glBindTexture(GL_TEXTURE_2D, texture)
>  > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
>  > glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
> 
> * You're creating a new OpenGL texture for each frame and
> then discarding it. Try making these calls just once
> at the beginning and re-using the texture.
> 
> * You're using a non-power-of-2 texture size. Not all
> OpenGL implementations support that; yours seemingly does,
> but it might be less efficient than a power-of-2 size.
> You could try allocating the next larger power-of-2 size and
> updating the part that you use with glTexSubImage2D().
> 




[pygame] Missing Module and Font

2014-07-30 Thread diliup gabadamudalige
Dear Peter or anyone else who can help me,

I downloaded

   - pygame-1.9.2a0.win32-py2.7.msi
    6.4MB

from the Pygmaesite and everything runs smoothly. I can comile using py2exe
without any error. BUT I CANNOT import pygame.freetype. Gives me the
following error.
ImportError: No module named freetype

Now when I download Pygame from the link below
https://bitbucket.org/pygame/pygame/downloads

I can do import pygame.freetype but whn I compile the program using py2exe
I get an error
import pygame._view error. module not found.

Please help as this is causing a LOT of preoblems and I am stuck between
the view module and the freefont. Kind of uncomfortable here so please help
me.

Thank you very much in advance.
-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**