1
페인트 응용 프로그램을 만들고 페인트 브러시로 그림을 성공적으로 구현했습니다. 색상이 이미 그려져있는 화면에 다시 그려지는 색을 원하지 않습니다. . 스크린 샷을보세요. OpenGl ES를 사용하고 있습니다. 화면의 픽셀 색상을 현재 브러쉬 색상과 일치 시키려고했으나 제대로 표시되지 않았습니다. 아무에게도 내가 잘못 가고 있다고 말할 수 있습니까? probliem 주셔서 감사합니다 ..OpenGL ES를 사용하는 페인트 응용 프로그램의 색상 중첩 문제
스크린 샷 : 여기 내 코드를 붙여하고 http://imageshack.us/photo/my-images/842/screenshot20110726at601.png/
:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGRect bounds =[self bounds];
UITouch *touch = [[event touchesForView:self] anyObject];
//glDisable(GL_BLEND);
glEnable(GL_BLEND);
Byte pixel[4];
glReadPixels(location.x,location.y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
NSLog(@"%d %d %d %d",pixel[0],pixel[1],pixel[2],pixel[3]);
r_comp=(float)pixel[0]/255;
g_comp=(float)pixel[1]/255;
b_comp=(float)pixel[2]/255;
artbrushAppDelegate *app=(artbrushAppDelegate *)[[UIApplication sharedApplication]delegate];
if(r_comp==app.rg && g_comp==app.gg && b_comp==app.bg)
// app.rg,app.bg,app.gg are brush colors saved in global varable
{
glEnable(GL_BLEND);
}
else
{
glDisable(GL_BLEND);
}
다른 블렌딩 기능을 사용하여 엉망이 되십니까? 나는이 호출을 추가하는 것이'glBlendFunc (GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);'를 할 것인가에 관심이있을 것이다. 또는 이와 비슷한 것 (당신을 위해 일하는 것을 찾기 위해 블렌딩 함수로 놀아야 만합니다). 그냥 생각 ... – Ian
좋아 .. 고마워.하지만 프로젝트에서 그들을 사용했습니다 .. –