Problem with NeHe tutorials

BlitzMax Forums/OpenGL Module/Problem with NeHe tutorials

PowerPC603(Posted 2005) [#1]
The first tutorials just work fine (2-9), but starting from tutorial 10, I get some problems in this function:
Function LoadGlTextures()
	Local PointeurImg:Byte Ptr
	Local TexWidth
	Local TexHeight
	tex01:TPixmap=LoadPixmap("data\mud.bmp")
	TexWidth=tex01.Width
	TexHeight=tex01.Height
	PointeurImg=PixmapPixelPtr(tex01,0,0)
	pp=0
	For y=TexHeight-1 To 0 Step -1
		For x=0 To TexWidth-1
			Checkimage[y,x,0]=PointeurImg[pp]
			Checkimage[y,x,1]=PointeurImg[pp+1]
			Checkimage[y,x,2]=PointeurImg[pp+2]
			pp=pp+3
		Next
	Next
'	tex01 = Null
'	FlushMem
	Release tex01
	' Create Nearest Filtered Texture
	glGenTextures 3, Varptr Texname[0]
	glBindTexture GL_TEXTURE_2D,Texname[0]
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST
	glTexImage2D GL_TEXTURE_2D, 0, 3, TexWidth, TexHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, Checkimage
	' Create Linear Filtered Texture
	glBindTexture GL_TEXTURE_2D, Texname[1]
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR
	glTexImage2D GL_TEXTURE_2D, 0, 3, TexWidth, TexHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, Checkimage
	' Create MipMapped Texture
	glBindTexture GL_TEXTURE_2D, Texname[2]
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR
	glTexParameteri GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST
	gluBuild2DMipmaps GL_TEXTURE_2D, 3, TexWidth, TexHeight, GL_RGB, GL_UNSIGNED_BYTE, Checkimage
End Function


The error is on the line "Release Tex01" and it states:
"Subexpression for release must be an integer variable".

When I comment out that line and use "Tex01 = Null" and "Flushmem" (the commented lines before "Release Tex01"), then the tutorial works.

When I downloaded these tuts (about a month ago), they all worked fine.
Has some upgrade of BMax changed the way Release works?


tonyg(Posted 2005) [#2]
Yep, the use of Release has changed to be used with integer handles only.


PowerPC603(Posted 2005) [#3]
Ok, no problem.
I just have to open every tutorial and make the adjustments to use ... = NULL and FlushMem.

Thanks.


tonyg(Posted 2005) [#4]
Just comment out the release statements then BMX will auto flush the objects.