There is a lot of differences, The Texture Procedure is different
Procedure LoadTexture_(Texture.i) ; Returns the texture for an OpenGL application
Protected Width.i, Height.i, NWidth.i, NHeight.i, X.i, Y.i, Colour.i, I.i, R.i, G.i, B.i, Tex.i
If Texture = 0 : CatchImage(1, ?Bigtext) : EndIf
If Texture = 1 : CatchImage(1, ?MyLogo) : EndIf; Catch Logo Image to Texture(1)
If Texture = 3 : CatchImage(1, ?Smallfont): EndIf
Width = ImageWidth(1)
Height = ImageHeight(1)
NWidth = Width : NHeight = Height
If NWidth > NHeight : NHeight = NWidth : EndIf ;/ had to force equal width / height due to compatability issues
If NHeight > NWidth : NWidth = NHeight : EndIf ;/
Dim ImageData.c(NWidth * NHeight * 4)
ImageD = ImageDepth(Texture, #PB_Image_InternalDepth)
StartDrawing(ImageOutput(1))
For Y=0 To NHeight-1
For X=0 To NWidth-1
If Y>Height-1 Or X>Width
Colour = 0 ;/ speeds up loading
Else
Colour = Point(X,Y)
r=Red(Colour) : g=Green(Colour) : b=Blue(Colour)
ImageData(i)=b : i+1
ImageData(i)=g : i+1
ImageData(i)=r : i+1
ImageData(i)=255
EndIf
If r<15 And g<15 And b<15 : ImageData(i)=0 : EndIf
i+1
Next
Next
StopDrawing()
glGenTextures_(1, @tex.i)
glBindTexture_(#GL_TEXTURE_2D, tex)
If ImageD = 32
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_LINEAR)
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_LINEAR)
Else
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_NEAREST)
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_NEAREST)
glTexParameteri_(#GL_TEXTURE_2D,#GL_TEXTURE_WRAP_S, #GL_CLAMP)
glTexParameteri_(#GL_TEXTURE_2D,#GL_TEXTURE_WRAP_T, #GL_CLAMP)
EndIf
If ImageD = 32
glTexImage2D_(#GL_TEXTURE_2D, 0,4 , NWidth, NHeight, 0, #GL_BGRA, #GL_UNSIGNED_BYTE, @ImageData());
Else
glTexImage2D_(#GL_TEXTURE_2D, 0, #GL_RGBA, NWidth, NHeight, 0, #GL_BGRA_EXT, #GL_UNSIGNED_BYTE, @ImageData());
EndIf
FreeImage(1)
Dim ImageData(0)
ProcedureReturn tex
EndProcedure
And then This
Procedure SetupGLTexture(ImageHandle.i)
Define.i ImageW, ImageH, ImageD
Define.i MemoryAddress
Define.i TextureHandle
If IsImage(ImageHandle) = 0
ProcedureReturn #False
EndIf
ImageD = ImageDepth(ImageHandle, #PB_Image_InternalDepth)
StartDrawing(ImageOutput(ImageHandle))
MemoryAddress = DrawingBuffer()
StopDrawing()
If MemoryAddress = 0
ProcedureReturn #False
EndIf
glGenTextures_(1, @TextureHandle)
glBindTexture_(#GL_TEXTURE_2D, TextureHandle)
ImageW = ImageWidth(ImageHandle)
ImageH = ImageHeight(ImageHandle)
If ImageD = 32
glTexImage2D_(#GL_TEXTURE_2D, 0, 4, ImageW, ImageH, 0, #GL_BGRA, #GL_UNSIGNED_BYTE, MemoryAddress)
Else
glTexImage2D_(#GL_TEXTURE_2D, 0, 3, ImageW, ImageH, 0, #GL_BGR, #GL_UNSIGNED_BYTE, MemoryAddress)
EndIf
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_LINEAR)
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_LINEAR)
ProcedureReturn TextureHandle
EndProcedure
There are other Differences too, however i think perhaps the loading and binding is the problem especially this
StartDrawing(ImageOutput(1))
For Y=0 To NHeight-1
For X=0 To NWidth-1
If Y>Height-1 Or X>Width
Colour = 0 ;/ speeds up loading
Else
Colour = Point(X,Y)
r=Red(Colour) : g=Green(Colour) : b=Blue(Colour)
ImageData(i)=b : i+1
ImageData(i)=g : i+1
ImageData(i)=r : i+1
ImageData(i)=255
EndIf
If r<15 And g<15 And b<15 : ImageData(i)=0 : EndIf
i+1
Next
Next
StopDrawing()
Wont have time to look at it for a few days