Lionheart008
16-12-2009, 22:17
old wine smells good :)
because I love this little and simple tbgl examples (found in an old tbgl folder on my notebook and didn't want to delete it!) I modified with new textures and some tbgl box, sphere. I like this kind of texture blending!
original code came from tbgl_batman petr / tbgl / "tbgl_demo3_quad_textureAndBlended".
perhaps it's also useful to learn for tbgl beginners with simple and exciting examples ;)
Uses "TBGL"
Dim hWnd As Dword
hWnd = TBGL_CreateWindowEx("Rotating textured square with blending, press ESC to quite", 640, 480, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow
TBGL_LoadTexture APP_SourcePath+"Textures/Avatar3d.Bmp", 1, %TBGL_TEX_MIPMAP
TBGL_LoadTexture APP_SourcePath+"Textures/house_interior.Bmp", 2, %TBGL_TEX_MIPMAP
TBGL_UseTexturing %TRUE
TBGL_BindTexture 1
'TBGL_BindTexture 2
TBGL_ResetKeyState()
While TBGL_IsWindow(hWnd)
TBGL_ClearFrame
TBGL_Camera 0, 0, 10, _
0, 0, 0
TBGL_Rotate GetTickCount/20, 0, 1, 0
DrawQuad()
TBGL_Color 255,100,25
TBGL_Box 1,1,1
TBGL_Translate 0, 0, 3
TBGL_Color 255,100,25
TBGL_Box 1,1,1
TBGL_Translate 1, 0, 5 '--
TBGL_Color 255,100,25
'TBGL_Box 1.5,1.5,1.5
TBGL_Sphere 1.25
TBGL_UseBlend %TRUE
DrawQuad()
TBGL_UseBlend %FALSE
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
Sub DrawQuad()
tbgl_BeginPoly %GL_QUADS
tbgl_Color 255, 0, 0 ' -- Red color
tbgl_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
TBGL_Vertex -2, -2, 0
tbgl_Color 0, 255, 0 ' -- Green color
tbgl_TexCoord2D 1, 0 ' -- Texture coordinate, lower right corner
TBGL_Vertex 2, -2, 0
tbgl_Color 0, 0, 255 ' -- Blue color
tbgl_TexCoord2D 1, 1 ' -- Texture coordinate, higher right corner
TBGL_Vertex 2, 2, 0
tbgl_Color 255, 255, 0 ' -- Yellow color
tbgl_TexCoord2D 0, 1 ' -- Texture coordinate, higher left corner
TBGL_Vertex -2, 2, 0
tbgl_EndPoly
TBGL_Translate 2,0,-1
TBGL_BeginPoly %GL_QUADS
TBGL_Color 255, 0, 0 ' -- Red color
TBGL_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
TBGL_Vertex -2, -2, 0
TBGL_Color 0, 255, 0 ' -- Green color
TBGL_TexCoord2D 1, 0 ' -- Texture coordinate, lower right corner
TBGL_Vertex 2, -2, 0
TBGL_Color 0, 0, 255 ' -- Blue color
TBGL_TexCoord2D 1, 1 ' -- Texture coordinate, higher right corner
TBGL_Vertex 2, 2, 0
TBGL_Color 255, 255, 0 ' -- Yellow color
TBGL_TexCoord2D 0, 1 ' -- Texture coordinate, higher left corner
TBGL_Vertex -2, 2, 0
TBGL_EndPoly
TBGL_Translate -2,1,-4
TBGL_BeginPoly %GL_QUADS
TBGL_Color 255, 0, 0 ' -- Red color
TBGL_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
TBGL_Vertex -2, -2, 0
TBGL_Color 0, 255, 0 ' -- Green color
TBGL_TexCoord2D 1, 0 ' -- Texture coordinate, lower right corner
TBGL_Vertex 2, -2, 0
TBGL_Color 0, 0, 255 ' -- Blue color
TBGL_TexCoord2D 1, 1 ' -- Texture coordinate, higher right corner
TBGL_Vertex 2, 2, 0
TBGL_Color 255, 255, 0 ' -- Yellow color
TBGL_TexCoord2D 0, 1 ' -- Texture coordinate, higher left corner
TBGL_Vertex -2, 2, 0
TBGL_EndPoly
End Sub
two tbgl texture blending examples you find in zip file.
good night, frank
because I love this little and simple tbgl examples (found in an old tbgl folder on my notebook and didn't want to delete it!) I modified with new textures and some tbgl box, sphere. I like this kind of texture blending!
original code came from tbgl_batman petr / tbgl / "tbgl_demo3_quad_textureAndBlended".
perhaps it's also useful to learn for tbgl beginners with simple and exciting examples ;)
Uses "TBGL"
Dim hWnd As Dword
hWnd = TBGL_CreateWindowEx("Rotating textured square with blending, press ESC to quite", 640, 480, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow
TBGL_LoadTexture APP_SourcePath+"Textures/Avatar3d.Bmp", 1, %TBGL_TEX_MIPMAP
TBGL_LoadTexture APP_SourcePath+"Textures/house_interior.Bmp", 2, %TBGL_TEX_MIPMAP
TBGL_UseTexturing %TRUE
TBGL_BindTexture 1
'TBGL_BindTexture 2
TBGL_ResetKeyState()
While TBGL_IsWindow(hWnd)
TBGL_ClearFrame
TBGL_Camera 0, 0, 10, _
0, 0, 0
TBGL_Rotate GetTickCount/20, 0, 1, 0
DrawQuad()
TBGL_Color 255,100,25
TBGL_Box 1,1,1
TBGL_Translate 0, 0, 3
TBGL_Color 255,100,25
TBGL_Box 1,1,1
TBGL_Translate 1, 0, 5 '--
TBGL_Color 255,100,25
'TBGL_Box 1.5,1.5,1.5
TBGL_Sphere 1.25
TBGL_UseBlend %TRUE
DrawQuad()
TBGL_UseBlend %FALSE
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
Sub DrawQuad()
tbgl_BeginPoly %GL_QUADS
tbgl_Color 255, 0, 0 ' -- Red color
tbgl_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
TBGL_Vertex -2, -2, 0
tbgl_Color 0, 255, 0 ' -- Green color
tbgl_TexCoord2D 1, 0 ' -- Texture coordinate, lower right corner
TBGL_Vertex 2, -2, 0
tbgl_Color 0, 0, 255 ' -- Blue color
tbgl_TexCoord2D 1, 1 ' -- Texture coordinate, higher right corner
TBGL_Vertex 2, 2, 0
tbgl_Color 255, 255, 0 ' -- Yellow color
tbgl_TexCoord2D 0, 1 ' -- Texture coordinate, higher left corner
TBGL_Vertex -2, 2, 0
tbgl_EndPoly
TBGL_Translate 2,0,-1
TBGL_BeginPoly %GL_QUADS
TBGL_Color 255, 0, 0 ' -- Red color
TBGL_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
TBGL_Vertex -2, -2, 0
TBGL_Color 0, 255, 0 ' -- Green color
TBGL_TexCoord2D 1, 0 ' -- Texture coordinate, lower right corner
TBGL_Vertex 2, -2, 0
TBGL_Color 0, 0, 255 ' -- Blue color
TBGL_TexCoord2D 1, 1 ' -- Texture coordinate, higher right corner
TBGL_Vertex 2, 2, 0
TBGL_Color 255, 255, 0 ' -- Yellow color
TBGL_TexCoord2D 0, 1 ' -- Texture coordinate, higher left corner
TBGL_Vertex -2, 2, 0
TBGL_EndPoly
TBGL_Translate -2,1,-4
TBGL_BeginPoly %GL_QUADS
TBGL_Color 255, 0, 0 ' -- Red color
TBGL_TexCoord2D 0, 0 ' -- Texture coordinate, lower left corner
TBGL_Vertex -2, -2, 0
TBGL_Color 0, 255, 0 ' -- Green color
TBGL_TexCoord2D 1, 0 ' -- Texture coordinate, lower right corner
TBGL_Vertex 2, -2, 0
TBGL_Color 0, 0, 255 ' -- Blue color
TBGL_TexCoord2D 1, 1 ' -- Texture coordinate, higher right corner
TBGL_Vertex 2, 2, 0
TBGL_Color 255, 255, 0 ' -- Yellow color
TBGL_TexCoord2D 0, 1 ' -- Texture coordinate, higher left corner
TBGL_Vertex -2, 2, 0
TBGL_EndPoly
End Sub
two tbgl texture blending examples you find in zip file.
good night, frank