QOpenGLTexture
来源:互联网 发布:群智能算法论文 编辑:程序博客网 时间:2024/06/11 14:39
1Here's my code:QImage texPic(width, height, QImage::Format_RGBA8888);texPic.setPixel(0, 0, qRgba(255,0,0,0));texPic.setPixel(0, 1, qRgba(0,255,0,100));QOpenGLTexture *texture = new QOpenGLTexture(texPic)Any suggestions?I have found the problem, it's not from the setting of texture itself.It because I didn't get the gl functions setting right.I addedglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);glEnable(GL_BLEND);And now it worked.2 Qt 5 with QOpenGLTexture and 16 bits integers imagesTo be clear, here is the corrected code:QOpenGLTexture *oglt = new QOpenGLTexture(QOpenGLTexture::Target2D);oglt->setMinificationFilter(QOpenGLTexture::NearestMipMapNearest);oglt->setMagnificationFilter(QOpenGLTexture::Nearest);//oglt->setFormat(QOpenGLTexture::RGB32F); // worksoglt->setFormat(QOpenGLTexture::RGB16U); // now works with integer images (unsigned)oglt->setSize(naxis1, naxis2);//oglt->allocateStorage(QOpenGLTexture::RGB, QOpenGLTexture::Float32); // works//oglt->setData(QOpenGLTexture::RGB, QOpenGLTexture::Float32, tempImageRGB.data); // worksoglt->allocateStorage(QOpenGLTexture::RGB_Integer, QOpenGLTexture::UInt16); // now works with integer images (unsigned)oglt->setData(QOpenGLTexture::RGB_Integer, QOpenGLTexture::UInt16, tempImageRGB.data); // now works with integer images (unsigned)3QOpenGLTexture*qtexture = new QOpenGLTexture(QOpenGLTexture::Target2D);qtexture->setData(QOpenGLTexture::PixelFormat::RGBA, QOpenGLTexture::PixelType::Int8,FreeImage_GetBits(bitmap));qtexture->allocateStorage(); // was the key!4 QOpenGLTexture Class http://doc.qt.io/qt-5/qopengltexture.html#detailssee Public Functions
..................5 http://doc.qt.io/qt-5/qtopengl-textures-example.html
阅读全文
0 0
- QOpenGLTexture
- QOpenGLTexture II
- iOS集成FFmpeg
- iOS开发 代码截图相关
- 32 linux内核里的中断处理
- html拼接时onclick事件传递json对象
- java中调用oracle procedure或者function返回类型的问题
- QOpenGLTexture
- 解决Ubuntu+Eclipse+pydev+tensorflow CUDA链接库不能加载
- DB2时间函数
- rabbitMQ
- MongoDB 3.4版本, C# 驱动 2.4 操作
- jq判断页面滚动条上滚还是下滚
- itk中的黑白TopHat算法
- 《C++ Primer》读书笔记第2章:变量与基本类型
- 利用canal使Mysql缓冲Redis