PDA

View Full Version : "Invalid Operation" on glTexStorage2D Error 1282



flightlesskite
08-06-2018, 06:41 AM
Hi I am trying to render a couple of images on to my HTC Vive device using OpenGl.

I keep getting an error as follows:

err= 1282, description = 'invalid operation',baseOperation = glTexStorage2D, cArguments= (GL_TEXTURE_2D, 1, GL_RGBA8, 1827L, 2030L,)

And a snippet of my code where the error occurs-



image_right = cv2.imread('./sample.png')
image_left = cv2.imread('./sample_left.jpg')

height, width, channels = image_left.shape

cv2.cvtColor(image_left,cv2.COLOR_BGR2RGB)
cv2.cvtColor(image_right,cv2.COLOR_BGR2RGB)

w, h = self.vr_system.getRecommendedRenderTargetSize()

glBindTexture(GL_TEXTURE_2D, self.zedTextureID_L);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, w, h);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, image_left)


glBindTexture(GL_TEXTURE_2D, self.zedTextureID_R);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, w, h);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, image_right)


self.texture_t_left.handle = self.zedTextureID_L
self.texture_t_right.handle = self.zedTextureID_R

Any ideas of what is going wrong? I'd be most grateful for any help. I can send the rest of my code too but it's quite large....
I've seen some people with the same error however it's mostly because the levels was set to 0 for the glTexStorage2D function.

GClements
08-06-2018, 04:45 PM
Have you checked that self.zedTextureID_L and self.zedTextureID_R are non-zero?