sdl render , with problems
http://fenixworld.se32.com/e107_plugins ... 2.m8ee.zip
draw colors not correctly :
please help us..
this is code :
---------------------------------
void RecuperarSuperficieDibujo(char *puntero, int pitch)//recupera el render y lo dibuja en SDL
{
int ancho= Mitextura->getSize ().Width;
int alto= Mitextura->getSize ().Height;
s16 *MiZbuffer=(s16 *)Mitextura->lock ();
/*
int x,y;
for (x=1;x<ancho;x++)
for (y=1;y<alto;y++)
((s16 *)puntero)[x + pitch*y] = A1R5G5B5toA8R8G8B8(((s16*)MiZbuffer)[y*ancho + x]);
*/
int destPitch = pitch;
//s16* destData = reinterpret_cast<s16*>(puntero);
char *destData = (puntero);
for (int x=0; x<ancho; ++x)
for (int y=0; y<alto; ++y)
if (x < ancho && y < alto)
{
s16 c = MiZbuffer[y*ancho +x];
destData[y* destPitch + x] =
((c >> 10)&0x1F)<<11 |
((c >> 5)&0x1F) << 6 |
((c)&0x1F);
}
Mitextura->unlock ();
}
SDL render
in where?
in that part ? please write the code ..hybrid wrote:Ok, in that case use 2*x to add.But be aware that this routine does not check the texture format, so you might meet very different formats as well.
thank you very much.
void Irrch2SDL(char *mypointer, int pitch)//draw in sdl
{
int width= Mitexture->getSize ().Width;
int height= Mitexture->getSize ().Height;
s16 *MiZbuffer=(s16 *)Mitexture->lock ();
/*
int x,y;
for (x=1;x<ancho;x++)
for (y=1;y<alto;y++)
((s16 *)mipointer)[x + pitch*y] = A1R5G5B5toA8R8G8B8(((s16*)MiZbuffer)[y*ancho + x]);
*/
int destPitch = pitch;
//s16* destData = reinterpret_cast<s16*>(puntero);
char *destData = (mypointer);
for (int x=0; x<width; ++x)
for (int y=0; y<height; ++y)
if (x < width && y < height)
{
s16 c = MiZbuffer[y*width +x];
destData[y* destPitch + x] =
((c >> 10)&0x1F)<<11 |
((c >> 5)&0x1F) << 6 |
((c)&0x1F);
}
Mitexture->unlock ();
}