Ticket #8106: sdl_gl.2.diff

File sdl_gl.2.diff, 2.4 KB (added by SF/luke_br, 22 years ago)

Color depth problem fixed

Line 
158,59c58,59
2< SDL_Surface *glEnd; // Black rectangle at end of the GL screen
3< SDL_Rect blackrect2; // Needed for blitting the above surface
4---
5> SDL_Surface *tmpSurface; // Used for black rectangles blitting
6> SDL_Rect tmpBlackRect; // Black rectangle at end of the GL screen
7210a211,218
8> uint32 Rmask, Gmask, Bmask, Amask;
9> // I have to force 16 bit color depth with 565 ordering
10> // SDL_SetVideoMode sometimes doesn't accept your color depth definition
11> Rmask = 0xF800; // 5
12> Gmask = 0x07E0; // 6
13> Bmask = 0x001F; // 5
14> Amask = 0;
15>
16231,239c239
17< // SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
18< // if (fb2gl.screen->format->Rmask == 0x7C00)
19< // SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
20< // else
21< // SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 6 );
22< // SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
23< // SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
24<
25< int gl_flags = FB2GL_320 | FB2GL_RGBA | FB2GL_EXPAND;
26---
27> int gl_flags = FB2GL_320 | FB2GL_RGBA | FB2GL_16BIT;
28255,258c255,258
29< fb2gl.screen->format->Rmask,
30< fb2gl.screen->format->Gmask,
31< fb2gl.screen->format->Bmask,
32< fb2gl.screen->format->Amask);
33---
34> Rmask,
35> Gmask,
36> Bmask,
37> Amask);
38260c260,262
39< glEnd = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth,
40---
41> fprintf(stderr,"bits: %d\n",sdl_tmpscreen->format->BitsPerPixel);
42>
43> tmpSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth,
44264,272c266,274
45< fb2gl.screen->format->Rmask,
46< fb2gl.screen->format->Gmask,
47< fb2gl.screen->format->Bmask,
48< fb2gl.screen->format->Amask);
49<
50< blackrect2.x = 0;
51< blackrect2.y = 0;
52< blackrect2.w = _screenWidth;
53< blackrect2.h = 256-_screenHeight-_screenStart;
54---
55> Rmask,
56> Gmask,
57> Bmask,
58> Amask);
59>
60> tmpBlackRect.x = 0;
61> tmpBlackRect.y = 0;
62> tmpBlackRect.w = _screenWidth;
63> tmpBlackRect.h = 256-_screenHeight-_screenStart;
64308,310c310,312
65< SDL_FillRect(sdl_tmpscreen, &blackrect, 0);
66<
67< fb2gl.blit16(sdl_tmpscreen,1,&blackrect,0,0);
68---
69>
70> SDL_FillRect(tmpSurface, &blackrect, 0);
71> fb2gl.blit16(tmpSurface,1,&blackrect,0,0);
72365,366c367,368
73< SDL_FillRect(glEnd, &blackrect2, 0);
74< fb2gl.blit16(glEnd,1,&blackrect2,0,_screenHeight+_screenStart);
75---
76> SDL_FillRect(tmpSurface, &tmpBlackRect, 0);
77> fb2gl.blit16(tmpSurface,1,&tmpBlackRect,0,_screenHeight+_screenStart);