On Sun, Jan 26, 2003 at 10:23:23AM +0100, Bertrand Lamy wrote:
> > I think the way to do this is to create a new structure called
> > P3_image in image.c and image.h, containing width, height, type, and
> > GLubyte* pixels.
> 
> I think the P3_image is quite useless and that you can directly use P3_material 
>instead (since images are only used for material. oups forgotten the font but it's a 
>minority)

And how about land.from_image? We already have three places where images
are used, and we will almost certainly have more. I think this justifies
an image object.

> Finaly maybe it's better to have a P3_image (but I will have to recode P3_image)
> 
> If you really want to have a P3_image use the following hackish definitions (we need 
>less modification like that ;-):
> 
> typedef struct {
>   int option;
>   int type;   /* GL_RGB or GL_RGBA or GL_LUMINANCE */
>   int width;
>   int height;
>   GLubyte* pixels;
> } P3_image;
> 
> typedef struct {
>   P3_SYSTEM_OBJECT_HEADER
>   int option;
>   int type;   /* GL_RGB or GL_RGBA or GL_LUMINANCE */
>   int width;
>   int height;
>   GLubyte* pixels;
>   GLuint id;  /* for glBindTexture */
>   GLfloat shininess;
>   GLfloat colors[8];  /* diffuse color r,g,b,a + specular color r,g,b,a */
>   P3_renderer_list* r_list;
> } P3_material;
> 
> #define P3_material_as_image(material) \
>   (&(material->option))
> 
> 
> According to me, the best way to do this is to superclass the PyP3Material_SetImage 
>function in material_python.c
> you can check the number of arguments given, if it's more than 1 (ie only a 
>filename) your suppose the user has given a string, width, height, type and flag
> 
> tell me if that's ok for you

My intent was to remove the image loading functionality from Soya
altogether, and if we still wanted to load an image automatically, do it
in Python using PIL and transfer it over via a string. I believe this
would still only end up making one copy rather than two, because I would
imagine PIL doesn't copy on tostring since strings are immutable.

If we do this, then these functions would no longer take a filename as
an argument.

> > if the data needs to be flipped upside down
> > (I believe this is needed between PIL and OpenGL?)
> 
> I don't know

Well, I can put the flag in anyway, just in case. It can't hurt anything
if people don't use it.

-- 
Sean Lynch http://sean.lynch.tv/

Attachment: msg00102/pgp00000.pgp
Description: PGP signature

Reply via email to