曾少贤 2018-04-05
QImage texture, buffer; buffer.load("C:/Users/wukesong/Pictures/flower.jpg"); texture = QGLWidget::convertToGLFormat(buffer);//转换为OpenGL支持的格式 glGenTextures(, &gColorSpec);//创建纹理数量 :一个 glBindTexture(GL_TEXTURE_2D, gColorSpec);//将纹理绑定到目标纹理上 glTexImage2D(GL_TEXTURE_2D, , , texture.width(), texture.height(), , GL_RGBA, GL_UNSIGNED_BYTE, texture.bits()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);//滤波 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, );