void Camera::drawPhoto(float x, float y, float width, float height) { if(photoDataReady) { ofPixels& photoPixels = getPhotoPixels(); if(needToUpdatePhoto) { if(photoTexture.getWidth() != photoPixels.getWidth() || photoTexture.getHeight() != photoPixels.getHeight()) { photoTexture.allocate(photoPixels.getWidth(), photoPixels.getHeight(), GL_RGB8); } photoTexture.loadData(photoPixels); needToUpdatePhoto = false; } photoTexture.draw(x, y, width, height); } }
ofTexture& Camera::getPhotoTexture() { if(photoDataReady) { ofPixels& photoPixels = getPhotoPixels(); if(needToUpdatePhoto) { if(photoTexture.getWidth() != photoPixels.getWidth() || photoTexture.getHeight() != photoPixels.getHeight()) { photoTexture.allocate(photoPixels.getWidth(), photoPixels.getHeight(), GL_RGB8); } photoTexture.loadData(photoPixels); needToUpdatePhoto = false; } } return photoTexture; }
void Camera::drawPhoto(float x, float y) { if(photoDataReady) { ofPixels& photoPixels = getPhotoPixels(); draw(x, y, getWidth(), getHeight()); } }