Hi Rene,
why do you think it does not work by default, here little example:
Uses "TBGL" ' -- Module for 3D graphics
Uses "File"
Dim hWnd As DWord
Dim sTexture As String = APP_SourcePath+"Textures\Test.Bmp"
' -- Creates window and returns handle by which we can identify it
hWnd = TBGL_CreateWindowEx("Texturing example, press ESC to quite", 640, 480, 32, %TBGL_WS_WINDOWED)
TBGL_ShowWindow
' -- Loads texture to slot 1 with MIPMAP filtering
If FILE_Exists(sTexture) = FALSE Then
MsgBox hWnd, "Could not find the following texture:" + $CRLF + sTexture
TBGL_DestroyWindow
Stop
Else
TBGL_LoadTexture sTexture, 1, %TBGL_TEX_MIPMAP
End If
' -- Enables aplication of textures to objects
tbgl_UseTexturing %TRUE
' -- We will apply texture 1
tbgl_BindTexture 1
TBGL_ResetKeyState() ' -- Resets status of all keys
' -- Main loop
While TBGL_IsWindow(hWnd)
' -- Erases previous frame
tbgl_ClearFrame
' -- Sets camera to look from 0,0,5 to 0,0,0
tbgl_Camera 0, 0, 5, _
0, 0, 0
' -- Creates quads, shapes with 4 vertices
TBGL_BeginPoly %GL_QUADS
tbgl_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
tbgl_Vertex -1, -1, 0
TBGL_TexCoord2D 2, 0 ' -- Texture coordinate, lower right corner
tbgl_Vertex 1, -1, 0
TBGL_TexCoord2D 2, 2 ' -- Texture coordinate, higher right corner
tbgl_Vertex 1, 1, 0
TBGL_TexCoord2D 0, 2 ' -- Texture coordinate, higher left corner
tbgl_Vertex -1, 1, 0
tbgl_EndPoly
' -- Finishes drawing
tbgl_DrawFrame
' -- If ESC key is pressed, it will jump out of loop
If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
Wend
' -- Destroys window
TBGL_DestroyWindow
Petr
Bookmarks