Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glTexSubImage2D(GL_TEXTURE_2D,0,0,0,widthGL,heightGL,
- GL_LUMINANCE,GL_UNSIGNED_BYTE,noise);
- //computation
- QImage mySurface(noise,widthGL,heightGL,QImage::Format_Indexed8);
- mySurface.save("test.bmp","BMP");
- static unsigned char* mbuffer = new unsigned char[3*widthGL*heightGL];
- for (int i = 0,bpos=0;i<widthGL*heightGL;i++)
- {
- mbuffer[bpos++]=noise[i];
- mbuffer[bpos++]=noise[i];
- mbuffer[bpos++]=noise[i];
- }
- QImage mySurface(mbuffer,widthGL,heightGL,QImage::Format_RGB888);
- glTexSubImage2D(GL_TEXTURE_2D,0,0,0,widthGL,heightGL,GL_LUMINANCE,GL_UNSIGNED_BYTE,noise);
- //computation
- QVector<QRgb> colorTable(256); //our grayscale palette
- QImage mySurface(noise,widthGL,heightGL,QImage::Format_Indexed8);
- for (int i = 0; i < 256; ++i)
- colorTable[i] = qRgb(i, i, i); //build palette
- mySurface.setColorCount(256);
- mySurface.setColorTable(colorTable);
- mySurface.save("test.bmp","BMP");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement