현재 iOS 앱을 만들고 있는데 ofGrabber에서 픽셀을 가져 와서 ofTexture를 사용하여 그릴 때의 관계를 이해하는 데 문제가 있습니다.ofGrabber 및 ofTexture의 픽셀 형식 간의 관계
내 현재 코드 : 설정에서
() : 업데이트에
//Set iOS orientation
ofSetOrientation(OF_ORIENTATION_90_LEFT);
//Inits the camera to specified dimensions and sets up texture to display on screen
grabber.initGrabber(640, 480, OF_PIXELS_BGRA); //Options: 1280x720, 640x480
//Allocate opengl texture
tex.allocate(grabber.width, grabber.height, GL_RGB);
//Create pix array large enough to store an rgb value for each pixel
//pix is a global that I use to do pixel manipulation before drawing
pix = new unsigned char[grabber.width * grabber.height * 3];
() 무승부에
//Loads the new pixels into the opengl texture
tex.loadData(pix, grabber.width, grabber.height, GL_RGB);
() : 나는 '무엇
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGSizeMake screenSize = CGSizeMake(screenBounds.size.width, screenBounds.size.height);
//Draws the texture we generated onto the screen
//On 1st generation iPad mini: width = 1024, height = 768
tex.draw(0, 0, screenSize.height, screenSize.width); //Reversed for 90 degree rotation
궁금해 :
1) ofGrabber와 ofTexture가 겉으로보기에 다른 픽셀 형식을 사용하는 이유는 무엇입니까? (이 포맷은 VideoGrabberExample에서 사용 된 것과 동일합니다.)
2) 해상도가있는 텍스처 그리기는 정확히 무엇입니까? 텍스처에 pix 배열을로드하고 있습니다. pix 배열은 640x480 이미지를 나타내는 반면, ofTexture는 1024x768 (회전 할 경우 768x1024) 이미지를 화면에 표시합니다. 어떻게 이러는거야? 종횡비가 기본적으로 동일하기 때문에 모든 것을 확장 할 수 있습니까?
3) OpenGL 및 OpenFrameworks 픽셀 형식을 설명하는 목록이 있습니까? 나는 이것을 찾았지만 많이 찾지 못했습니다. 예를 들어, 왜 OF_PIXELS_RGBA 대신 OF_PIXELS_BGRA입니까? 그 문제에 대해 BGRA 형식의 데이터 (감마 값 포함)를 캡처하는 경우에도 내 코드가 작동하는 이유는 무엇입니까? 아직 RGB를 그리는 것입니다. 그리고 내 pix 배열은 RGB 데이터의 크기를 알 수 있습니다.
또한 주에 그()를 내가 가지고 말할 수 있습니다
ofSetupOpenGL(screenSize.height, screenSize.width, OF_FULLSCREEN);
그러나, 변경 너비/높이 값은 위의 내 애플 리케이션에 아무런 영향이없는 것으로 보인다.
감사! 내가 그 물건에 맞붙었던 이래로 오랫동안 계속되었다. 그러나 아직도 되돌아 가게되는 것은 흥미있다! –