компиляция в порядке, но программа остановлена в этой функции. У меня есть версия для Win, и она работает нормально, но когда я делаю версию для Mac, он получает это исключение: (
int Reconstruct(int rez)
{ //here is program stopped!!!!</p>
<p>static SDL_Surface *projekce;
static SDL_Surface *sc;
static SDL_Surface *rek;</p>
<p>projekce = SDL_CreateRGBSurface(SDL_SWSURFACE,240,240, 32,0,0,0,0);
sc = SDL_CreateRGBSurface(SDL_SWSURFACE, 400, 400, 32, 0, 0, 0, 0);
// Create two arrays of unsigned bytes (chars). 4 bytes per pixel (RGBA)
unsigned char *pixels[400 * 400 * 4];
unsigned char *pixelsbuf[400 * 400 * 4];</p>
<p>glGenTextures(1, &gl_texture);// generate one texture
glBindTexture(GL_TEXTURE_2D, gl_texture);// Set the texture</p>
<p>// Set the texture filters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); </p>
<p>int angle = 0;
int snimek = 0;
int i, j, k, l;// promene pro cykly</p>
<p>for(i=0;i<88;i++)
{ </p>
<p>char nazev[25] = "OUT/snimek";
itoa(snimek, CisloSnimku);
strcat(nazev,CisloSnimku);
strcat(nazev,".bmp");
rek = IMG_Load(nazev);
snimek++; </p>
<p>SDL_LockSurface(rek);
SDL_LockSurface(projekce); </p>
<p>//zkopiruj radek do snimku = vytvor snimek pro rotaci </p>
<p>for(j=0;j<240;j++)
{
if(j == 0) PixV1 = 0;
else
{
PixV1 = getpixel(rek,j-1,rez);
}
if(j == 239) PixV3 = 0;
else
{
PixV3 = getpixel(rek,j+1,rez);
}
PixV2 = getpixel(rek,j,rez);</p>
<p>SDL_GetRGB(PixV1,rek->format, &R, &G, &B);
//Gs1 = ((R * 21) + (G * 61) + (B * 174)) / 256; //preved do grayscale pro blue
Gs1 = ((R * 11) + (G * 174) + (B * 71)) / 256; //preved do grayscale pro green
Gs1 = 255 - Gs1; //invert
if (Gs1 < 50) Gs1 = 1;
SDL_GetRGB(PixV2,rek->format, &R, &G, &B);
//Gs2 = ((R * 21) + (G * 61) + (B * 174)) / 256; //preved do grayscale pro blue
Gs2 = ((R * 11) + (G * 174) + (B * 71)) / 256; //preved do grayscale pro green
Gs2 = 255 - Gs2; //invert
if (Gs2 < 50) Gs2 = 1;
SDL_GetRGB(PixV3,rek->format, &R, &G, &B);
//Gs3 = ((R * 21) + (G * 61) + (B * 174)) / 256; //preved do grayscale pro blue
Gs3 = ((R * 11) + (G * 174) + (B * 71)) / 256; //preved do grayscale pro green
Gs3 = 255 - Gs3; //invert
if (Gs3 < 50) Gs3 = 1;
//Gs = (Gs1*(1)) + (Gs2*(-4)) + (Gs3*(1)); //convolution GOOD
//Gs = (Gs1*(-1)) + (Gs2*(3)) + (Gs3*(-1)); //convolution </p>
<p>for(k=0;k<240;k++)
{
DrawPixel(projekce, j, k, Gs2, Gs2, Gs2);
}
}</p>
<p>SDL_UnlockSurface(rek);
SDL_UnlockSurface(projekce); </p>
<p>gluBuild2DMipmaps(GL_TEXTURE_2D, 3, projekce->w, projekce->h, GL_RGBA, GL_UNSIGNED_BYTE, projekce->pixels);<br>
angle += 360/88;<br>
Atlantis_Display(angle); </p>
<p>////////////////////////////////////////////////////////////////////////////</p>
<p>glReadPixels(0, 0, 400, 400, GL_RGBA, GL_UNSIGNED_BYTE, pixelsbuf);</p>
<p>////////////////////////////////////////////////////////////////////////////</p>
<p>SDL_LockSurface(sc);
SDL_LockSurface(final);</p>
<p>G1 = 0;
G = 0;
R = 0;
B = 0;</p>
<p>for(l=0;l<400;l++)
{
memcpy(pixels+(400-l-1)*400*4, pixelsbuf+l*400*4, 400*4);
sc->pixels = pixels;</p>
<p>for(j=0;j<400;j++)
{</p>
<code> PixelValue = getpixel(sc, j, l);
SDL_GetRGB(PixelValue, sc->format, &R, &G, &B);
PixelValue = getpixel(final, j, l);
SDL_GetRGB(PixelValue, final->format, &R1, &G1, &B1);
//pom = ((R/2)+(B/2)+(G*2));
G1 += (G/90);
DrawPixel(final, j, l, G1, G1, G1);
</code>
}
}
SDL_UnlockSurface (подкожно);
}
char fin [25] = "FIN / final";
Итоа (Рез, ЦислоСнимку);
strcat (плавник, CisloSnimku);
strcat (плавник, "ВМР.");
SDL_SaveBMP (final, fin);
SDL_UnlockSurface (конечный);
SDL_FreeSurface (конечная);
SDL_FreeSurface (подкожно);
SDL_FreeSurface (PROJEKCE);
SDL_FreeSurface (РЕК);
SDL_Quit ();
вернуть 0;
}