Page MenuHome

BGL MODULE: Bug with genTextures on a Buffer of type GL_SHORT
Closed, ArchivedPublic

Description

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: 2 x GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.97

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-18 12:53, hash: rB115a5bf65a6b

Short description of error

# Generate 4 Textures - this should produce an array of [0,1,2,3,4] or at the very least 4 different values
bgl.glEnable(bgl.GL_TEXTURE_2D)
self.texture = bgl.Buffer(bgl.GL_SHORT, 4)
bgl.glGenTextures(4, self.texture)

# This produces a bug -- [44, 0, 45, 0] -- if we're generating 4 textures, that means 4 different textures, not two, and two of the same

# My workaround is to do the following...

# Generate 4 Textures
bgl.glEnable(bgl.GL_TEXTURE_2D)
self.texture = bgl.Buffer(bgl.GL_SHORT, 8)
bgl.glGenTextures(8, self.texture)

 # bgl module has a bug with buffers of type short, ie. [44, 0, 45, 0, 46, 0, 47, 0]
self.texture_id = [self.texture.to_list()[0], self.texture.to_list()[2], self.texture.to_list()[4], self.texture.to_list()[6]]

# However I still seem to get a crash every now and then with this approach, not sure why.

Event Timeline

Ray Molenkamp (LazyDodo) changed the task status from Unknown Status to Archived.Nov 28 2019, 10:44 PM
Ray Molenkamp (LazyDodo) claimed this task.

the documentaiton for glGenTextures say you need to feed it integers , feeding it a short buffer is asking for trouble

Hm. How else do we support multiple textures for unit16?

Well I'm an idiot -- nevermind thanks lol, just use GL_INT you're not suppoed to pass any other type in there anyway