I am trying to figure out how to use glInterLeaveArrays with out any luck. I am using it to draw a texture box. some how it is not working correctly. I can do it fine with independent GL_QUADS for each side but I can't get it to work with glInterleaveArrays. this is the code so far:
Strict Type Vertex Field tu#, tv#; Field x#, y#, z#; End Type Global ScreenWidth:Int=800 Global ScreenHeight:Int=600 Global Checkimage:Byte[256,256,4] Global Texname:Int Global g_fDistance# = -4.5; Global g_cubeVertices:vertex[24] Global light_position#[] = [1.0, 1.0, 0.0, 0.0] RestoreData verts For Local i% = 0 To 23 g_cubeVertices[i] = New Vertex ReadData g_cubeVertices[i].tu ReadData g_cubevertices[i].tv ReadData g_cubevertices[i].x ReadData g_cubevertices[i].y ReadData g_cubevertices[i].z Next #verts ' Front Face DefData 0.0, 0.0, -1.0, -1.0, 1.0 ' Bottom Left Of The Texture And Quad DefData 1.0, 0.0, 1.0, -1.0, 1.0 ' Bottom Right Of The Texture And Quad DefData 1.0, 1.0, 1.0, 1.0, 1.0 ' Top Right Of The Texture And Quad DefData 0.0, 1.0, -1.0, 1.0, 1.0 ' Top Left Of The Texture And Quad ' Back Face DefData 1.0, 0.0, -1.0, -1.0, -1.0 ' Bottom Right Of The Texture And Quad DefData 1.0, 1.0, -1.0, 1.0, -1.0 ' Top Right Of The Texture And Quad DefData 0.0, 1.0, 1.0, 1.0, -1.0 ' Top Left Of The Texture And Quad DefData 0.0, 0.0, 1.0, -1.0, -1.0 ' Bottom Left Of The Texture And Quad ' Top Face DefData 0.0, 1.0, -1.0, 1.0, -1.0 ' Top Left Of The Texture And Quad DefData 0.0, 0.0, -1.0, 1.0, 1.0 ' Bottom Left Of The Texture And Quad DefData 1.0, 0.0, 1.0, 1.0, 1.0 ' Bottom Right Of The Texture And Quad DefData 1.0, 1.0, 1.0, 1.0, -1.0 ' Top Right Of The Texture And Quad ' Bottom Face DefData 1.0, 1.0, -1.0, -1.0, -1.0 ' Top Right Of The Texture And Quad DefData 0.0, 1.0, 1.0, -1.0, -1.0 ' Top Left Of The Texture And Quad DefData 0.0, 0.0, 1.0, -1.0, 1.0 ' Bottom Left Of The Texture And Quad DefData 1.0, 0.0, -1.0, -1.0, 1.0 ' Bottom Right Of The Texture And Quad ' Right face DefData 1.0, 0.0, 1.0, -1.0, -1.0 ' Bottom Right Of The Texture And Quad DefData 1.0, 1.0, 1.0, 1.0, -1.0 ' Top Right Of The Texture And Quad DefData 0.0, 1.0, 1.0, 1.0, 1.0 ' Top Left Of The Texture And Quad DefData 0.0, 0.0, 1.0, -1.0, 1.0 ' Bottom Left Of The Texture And Quad ' Left Face DefData 0.0, 0.0, -1.0, -1.0, -1.0 ' Bottom Left Of The Texture And Quad DefData 1.0, 0.0, -1.0, -1.0, 1.0 ' Bottom Right Of The Texture And Quad DefData 1.0, 1.0, -1.0, 1.0, 1.0 ' Top Right Of The Texture And Quad DefData 0.0, 1.0, -1.0, 1.0, -1.0 ' Top Left Of The Texture And Quad GLGraphics ScreenWidth,ScreenHeight LoadGlTextures() glClearColor( 0.0, 0.0, 0.0, 1.0 ) glEnable( GL_TEXTURE_2D ); glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0,Float(ScreenWidth)/Float(ScreenHeight),0.1,100.0) glMatrixMode(GL_MODELVIEW) glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glEnable(GL_TEXTURE_2D) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE) glBindTexture(GL_TEXTURE_2D,Texname) glLoadIdentity() glTranslatef (0.0,0.0,-8.0) glBindTexture( GL_TEXTURE_2D, Texname ); glInterleavedArrays( GL_T2F_V3F, 0, g_cubeVertices ); glDrawArrays( GL_QUADS, 0,24 ); glDisable(GL_TEXTURE_2D) Flip() WaitKey() Function LoadGlTextures() Local PointeurImg:Byte Ptr Local TexWidth Local TexHeight Local tex01:TPixmap=LoadPixmap("data\radiation_box.png") TexWidth=tex01.Width TexHeight=tex01.Height PointeurImg=PixmapPixelPtr(tex01,0,0) Local pp%=0 For Local y%=TexHeight-1 To 0 Step -1 For Local x%=0 To TexWidth-1 If x> 31 And x< (TexWidth-31) And y > 31 And y<(TexHeight-31) 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 ' alpha Else Checkimage[y,x,0]=PointeurImg[pp] Checkimage[y,x,1]=PointeurImg[pp+1] Checkimage[y,x,2]=PointeurImg[pp+2] Checkimage[y,x,3]=255 ' alpha EndIf 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