Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void grayScale() {
- if (fst) {
- fst = false;
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
- uint count = Width * Height;
- for (uint i = 0; i < count; ++i) {
- double luminance = 0.3 * pixelData[i * 4] + 0.59 * pixelData[i * 4 + 1] + 0.11 * pixelData[i * 4 + 2];
- pixelData[i] = static_cast<uchar>(luminance);
- }
- }
- glDrawPixels(Width, Height, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixelData);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement