J'utilise openGL/SDL pour faire de l'affichage 2d accéléré sous linux.

Cela fonctionne de façon quasi-parfaite, sauf avec les drivers radéon libres sous ubuntu dapper (aucun prob avec les drivers proprios nvidia/ati). Les textures se trouvent entourées d'un trait noir.

Pas de problème de bord noir lorsque je fait de la "3d pure".



Le code en question :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, this->GetWidth(), this->GetHeight());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, GLdouble(this->GetWidth()), GLdouble(this->GetHeight()), 00f);
// enable blending, should work like 2d sdl does
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// enable anti-aliasing
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glMatrixMode(GL_MODELVIEW);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
 
if (surface->flags & SDL_OPENGL)
{
	ManageTexture();
	glBegin(GL_QUADS);
	glColor4f(1.0, 1.0, 1.0, 1.0);
	glTexCoord2d(0, 0);
	glVertex2i(x, y);
	glTexCoord2d(0, hTexHeight);
	glVertex2i(x, y + hSurface->h);
	glTexCoord2d(hTexWidth, hTexHeight);
	glVertex2i(x + hSurface->w, y + hSurface->h);
	glTexCoord2d(hTexWidth, 0);
	glVertex2i(x + hSurface->w, y);
	glEnd();
}
.....
void SDLgfx::ManageTexture()
{
	if (!hTextureIndex)
	{
		glGenTextures(1, &hTextureIndex);
		hTextureStatus = TEX_TO_RELOAD;
	}
 
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, hTextureIndex);
 
	if (hTextureStatus & TEX_TO_RELOAD)
	{
		#ifdef DEBUGGFX
		std::cout << "Loading texture " << hTextureIndex << std::endl;
		#endif
 
		int w, h;
		SDL_Surface *image;
		Uint32 saved_flags;
		Uint8  saved_alpha;
 
		/* Use the surface width and height expanded to powers of 2 */
		w = power_of_two(hSurface->w);
		h = power_of_two(hSurface->h);
		hTexWidth = GLdouble(hSurface->w) / w;  /* Max X */
		hTexHeight = GLdouble(hSurface->h) / h;  /* Max Y */
 
		image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
			0x000000FF, 
			0x0000FF00, 
			0x00FF0000, 
			0xFF000000
#else
			0xFF000000,
			0x00FF0000, 
			0x0000FF00, 
			0x000000FF
#endif
			);
 
		if ( image == NULL )
			return;
 
		/* Save the alpha blending attributes */
		saved_flags = hSurface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
		saved_alpha = hSurface->format->alpha;
 
		if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA)
			SDL_SetAlpha(hSurface, 0, 0);
 
		/* Copy the surface into the GL texture image */
		SDL_BlitSurface(hSurface, NULL, image, NULL);
 
		/* Restore the alpha blending attributes */
		if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
			SDL_SetAlpha(hSurface, saved_flags, saved_alpha);
 
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, 
			GL_UNSIGNED_BYTE, image->pixels);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
		SDL_FreeSurface(image); /* No longer needed */
 
		hTextureStatus = TEX_NONE;
	}
}
Merci pour vos conseils.