bug-guile-sdl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (Guile-SDL) Inspect pixel format objects


From: Thien-Thi Nguyen
Subject: Re: (Guile-SDL) Inspect pixel format objects
Date: Thu, 06 Jun 2013 19:08:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

() "Thompson, David" <address@hidden>
() Wed, 5 Jun 2013 08:51:36 -0400

   I haven't discovered any ways to inspect pixel format objects from
   Guile.

   Being able to read the attributes of this object, such as
   BytesPerPixel, is necessary to write a generic procedure for
   translating SDL surfaces into OpenGL textures.

   Have I missed some procedures? If not, would they be easy to add?

Everything is easy to add.  Most things, once added, are difficult to
remove, however.  :-D

So, the big question is: What kind of information do you need to do this
translation?  Here is the full struct definition (from SDL_video.h):

 /** Everything in the pixel format structure is read-only */
 typedef struct SDL_PixelFormat {
         SDL_Palette *palette;
         Uint8  BitsPerPixel;
         Uint8  BytesPerPixel;
         Uint8  Rloss;
         Uint8  Gloss;
         Uint8  Bloss;
         Uint8  Aloss;
         Uint8  Rshift;
         Uint8  Gshift;
         Uint8  Bshift;
         Uint8  Ashift;
         Uint32 Rmask;
         Uint32 Gmask;
         Uint32 Bmask;
         Uint32 Amask;
 
         /** RGB color key information */
         Uint32 colorkey;
         /** Alpha value information (per-surface alpha) */
         Uint8  alpha;
 } SDL_PixelFormat;

The dual of that question is: What fields can you live without?  (Please
pardon my ignorance of OpenGL; when i tried to run glxgears and SDLgears
(to gain some introductory experience), my X session crashed.  I need to
find a newer computer to hack on...)

Relatedly, is "generic translation" something that is performance
sensitive enough to be better done in C?  I see from:

 http://www.gamedev.net/topic/184477-sdl_surface-to-opengl-texture/

that someone suggests using ‘convert-surface’ directly, in which case
the question then becomes: How to specify the OpenGL texture format to
SDL?  Am i missing something?

-- 
Thien-Thi Nguyen
GPG key: 4C807502

Attachment: pgp3cz3uGIoPE.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]