OpenGL bitmap texture
Posted: Thu Sep 08, 2011 3:56 pm
Hi,
I am trying to load a bitmap as a texture with opengl
but the result is nowhere good as you can see on this screen shot

the texture should be this

Full code here: http://demo.ovh.com/en/67e6d3ef81b20d6f ... 8b94580fd/
I am trying to load a bitmap as a texture with opengl
Code: Select all
Procedure LoadBitmapTexture(TextureNum.i, Filename.s, Filter.i)
Define.i img = LoadImage(0, Filename)
Define.BITMAP bmp
GetObject_(img,SizeOf(BITMAP),bmp)
Debug "[ bmp ]"
Debug "bmBits: " + Str( bmp\bmBits )
Debug "bmBitsPixel: " + Str( bmp\bmBitsPixel )
Debug "bmHeigh: " + Str( bmp\bmHeight )
Debug "bmPlanes: " + Str( bmp\bmPlanes )
Debug "bmType: " + Str( bmp\bmType )
Debug "bmWidth: " + Str( bmp\bmWidth )
Debug "bmWidthBytes: "+ Str( bmp\bmWidthBytes )
glBindTexture(#GL_TEXTURE_2D, TextureNum)
Select Filter
Case #GL_NEAREST
glTexParameterf(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_NEAREST)
glTexParameterf(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_NEAREST)
Debug "Mode: #GL_NEAREST"
Case #GL_LINEAR
glTexParameterf(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_LINEAR)
glTexParameterf(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_LINEAR)
Debug "Mode: #GL_LINEAR"
EndSelect
glTexImage2D(#GL_TEXTURE_2D, 0, 3, bmp\bmWidth, bmp\bmHeight, 0, #GL_BGR, #GL_UNSIGNED_BYTE, bmp\bmBits)
DeleteObject_(bmp)
FreeImage(0)
EndProcedure

the texture should be this

Full code here: http://demo.ovh.com/en/67e6d3ef81b20d6f ... 8b94580fd/