Hi Rene,
I think your problem is that you pass wrong parameters to repeat$ function, first goes the number of repetitions, please see the manual.
Textures cannot be automagically transparent, you can make them appear so by enabling alpha blending and/or alpha testing first.
Here is basic example, where you can test the transparency nicely (just change the transparency variable to anything between 0 (invisible) to 255(fully visible):
'
' Creating texture from string
' Petr Schreiber, 2012
'
Uses "TBGL"
Function TBMain()
Local hWnd As DWord
Local FrameRate As Double
' -- Create and show window
hWnd = TBGL_CreateWindowEx("TBGL script - press ESC to quit", 640, 480, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow
Long nWidth = 256
Long nHeight= 256
Long transparency = 128 ' -- 0 = fully transparent, 255 = fully solid
String sTextureData = Repeat$(nWidth*nHeight, Chr$(0, 0, 0, 255))
TBGL_MakeTexture sTextureData, %TBGL_DATA_RGBA, nWidth, nHeight, 1, %TBGL_TEX_LINEAR
TBGL_BackColor 255, 255, 255, 255
' -- Resets status of all keys
TBGL_ResetKeyState()
' -- Main loop
While TBGL_IsWindow(hWnd)
FrameRate = TBGL_GetFrameRate
TBGL_ClearFrame
TBGL_Camera 0, 0, 2, 0, 0, 0
' -- Use texturing and blending on textured quad
TBGL_PushState %TBGL_TEXTURING Or %TBGL_BLEND
TBGL_PushTexture 1
TBGL_PushBlendFunc %GL_SRC_ALPHA, %GL_ONE_MINUS_SRC_ALPHA
TBGL_BeginPoly %GL_QUADS
TBGL_TexCoord2D 0, 0
TBGL_Vertex -0.5, -0.5
TBGL_TexCoord2D 1, 0
TBGL_Vertex 0.5, -0.5
TBGL_TexCoord2D 1, 1
TBGL_Vertex 0.5, 0.5
TBGL_TexCoord2D 0, 1
TBGL_Vertex -0.5, 0.5
TBGL_EndPoly
TBGL_PopBlendFunc
TBGL_PopTexture
TBGL_PopState
TBGL_DrawFrame
' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
End Function
Petr
Bookmarks