glTexSubImage3D vs QOpenGLTexture setData

时间:2018-03-13 18:05:17

标签: c++ qt opengl qtopengl

据我所知,在纹理数组或3D纹理的情况下,QOpenGLTexture :: setData相当于glTexImage3D。现在,如果我想在运行时使用PBO更新纹理,我需要使用glTexSubImage3D而不是glTexImage3D,Qt纹理中的等价物是什么?

1 个答案:

答案 0 :(得分:0)

首先,asynchronous uploads绝不需要使用glTexSubImage3D;他们适用于any pixel transfer function.

其次,setData 相当于SubImage - 类的OpenGL函数。或至少setDatasetData; most overloads将为您分配存储空间(因为Qt的OpenGL抽象是一致性存在的地方)。因此,您可以使用allocateStorage来完全使用PBO。

OpenGL中的纹理非常类似于指针。 int *p = new int[20];就像分配内存并将分配的内存存储在指针(setData)中一样。 p[0] = 5;就像访问已分配的对象并将数据复制到其中(@When("^User goes into Best Sellers in Digital Cameras$") public void userGoesIntoBestSellersInDigitalCameras() { wait.until(ExpectedConditions.elementToBeClickable(mainPage.getDepartmentsButton())); mainPage.clickDepartmentsButton(); wait.until(ExpectedConditions.elementToBeClickable(departments.getCameraPhotoVideoLink())); departments.clickCameraPhotoVideoLink(); wait.until(ExpectedConditions.elementToBeClickable(cameraPhotoVideo.getBestSellersLink())); cameraPhotoVideo.clickBestSellersLink(); wait.until(ExpectedConditions.elementToBeClickable(bestSellersBestCameraPhoto.getDigitalCamerasLink())); bestSellersBestCameraPhoto.clickDigitalCamerasLink(); wait.until(ExpectedConditions.titleIs(bestSellersBestDigitalCameras.getExpectedBestSellersBestDigitalCamerasPageTitle())); } )。你必须先分配内存才能将内容存储到内存中,但之前你不需要再分配内存