You’re creating a hardware surface. Typically, surface->pixels is NULL for
hardware surfaces. SDL doesn’t know there is anything there, nor will it
look for data there.
Try SDL_LockSurface() it, copy the data to surface->pixels (e.g. memcpy())
and then SDL_UnlockSurface(). The last 4 parameters to
SDL_CreateRGBSurface() look like they are probably wrong.On 7 October 2010 08:35, Force wrote:
It’s not working, what’s the way to achieve this?
Thank you
Got the image on the screen, but as you said the last 4 parameters are wrong. If I put all to 255, it gives me a black/white version of the image. I don’t know how to put these 4 values. I checked this (http://www-f9.ijs.si/~matevz/docs/DevIL/il/f00027.htm) but I don’t see anything there other than format.
I’ve never used devIL so I don’t know if you can obtain this
information from it or whether it assumes a reasonable default.On 7 October 2010 11:08, Force wrote:
Got the image on the screen, but as you said the last 4 parameters are
wrong. If I put all to 255, it gives me a black/white version of the image.
I don’t know how to put these 4 values. I checked this but I don’t see
anything there other than format.
I’ve never used devIL so I don’t know if you can obtain this
information from it or whether it assumes a reasonable default.
On 7 October 2010 11:08, Force wrote:
Got the image on the screen, but as you said the last 4 parameters are
wrong. If I put all to 255, it gives me a black/white version of the
image.
I don’t know how to put these 4 values. I checked this but I don’t see
anything there other than format.
Looks like you want to use ilCopyPixels( ILuint XOff, ILuint YOff, ILuint
ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type,
ILvoid *Data);
-OzOn Thu, Oct 7, 2010 at 6:15 AM, Brian Barrett <brian.ripoff at gmail.com>wrote:
I’ve never used devIL so I don’t know if you can obtain this
information from it or whether it assumes a reasonable default.
On 7 October 2010 11:08, Force wrote:
Got the image on the screen, but as you said the last 4 parameters are
wrong. If I put all to 255, it gives me a black/white version of the
image.
I don’t know how to put these 4 values. I checked this but I don’t see
anything there other than format.
Setting the mask values or rgba to zero will force SDL to automatically fill
in those values, while zero’ing the alpha channel (you can re-add that if
you need to). The new documentation doesn’t note that, but it’s still the
case in SDL 1.3
for your copy code:
ilCopyPixels( 0, 0, 0, SDLImage->w, SDLImage->h, 1, IL_RGBA,
SDLImage->pixels );
You had one too many IL_RGBA in there.
Take care,
-AlexOn Thu, Oct 7, 2010 at 10:47 AM, Force wrote:
for your copy code:
ilCopyPixels( 0, 0, 0, SDLImage->w, SDLImage->h, 1, IL_RGBA, SDLImage->pixels );
You had one too many IL_RGBA in there.
Yes, because I got the “too few arguments” error. You had missed format or type parameter in that function. I just duplicated IL_RGBA to pass that error. So that function still doesn’t work. :)[/quote]
Oops, sorry, I forgot a param - it happens, I guess.
I hope that fixes things,
-AlexOn Thu, Oct 7, 2010 at 11:49 PM, Force wrote:
Quote:
for your copy code:
ilCopyPixels( 0, 0, 0, SDLImage->w, SDLImage->h, 1, IL_RGBA,
SDLImage->pixels );
You had one too many IL_RGBA in there.
Yes, because I got the “too few arguments” error. You had missed format or
type parameter in that function. I just duplicated IL_RGBA to pass that
error. So that function still doesn’t work. [image: Smile][/quote]