I'm making a simple 2D game for a University class with Pygame (used just for handling events) and PyOpenGL (for the graphics). I need to find the dimensions of a texture I've loaded given its textureID, but I can't figure out how to use the PyOpenGL API for this.
I know that the function I should use is glGetTextureLevelParameteriv, which receives as arguments:
the ID of the texture
the mipmap level (0 in my case)
the texture's parameter I want to know (for me either
GL_TEXTURE_WIDTHorGL_TEXTURE_HEIGHT)a "mistery" argument
paramswhich is described by the PyOpenGL docs as "Returns the requested data."
My problem is with the latter argument, since in "pure" C++ OpenGL that would be a GLint* pointer to a variable passed by reference and used to write the returned value. However, since I'm using python passing by reference isn't really a thing and I can't figure out what to use as a fourth argument to make the function work.
The code right now is:
h = [0.0]
glGetTextureLevelParameteriv(self.texture, 0, GL_TEXTURE_HEIGHT, h) # self.texture is the texture's ID
print(h) # prints "[0.0]"
I'm 100% sure the texture is loaded correctly. I'd like to not store the texture's size nor to define a new internal datatype to do so.
Relevant docs:
Khronos's OpenGL docs