Re: [hlcoders] Help with HL1 SPR file format

2005-02-25 Thread Rodrigo 'r2d2rigo' Diaz
Thanks, I discovered that thing a while ago! Sprite data are
references to palette colours, and I thought they were RGB triplets :)


On Thu, 24 Feb 2005 21:00:42 +, Philip Searle
[EMAIL PROTECTED] wrote:
 Rodrigo 'r2d2rigo' Diaz wrote:
  Hi, I want to load a SPR file to use it as a texture in one OpenGL
  program. I have based my code from the one in sprgen.c. For testing,
  I'm using a single frame 256*256 sprite, and I follow this order for
  reading the data:
  -1 struct dsprite_t (sprite header)
  -1 short (# of palette indexes - 256)
  -256 bytes (colours of the palette indexes)
  -1 struct spriteframetype_t (frame type - single or multiple)
  -1 struct dspriteframe_t (sprite frame header)
  -dspriteframe_t-height*dspriteframe_t-width bytes (height*width
  bytes - sprite frame data)
  And then I create the texture with glTexImage2D. The problem is the
  final texture gets messy; did I miss something? Is there any
  documentation about SPR file format?

 I'm not sure whether this was a typo, but the palette is actually 256*3
 bytes (red, green and blue).

 ___
 To unsubscribe, edit your list preferences, or view the list archives, please 
 visit:
 http://list.valvesoftware.com/mailman/listinfo/hlcoders



___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



[hlcoders] Help with HL1 SPR file format

2005-02-24 Thread Rodrigo 'r2d2rigo' Diaz
Hi, I want to load a SPR file to use it as a texture in one OpenGL
program. I have based my code from the one in sprgen.c. For testing,
I'm using a single frame 256*256 sprite, and I follow this order for
reading the data:
-1 struct dsprite_t (sprite header)
-1 short (# of palette indexes - 256)
-256 bytes (colours of the palette indexes)
-1 struct spriteframetype_t (frame type - single or multiple)
-1 struct dspriteframe_t (sprite frame header)
-dspriteframe_t-height*dspriteframe_t-width bytes (height*width
bytes - sprite frame data)
And then I create the texture with glTexImage2D. The problem is the
final texture gets messy; did I miss something? Is there any
documentation about SPR file format?

___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Help with HL1 SPR file format

2005-02-24 Thread Philip Searle
Rodrigo 'r2d2rigo' Diaz wrote:
Hi, I want to load a SPR file to use it as a texture in one OpenGL
program. I have based my code from the one in sprgen.c. For testing,
I'm using a single frame 256*256 sprite, and I follow this order for
reading the data:
-1 struct dsprite_t (sprite header)
-1 short (# of palette indexes - 256)
-256 bytes (colours of the palette indexes)
-1 struct spriteframetype_t (frame type - single or multiple)
-1 struct dspriteframe_t (sprite frame header)
-dspriteframe_t-height*dspriteframe_t-width bytes (height*width
bytes - sprite frame data)
And then I create the texture with glTexImage2D. The problem is the
final texture gets messy; did I miss something? Is there any
documentation about SPR file format?
I'm not sure whether this was a typo, but the palette is actually 256*3
bytes (red, green and blue).
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders