PDA

View Full Version : True color display problem.



kometes76
07-07-2009, 04:46 PM
Environment:
1. Windows Mobile 6
2. Vincent lib

1. I just created gradient image in vertical direction like the below:

int width=256; int height=256;
unsigned char data[256*256*4];
int x,y;
for(y=0;y<height;++y)
for(x=0;x<width;++x)
{
data[4*(x+y*width)] = y;
data[4*(x+y*width)+1] = y;
data[4*(x+y*width)+2] = 0;
data[4*(x+y*width)+3] = 255;
}
and then binded this texture like the below.
glBindTexture(GL_TEXTURE_2D, textureName);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);

2. I expected to be displayed gradiently but It shows like the step like the below.
http://168.131.153.39/~island33/LikeIndexedColor.bmp
Can you give me advices for this issue in OpenGL ES 1.x.
Is there any options list for me to ckeck? :mrgreen:

ydroneaud
10-13-2009, 07:41 AM
You have a problem with either dithering (some implementation don't have dithering, BAD! ) or your texture are repeated. Fix your triangles and clamp texture.

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);