如何在OpenGL c++中使用SOIL加载不同的图像(循环)
How to load different images (loop) using SOIL for OpenGL c++?
有人知道如何从我解析的xml中循环不同的图像(我使用了libxml2(,然后在c++中使用SOIL for OpenGL加载它>吗?这是我的代码:
LoadImage *img[0];
File getFile;
int a;
string imge;
vector<char*> image3;
void getImageNode(File getFile){
vector<Image> image = getFile.getChildrenImage();
a = image.size();
Image image2;
while(image.size()){
image2 = image.front();
imge = image2.getthumb();
char *fileImage = &imge[0];
image3.push_back(fileImage);
image.erase(image.begin());
}
}
int main(int argc,char **argv){
GetRootNode getrootNode;
string xmlFile = "educationalVideo.xml";
Parser xmlObj(xmlFile);
getFile = xmlObj.getNode();
getImageNode(getFile);
for(int i=0; i<=a; i++){
while(image3.size()){
char *fileImage2 = image3.front();
img[i]=new LoadImage(fileImage2); //getting last image
image3.erase(image3.begin());
}
}
return 0;
}
这个怎么样?
GLuint tex_2d_1 = SOIL_load_OGL_texture
(
"img1.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);
GLuint tex_2d_2 = SOIL_load_OGL_texture
(
"img2.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);
相关文章:
- 如何循环打印顶点结构
- 如何在C++中从两个单独的for循环中添加两个数组
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 正在尝试了解输入验证循环
- std::map<struct,struct>::find 找不到匹配项,但是如果我循环通过 begin() 到 end(),我在那里看到匹配项
- SDL GPU 为什么将两个图像分成两个单独的循环更快?
- 当通过tcp接收编码图像的消息时,zmq在第二个循环中崩溃
- OPENCV C .在for循环中在不同的图像像素上绘制一个圆圈(应在每个循环运行时将图像打开)
- 循环浏览捕获的图像 vector<cv::Mat>
- 在 for 循环中显示索引图像
- 循环并通过图像向量显示
- GDI+在循环中只保存一次图像
- 循环访问图像行和列
- OpenCV imshow() 在循环中显示图像
- c++快板绘图精灵(即使没有任何循环)减慢图像速度
- 如何在openCV中使用循环顺序访问图像
- 如何在OpenGL c++中使用SOIL加载不同的图像(循环)
- c++的waitKey延迟在循环中显示图像
- 如何有效地循环图像在Qt