Noob Question about GLTexFromPixmap

BlitzMax Forums/BlitzMax OpenGL Programming/Noob Question about GLTexFromPixmap

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.

Main Question:

Function LoadGlTextures()
	Local PointeurImg:Byte Ptr
	Local TexWidth
	Local TexHeight
	tex01:TPixmap=LoadPixmap("tile1.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]
			Checkimage[y,x,3]=100
			pp=pp+3
		Next
	Next
	tex01=Null
	glPixelStorei(GL_UNPACK_ALIGNMENT,1)
	glGenTextures(1, VarPtr Texname)
	glBindTexture(GL_TEXTURE_2D, Texname)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
	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, GL_RGBA, TexWidth, TexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, Checkimage)
End Function

Above is the LoadGLTexture code from Nehe 6. This is the simplest code I have to load a texture. (Its sitting in a zip file with all the nehe, but tonyg said somewhere that it was the relevent one)

I want to just replace "everything" that can be replaced with
GLTexFromPixmap(LoadPixmap("tile1.bmp"))
But everywhere I can think to do it, I get a Int/int Ptr Problem.

Question Two:

Whats the "Smallest" code that nehe6 could really be? That is do I really need (For example), glClearColor(0.0, 0.0, 0.0, 0.0). I assume lots of Nehe6 is there as an educational method, but If I just went for default, what could I cut it down to?

Question Three:

Ok this might sound like a dumb question, but do I really have to re-allocate the verticies each frame
glBegin GL_QUADS
		' Front Face
		glTexCoord2f 0.0, 0.0; glVertex3f -1.0, -1.0, 1.0       ' Bottom Left Of The Texture And Quad
		glTexCoord2f 1.0, 0.0; glVertex3f  1.0, -1.0, 1.0       ' Bottom Right Of The Texture And Quad
		glTexCoord2f 1.0, 1.0; glVertex3f  1.0,  1.0, 1.0       ' Top Right Of The Texture And Quad
		glTexCoord2f 0.0, 1.0; glVertex3f -1.0,  1.0, 1.0       ' Top Left Of The Texture And Quad
		' Back Face
		glTexCoord2f 1.0, 0.0; glVertex3f -1.0, -1.0, -1.0      ' Bottom Right Of The Texture And Quad
		glTexCoord2f 1.0, 1.0; glVertex3f -1.0,  1.0, -1.0      ' Top Right Of The Texture And Quad
		glTexCoord2f 0.0, 1.0; glVertex3f  1.0,  1.0, -1.0      ' Top Left Of The Texture And Quad
		glTexCoord2f 0.0, 0.0; glVertex3f  1.0, -1.0, -1.0      ' Bottom Left Of The Texture And Quad
		' Top Face
		glTexCoord2f 0.0, 1.0; glVertex3f -1.0,  1.0, -1.0      ' Top Left Of The Texture And Quad
		glTexCoord2f 0.0, 0.0; glVertex3f -1.0,  1.0,  1.0      ' Bottom Left Of The Texture And Quad
		glTexCoord2f 1.0, 0.0; glVertex3f  1.0,  1.0,  1.0      ' Bottom Right Of The Texture And Quad
		glTexCoord2f 1.0, 1.0; glVertex3f  1.0,  1.0, -1.0      ' Top Right Of The Texture And Quad
		' Bottom Face
		glTexCoord2f 1.0, 1.0; glVertex3f -1.0, -1.0, -1.0      ' Top Right Of The Texture And Quad
		glTexCoord2f 0.0, 1.0; glVertex3f  1.0, -1.0, -1.0      ' Top Left Of The Texture And Quad
		glTexCoord2f 0.0, 0.0; glVertex3f  1.0, -1.0,  1.0      ' Bottom Left Of The Texture And Quad
		glTexCoord2f 1.0, 0.0; glVertex3f -1.0, -1.0,  1.0      ' Bottom Right Of The Texture And Quad
		' Right face
		glTexCoord2f 1.0, 0.0; glVertex3f  1.0, -1.0, -1.0      ' Bottom Right Of The Texture And Quad
		glTexCoord2f 1.0, 1.0; glVertex3f  1.0,  1.0, -1.0      ' Top Right Of The Texture And Quad
		glTexCoord2f 0.0, 1.0; glVertex3f  1.0,  1.0,  1.0      ' Top Left Of The Texture And Quad
		glTexCoord2f 0.0, 0.0; glVertex3f  1.0, -1.0,  1.0      ' Bottom Left Of The Texture And Quad
		' Left Face
		glTexCoord2f 0.0, 0.0; glVertex3f -1.0, -1.0, -1.0      ' Bottom Left Of The Texture And Quad
		glTexCoord2f 1.0, 0.0; glVertex3f -1.0, -1.0,  1.0      ' Bottom Right Of The Texture And Quad
		glTexCoord2f 1.0, 1.0; glVertex3f -1.0,  1.0,  1.0      ' Top Right Of The Texture And Quad
		glTexCoord2f 0.0, 1.0; glVertex3f -1.0,  1.0, -1.0      ' Top Left Of The Texture And Quad
	glEnd

Cannot I do this just once in init, and then rotate the thing each frame?

Cavat:

I dont understand GL, and as I have continualy failed to understand GL. I have picked my programing level, and It is not in the depths of either DX or GL. I can see the technical skill needed, and I simply havent gained such skills. So if you could explain what I need to do, please assume I know nothing about GL, and try to have as few gl commands as possible.