Unable to calculate tex size

BlitzMax Forums/BlitzMax OpenGL Programming/Unable to calculate tex size

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hello,

I need some help here. It's a rather complex problem but I'll try to explain. On some computers I get the error "Unable to calculate tex size" too. Unfortunatly not no my PC, so it's hard to debug.

It's in the AdjustPixmap code in TTexture.bmx
The code I show you below is from Klepto and it's posted in a post I did for another problem (see: http://www.blitzbasic.com/Community/posts.php?topic=72501#811490)
	Function AdjustPixmap:TPixmap(pixmap:TPixmap)
	
		' adjust width and height size to next biggest power of 2 size
		Local width=Pow2Size(pixmap.width)
		Local height=Pow2Size(pixmap.height)

		' check that width and height size are valid (not too big)
		Repeat
			Local t
			glTexImage2D GL_PROXY_TEXTURE_2D,0,4,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null
			glGetTexLevelParameteriv GL_PROXY_TEXTURE_2D,0,GL_TEXTURE_WIDTH,Varptr t
			If t Exit
			If width=1 And height=1 RuntimeError "Unable to calculate tex size"
			
			If width>1 width:/2
			If height>1 height:/2
		Forever

		' if width or height have changed then resize pixmap
		If width<>pixmap.width Or height<>pixmap.height
			pixmap=ResizePixmap(pixmap,width,height)
		EndIf
		
		' return pixmap
		Return pixmap
		
	End Function

The problem should lie in the two lines:
			glTexImage2D GL_PROXY_TEXTURE_2D,0,4,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null
			glGetTexLevelParameteriv GL_PROXY_TEXTURE_2D,0,GL_TEXTURE_WIDTH,Varptr t


It seems there is a possibility the pixmap is interpreted wrong on some systems. I checked if the (intergrated) graphics cards have OpenGL support.
Are there more specific OpenGL-compatibilities I have to check for, or is this a software problem that can be solved?

PS: I tried different colour depths:
Graphics3D 1024, 768, 32, 1
Graphics3D 1024, 768, 16, 1
Graphics3D 1024, 768, 0, 1
with no results.

<edit>
Replaced the AdjustPixmap() function with the remarked version in TTexture:
	Function AdjustPixmap:TPixmap(pixmap:TPixmap)
	
		Local width=Pow2Size(pixmap.width)
		Local height=Pow2Size(pixmap.height)

		If width<>pixmap.width Or height<>pixmap.height
			pixmap=ResizePixmap(pixmap,width,height)
		EndIf
		
		Return pixmap
		
	End Function
and that solved the problem. I'm happy with that for now (there's a user test comming up next week so I was in desperate need of a working version) but I'd like to now what is going on. Klepto2... any ideas?