PDA

View Full Version : Texture data doesn't match Frame Buffer Contents



CelticDaddio
08-11-2006, 02:38 PM
I generate a texture (GL_RGBA) via a fragment shader. I map this to a full screen quad and render. I read the contents of the frame buffer back and the data does not match.... When generating the texture, I set all texels to (191, 191, 4). When reading back (via glReadPixels), all texels are (189, 190, 0). It's close, but not the same... What's more, the Blue component stair steps... In the table below, A is the value I set Blue to in the texture and B is the Blue value read back from the frame buffer using glReadPixels....

Any ideas what's going on here?

CD


A B
----------
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 8
9 8
10 8
11 8
12 8
13 8
14 8
15 8
16 16
17 16
18 16
19 16
20 16
21 16
22 16
23 16
24 25
25 25
26 25
27 25
28 25
29 25
30 25
31 25
32 33
33 33
34 33
35 33
36 33
37 33
38 33
39 33
40 41
41 41
42 41
43 41
44 41
45 41
46 41
47 41
48 49
49 49
50 49
51 49
52 49
53 49
54 49
55 49
56 58
57 58
58 58
59 58
60 58
61 58
62 58
63 58
64 66

Relic
08-14-2006, 01:17 AM
Check your framebuffer format if you're in true color (R8G8B8) and not in 16-bit highcolor (R5G6B5).
Your texture internalFormat should be GL_RGBA8, not GL_RGBA (== 4 components from OpenGL 1.1 times).