Lionheart008
15-01-2011, 13:50
hi all.
its possible to insert tbgl objects like pyramid or cube in an "existing tbgl scene" ?
I think it`s possible if I kill or replace first scene, but that isn`t my idea. I only want to know if there is a way to include a sphere or cube into an existing scene via button click. I found no way.
there are 3d modelling software they can do that and I wondered how they did such functions? my dummy function was to delete old scene and replace it with new scene, but that couldn`t final solution. any idea or help about this topic would be nice.
see my dummy example:)
'--------------------> insert objects like pyramid, cube, sphere in existing tbgl possible ?
'--------------------> demo dummy by lionheart, 14.01.2010
#MINVERSION 1.7.0.0
USES "UI", "TBGL"
DIM hDlg AS DWORD
' Rotation Variable
Dim angle As Single
' Timing Variables
Dim FrameRate As Number
' -- ID numbers of controls
Begin Const
%lblCanvas = 1000
%btnClose
%btnInfo
%myTimer
%timeOut = 10
%btnPyramid
%btnPyramid_Entity
%sScene = 1
%eCamera
%eLight
%eArrow
%eTarget
End Const
'----------------------> my dummy idea ! for replacing scene or insertion objects :)
Type TAddress
Start As Long
Length As Long
End Type
Function GetAddressLast(Address As TAddress) As Long
Function = Address.Start - 1 + Address.Length
End Function
Sub ClearScene(ByVal SceneIgnore As Long)
Dim A As Long
For A = GetAddressLast(EntityScene.Pyramids) To EntityScene.Pyramids.Start Step -1
If A <> SceneIgnore Then Call RemoveScene(A)
Next
End Sub
'----------------------> my dummy idea ! for replacing scene or insertion objects :)
Dialog New 0, "pyramid insertion test question:)",-1,-1, 320, 230, _
%WS_POPUP Or %WS_VISIBLE Or _
%WS_CLIPCHILDREN Or %WS_CAPTION OR _
%WS_SYSMENU Or %WS_MINIMIZEBOX or %WS_THICKFRAME, 0 To hDlg
dialog set color hDlg, rgb(224,224,224), rgb(224,224,224)
' -- Place controls here
CONTROL ADD label, hDlg, %lblCanvas, "", 5, 5, 310, 200
control set color hDlg, %lblCanvas, rgb(224,224,224), rgb(224,224,224)
control set resize hDlg, %lblCanvas, 1, 1, 1, 1
CONTROL ADD BUTTON, hDlg, %btnInfo, "Info", 5, 210, 60, 14
control set resize hDlg, %btnInfo, 1, 0, 0, 1
Control Add Button, hDlg, %btnPyramid, "Pyramid", 105, 210, 60, 14
Control Set Resize hDlg, %btnPyramid, 1, 0, 0, 1
Control Add Button, hDlg, %btnPyramid_Entity, "Pyramid_Entity", 175, 210, 60, 14
Control Set Resize hDlg, %btnPyramid_Entity, 1, 0, 0, 1
CONTROL ADD BUTTON, hDlg, %btnClose, "Close", 255, 210, 60, 14
control set resize hDlg, %btnClose, 0, 1, 0, 1
dialog set minsize hDlg, 320, 230
DIALOG SHOW MODal hDlg, call dlgCallback
CALLBACK FUNCTION dlgCallback()
static hCtrl as dword
local texInfo AS TBGL_tTexturingInfo
SELECT CASE CBMSG
CASE %WM_INITDIALOG
DIALOG SET TIMER CBHNDL, %myTimer, %timeOut, %NULL
Control Handle CBHNDL, %lblCanvas To hCtrl
' -- Init OpenGL
TBGL_BindCanvas(hCtrl)
TBGL_BackColor 224,224,224
' -- Prepare scene
TBGL_SceneCreate(%sScene)
TBGL_EntityCreateCamera(%sScene, %eCamera)
TBGL_EntitySetPos(%sScene, %eCamera, 0, 0, 15)
TBGL_EntitySetTargetPos(%sScene, %eCamera, 0, 0, 0)
TBGL_EntityCreateLight(%sScene, %eLight)
TBGL_EntitySetPos(%sScene, %eLight, 0, 0, 5)
TBGL_NewList 1
TBGL_BeginPoly %GL_TRIANGLES
TBGL_Normal 0, 0, 1
TBGL_Vertex -1, 0.5
TBGL_Vertex -1, -0.5
TBGL_Vertex 1, 0
TBGL_EndPoly
TBGL_EndList
TBGL_EntityCreateDLSlot(%sScene, %eArrow, 0, 1)
TBGL_EntitySetPos(%sScene, %eArrow, 1, 1, 0)
TBGL_EntitySetColor(%sScene, %eArrow, 255, 0, 0)
TBGL_EntityCreateSphere(%sScene, %eTarget, 0, 0.5)
CASE %WM_SIZE, %WM_SIZING
TBGL_UpdateCanvasProportions(hCtrl)
RenderMyImage(hCtrl)
CASE %WM_TIMER
RenderMyImage(hCtrl)
CASE %WM_CLOSE
TBGL_ReleaseCanvas(hCtrl)
DIALOG KILL TIMER CBHNDL, %myTimer
case %WM_COMMAND
select case cbctl
case %btnClose
If CBCTLMSG = %BN_CLICKED Then Dialog End hDlg
'--------------------------------------------------------------------------->
Case %btnPyramid
MsgBox 0, "hello, how to insert via buttonclick a Pyramid?"
'drawpyramid()
drawpyramid2()
Case %btnPyramid_ENTITY
MsgBox 0, "hello, how to insert via buttonclick an Entity Pyramid?"
drawpyramid_Entity()
'--------------------------------------------------------------------------->
case %btnInfo
if CBCTLMSG = %BN_CLICKED THEN
' Get info on texturing subsystem
TBGL_TexturingQuery(texInfo)
' Get some more
msgbox cbhndl, "Did you know your card supports textures as big as"+ _
STR$(texInfo.maxWidth)+" x"+STR$(texInfo.maxHeight)+"?"+$CRLF+ _
IIF$(texInfo.NPOTSupport, "You can use NPOT textures as well", "But your HW sadly does not support NPOT textures") + $CRLF(2) + _
IIF$(TBGL_oglVersionSupport(2, 0), "You have support for OpenGL 2.0 at least, no need to upgrade soon", "No support for OpenGL 2.0") +$CRLF+ _
IIF$(TBGL_oglExtensionSupport("GL_ARB_fragment_program GL_ARB_vertex_program"), "Support for some form of shaders", "No support for shaders, good TBGL does not require it :)"), _
%MB_ICONINFORMATION, _
"Info"
end if
end select
END SELECT
END FUNCTION
'-----------------------------------------> RENDER IMAGE --------------->
function RenderMyImage( hCtrl as dword )
static FrameRate as double
local angle as double
if TBGL_CanvasBound(hCtrl) then
FrameRate = TBGL_GetFrameRate
tbgl_ClearFrame
' Move target
TBGL_EntitySetColor(%sScene, %eTarget, 128+sin(GetTickCount/1000)*127,128+sin(GetTickCount/1000+1)*127,128+sin(GetTickCount/1000+2)*127)
TBGL_EntitySetpos(%sScene, %eTarget, sin(GetTickCount/1000)*5, cos(GetTickCount/2000)*5,0)
' Get angle hunter-target
angle = TBGL_EntityGetAngleXY(%sScene, %eArrow, %eTarget, %TBGL_X)
' Slowly turn towards target
TBGL_EntityTurn(%sScene, %eArrow, 0, 0, 5*angle/FrameRate )
' Move towards the target, with speed proportional to the distance
TBGL_EntityPush(%sScene, %eArrow, TBGL_EntityGetDistance(%sScene, %eArrow, %eTarget)/FrameRate, 0, 0 )
' Render it please
TBGL_SceneRender(%sScene)
TBGL_Translate 0, 0, -4 ' Move Pyramid to Centre of Screen
TBGL_Rotate angle, 0.0, 1.0, 0.0 ' Rotation Setup
'--HOW TO INSERT PYRAMID BY BUTTON CLICK ?------------------------>
'drawPyramid()
'drawPyramid2()
'--HOW TO INSERT PYRAMID BY BUTTON CLICK ?------------------------>
tbgl_DrawFrame
angle += 180.0/FrameRate
If TBGL_GetAsyncKeyState(%VK_ESCAPE) Then Exit While
end if
end function
'-----------PYRAMID 2 INSERT ? ---------------------------------------->
Sub drawPyramid2()
FrameRate = TBGL_GetFrameRate
TBGL_Rotate angle, 0.0, 1.0, 0.0 ' Rotation Setup
Local nwidth, nheight As Long
TBGL_BeginPoly %GL_TRIANGLE_FAN
TBGL_Color 0, 128, 255 : TBGL_Vertex 0.0, 1.0, 0.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_Color 255, 255, 255 : TBGL_Vertex 1.0, -1.0, 1.0
TBGL_Color 0, 0, 255 : TBGL_Vertex 1.0, -1.0, -1.0
TBGL_Color 0, 255, 0 : TBGL_Vertex -1.0, -1.0, -1.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_EndPoly
TBGL_BeginPoly %GL_QUADS ' // Begin Drawing A Single Quad
TBGL_Translate 8.0 ,-2.0 ,-14.0
TBGL_TexCoord2D 1.0 , 0.0 : TBGL_Vertex nwidth/4, 0
TBGL_TexCoord2D 0.0 , 0.0 : TBGL_Vertex 0, 0
TBGL_TexCoord2D 0.0 , 1.0 : TBGL_Vertex 0, nheight/4
TBGL_TexCoord2D 1.0 , 1.0 : TBGL_Vertex nwidth/4, nheight/4
TBGL_EndPoly ' // Done Drawing The Textured Quad
TBGL_DrawFrame ' Swap the Drawing Buffers
angle += 180.0/FrameRate
End Sub
'-----------PYRAMID 1 INSERT ? ---------------------------------------->
Sub drawPyramid()
FrameRate = TBGL_GetFrameRate
TBGL_ClearFrame ' Clear Screen
TBGL_ResetMatrix ' Reset the Current Matrix
TBGL_Camera 0, 0, 1, 0, 0, 0 ' Default Camera Position
TBGL_Translate 4, 0, -4 ' Move Pyramid to Centre of Screen
TBGL_Rotate angle, 0.0, 1.0, 0.0 ' Rotation Setup
Local nwidth, nheight As Long
TBGL_BeginPoly %GL_TRIANGLE_FAN
TBGL_Color 0, 128, 255 : TBGL_Vertex 0.0, 1.0, 0.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_Color 255, 255, 255 : TBGL_Vertex 1.0, -1.0, 1.0
TBGL_Color 0, 0, 255 : TBGL_Vertex 1.0, -1.0, -1.0
TBGL_Color 0, 255, 0 : TBGL_Vertex -1.0, -1.0, -1.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_EndPoly
TBGL_BeginPoly %GL_QUADS ' // Begin Drawing A Single Quad
TBGL_Translate 8.0 ,-2.0 ,-14.0
TBGL_TexCoord2D 1.0 , 0.0 : TBGL_Vertex nwidth/4, 0
TBGL_TexCoord2D 0.0 , 0.0 : TBGL_Vertex 0, 0
TBGL_TexCoord2D 0.0 , 1.0 : TBGL_Vertex 0, nheight/4
TBGL_TexCoord2D 1.0 , 1.0 : TBGL_Vertex nwidth/4, nheight/4
TBGL_EndPoly ' // Done Drawing The Textured Quad
TBGL_DrawFrame ' Swap the Drawing Buffers
angle += 180.0/FrameRate
End Sub
'-----------PYRAMID ENTITY INSERT ? ---------------------------------------->
Sub drawPyramid_Entity()
Static hCtrl As DWord
Local texInfo As TBGL_tTexturingInfo
' -- Init OpenGL
TBGL_BindCanvas(hCtrl)
TBGL_BackColor 224,224,224
' -- Prepare scene
TBGL_SceneCreate(%sScene)
TBGL_EntityCreateCamera(%sScene, %eCamera)
TBGL_EntitySetPos(%sScene, %eCamera, 0, 0, 15)
TBGL_EntitySetTargetPos(%sScene, %eCamera, 0, 0, 0)
TBGL_EntityCreateLight(%sScene, %eLight)
TBGL_EntitySetPos(%sScene, %eLight, 0, 0, 5)
TBGL_NewList 2
TBGL_Translate 3, 0, -4
TBGL_BeginPoly %GL_TRIANGLES
TBGL_Normal 0, 0, 1
TBGL_Vertex -1, 0.5
TBGL_Vertex -1, -0.5
TBGL_Vertex 1, 0
TBGL_EndPoly
TBGL_EndList
TBGL_EntityCreateDLSlot(%sScene, %eArrow, 0, 1)
TBGL_EntitySetPos(%sScene, %eArrow, 1, 1, 0)
TBGL_EntitySetColor(%sScene, %eArrow, 255, 0, 0)
TBGL_EntityCreateSphere(%sScene, %eTarget, 0, 0.5)
End Sub thanks frank
its possible to insert tbgl objects like pyramid or cube in an "existing tbgl scene" ?
I think it`s possible if I kill or replace first scene, but that isn`t my idea. I only want to know if there is a way to include a sphere or cube into an existing scene via button click. I found no way.
there are 3d modelling software they can do that and I wondered how they did such functions? my dummy function was to delete old scene and replace it with new scene, but that couldn`t final solution. any idea or help about this topic would be nice.
see my dummy example:)
'--------------------> insert objects like pyramid, cube, sphere in existing tbgl possible ?
'--------------------> demo dummy by lionheart, 14.01.2010
#MINVERSION 1.7.0.0
USES "UI", "TBGL"
DIM hDlg AS DWORD
' Rotation Variable
Dim angle As Single
' Timing Variables
Dim FrameRate As Number
' -- ID numbers of controls
Begin Const
%lblCanvas = 1000
%btnClose
%btnInfo
%myTimer
%timeOut = 10
%btnPyramid
%btnPyramid_Entity
%sScene = 1
%eCamera
%eLight
%eArrow
%eTarget
End Const
'----------------------> my dummy idea ! for replacing scene or insertion objects :)
Type TAddress
Start As Long
Length As Long
End Type
Function GetAddressLast(Address As TAddress) As Long
Function = Address.Start - 1 + Address.Length
End Function
Sub ClearScene(ByVal SceneIgnore As Long)
Dim A As Long
For A = GetAddressLast(EntityScene.Pyramids) To EntityScene.Pyramids.Start Step -1
If A <> SceneIgnore Then Call RemoveScene(A)
Next
End Sub
'----------------------> my dummy idea ! for replacing scene or insertion objects :)
Dialog New 0, "pyramid insertion test question:)",-1,-1, 320, 230, _
%WS_POPUP Or %WS_VISIBLE Or _
%WS_CLIPCHILDREN Or %WS_CAPTION OR _
%WS_SYSMENU Or %WS_MINIMIZEBOX or %WS_THICKFRAME, 0 To hDlg
dialog set color hDlg, rgb(224,224,224), rgb(224,224,224)
' -- Place controls here
CONTROL ADD label, hDlg, %lblCanvas, "", 5, 5, 310, 200
control set color hDlg, %lblCanvas, rgb(224,224,224), rgb(224,224,224)
control set resize hDlg, %lblCanvas, 1, 1, 1, 1
CONTROL ADD BUTTON, hDlg, %btnInfo, "Info", 5, 210, 60, 14
control set resize hDlg, %btnInfo, 1, 0, 0, 1
Control Add Button, hDlg, %btnPyramid, "Pyramid", 105, 210, 60, 14
Control Set Resize hDlg, %btnPyramid, 1, 0, 0, 1
Control Add Button, hDlg, %btnPyramid_Entity, "Pyramid_Entity", 175, 210, 60, 14
Control Set Resize hDlg, %btnPyramid_Entity, 1, 0, 0, 1
CONTROL ADD BUTTON, hDlg, %btnClose, "Close", 255, 210, 60, 14
control set resize hDlg, %btnClose, 0, 1, 0, 1
dialog set minsize hDlg, 320, 230
DIALOG SHOW MODal hDlg, call dlgCallback
CALLBACK FUNCTION dlgCallback()
static hCtrl as dword
local texInfo AS TBGL_tTexturingInfo
SELECT CASE CBMSG
CASE %WM_INITDIALOG
DIALOG SET TIMER CBHNDL, %myTimer, %timeOut, %NULL
Control Handle CBHNDL, %lblCanvas To hCtrl
' -- Init OpenGL
TBGL_BindCanvas(hCtrl)
TBGL_BackColor 224,224,224
' -- Prepare scene
TBGL_SceneCreate(%sScene)
TBGL_EntityCreateCamera(%sScene, %eCamera)
TBGL_EntitySetPos(%sScene, %eCamera, 0, 0, 15)
TBGL_EntitySetTargetPos(%sScene, %eCamera, 0, 0, 0)
TBGL_EntityCreateLight(%sScene, %eLight)
TBGL_EntitySetPos(%sScene, %eLight, 0, 0, 5)
TBGL_NewList 1
TBGL_BeginPoly %GL_TRIANGLES
TBGL_Normal 0, 0, 1
TBGL_Vertex -1, 0.5
TBGL_Vertex -1, -0.5
TBGL_Vertex 1, 0
TBGL_EndPoly
TBGL_EndList
TBGL_EntityCreateDLSlot(%sScene, %eArrow, 0, 1)
TBGL_EntitySetPos(%sScene, %eArrow, 1, 1, 0)
TBGL_EntitySetColor(%sScene, %eArrow, 255, 0, 0)
TBGL_EntityCreateSphere(%sScene, %eTarget, 0, 0.5)
CASE %WM_SIZE, %WM_SIZING
TBGL_UpdateCanvasProportions(hCtrl)
RenderMyImage(hCtrl)
CASE %WM_TIMER
RenderMyImage(hCtrl)
CASE %WM_CLOSE
TBGL_ReleaseCanvas(hCtrl)
DIALOG KILL TIMER CBHNDL, %myTimer
case %WM_COMMAND
select case cbctl
case %btnClose
If CBCTLMSG = %BN_CLICKED Then Dialog End hDlg
'--------------------------------------------------------------------------->
Case %btnPyramid
MsgBox 0, "hello, how to insert via buttonclick a Pyramid?"
'drawpyramid()
drawpyramid2()
Case %btnPyramid_ENTITY
MsgBox 0, "hello, how to insert via buttonclick an Entity Pyramid?"
drawpyramid_Entity()
'--------------------------------------------------------------------------->
case %btnInfo
if CBCTLMSG = %BN_CLICKED THEN
' Get info on texturing subsystem
TBGL_TexturingQuery(texInfo)
' Get some more
msgbox cbhndl, "Did you know your card supports textures as big as"+ _
STR$(texInfo.maxWidth)+" x"+STR$(texInfo.maxHeight)+"?"+$CRLF+ _
IIF$(texInfo.NPOTSupport, "You can use NPOT textures as well", "But your HW sadly does not support NPOT textures") + $CRLF(2) + _
IIF$(TBGL_oglVersionSupport(2, 0), "You have support for OpenGL 2.0 at least, no need to upgrade soon", "No support for OpenGL 2.0") +$CRLF+ _
IIF$(TBGL_oglExtensionSupport("GL_ARB_fragment_program GL_ARB_vertex_program"), "Support for some form of shaders", "No support for shaders, good TBGL does not require it :)"), _
%MB_ICONINFORMATION, _
"Info"
end if
end select
END SELECT
END FUNCTION
'-----------------------------------------> RENDER IMAGE --------------->
function RenderMyImage( hCtrl as dword )
static FrameRate as double
local angle as double
if TBGL_CanvasBound(hCtrl) then
FrameRate = TBGL_GetFrameRate
tbgl_ClearFrame
' Move target
TBGL_EntitySetColor(%sScene, %eTarget, 128+sin(GetTickCount/1000)*127,128+sin(GetTickCount/1000+1)*127,128+sin(GetTickCount/1000+2)*127)
TBGL_EntitySetpos(%sScene, %eTarget, sin(GetTickCount/1000)*5, cos(GetTickCount/2000)*5,0)
' Get angle hunter-target
angle = TBGL_EntityGetAngleXY(%sScene, %eArrow, %eTarget, %TBGL_X)
' Slowly turn towards target
TBGL_EntityTurn(%sScene, %eArrow, 0, 0, 5*angle/FrameRate )
' Move towards the target, with speed proportional to the distance
TBGL_EntityPush(%sScene, %eArrow, TBGL_EntityGetDistance(%sScene, %eArrow, %eTarget)/FrameRate, 0, 0 )
' Render it please
TBGL_SceneRender(%sScene)
TBGL_Translate 0, 0, -4 ' Move Pyramid to Centre of Screen
TBGL_Rotate angle, 0.0, 1.0, 0.0 ' Rotation Setup
'--HOW TO INSERT PYRAMID BY BUTTON CLICK ?------------------------>
'drawPyramid()
'drawPyramid2()
'--HOW TO INSERT PYRAMID BY BUTTON CLICK ?------------------------>
tbgl_DrawFrame
angle += 180.0/FrameRate
If TBGL_GetAsyncKeyState(%VK_ESCAPE) Then Exit While
end if
end function
'-----------PYRAMID 2 INSERT ? ---------------------------------------->
Sub drawPyramid2()
FrameRate = TBGL_GetFrameRate
TBGL_Rotate angle, 0.0, 1.0, 0.0 ' Rotation Setup
Local nwidth, nheight As Long
TBGL_BeginPoly %GL_TRIANGLE_FAN
TBGL_Color 0, 128, 255 : TBGL_Vertex 0.0, 1.0, 0.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_Color 255, 255, 255 : TBGL_Vertex 1.0, -1.0, 1.0
TBGL_Color 0, 0, 255 : TBGL_Vertex 1.0, -1.0, -1.0
TBGL_Color 0, 255, 0 : TBGL_Vertex -1.0, -1.0, -1.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_EndPoly
TBGL_BeginPoly %GL_QUADS ' // Begin Drawing A Single Quad
TBGL_Translate 8.0 ,-2.0 ,-14.0
TBGL_TexCoord2D 1.0 , 0.0 : TBGL_Vertex nwidth/4, 0
TBGL_TexCoord2D 0.0 , 0.0 : TBGL_Vertex 0, 0
TBGL_TexCoord2D 0.0 , 1.0 : TBGL_Vertex 0, nheight/4
TBGL_TexCoord2D 1.0 , 1.0 : TBGL_Vertex nwidth/4, nheight/4
TBGL_EndPoly ' // Done Drawing The Textured Quad
TBGL_DrawFrame ' Swap the Drawing Buffers
angle += 180.0/FrameRate
End Sub
'-----------PYRAMID 1 INSERT ? ---------------------------------------->
Sub drawPyramid()
FrameRate = TBGL_GetFrameRate
TBGL_ClearFrame ' Clear Screen
TBGL_ResetMatrix ' Reset the Current Matrix
TBGL_Camera 0, 0, 1, 0, 0, 0 ' Default Camera Position
TBGL_Translate 4, 0, -4 ' Move Pyramid to Centre of Screen
TBGL_Rotate angle, 0.0, 1.0, 0.0 ' Rotation Setup
Local nwidth, nheight As Long
TBGL_BeginPoly %GL_TRIANGLE_FAN
TBGL_Color 0, 128, 255 : TBGL_Vertex 0.0, 1.0, 0.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_Color 255, 255, 255 : TBGL_Vertex 1.0, -1.0, 1.0
TBGL_Color 0, 0, 255 : TBGL_Vertex 1.0, -1.0, -1.0
TBGL_Color 0, 255, 0 : TBGL_Vertex -1.0, -1.0, -1.0
TBGL_Color 255, 0, 0 : TBGL_Vertex -1.0, -1.0, 1.0
TBGL_EndPoly
TBGL_BeginPoly %GL_QUADS ' // Begin Drawing A Single Quad
TBGL_Translate 8.0 ,-2.0 ,-14.0
TBGL_TexCoord2D 1.0 , 0.0 : TBGL_Vertex nwidth/4, 0
TBGL_TexCoord2D 0.0 , 0.0 : TBGL_Vertex 0, 0
TBGL_TexCoord2D 0.0 , 1.0 : TBGL_Vertex 0, nheight/4
TBGL_TexCoord2D 1.0 , 1.0 : TBGL_Vertex nwidth/4, nheight/4
TBGL_EndPoly ' // Done Drawing The Textured Quad
TBGL_DrawFrame ' Swap the Drawing Buffers
angle += 180.0/FrameRate
End Sub
'-----------PYRAMID ENTITY INSERT ? ---------------------------------------->
Sub drawPyramid_Entity()
Static hCtrl As DWord
Local texInfo As TBGL_tTexturingInfo
' -- Init OpenGL
TBGL_BindCanvas(hCtrl)
TBGL_BackColor 224,224,224
' -- Prepare scene
TBGL_SceneCreate(%sScene)
TBGL_EntityCreateCamera(%sScene, %eCamera)
TBGL_EntitySetPos(%sScene, %eCamera, 0, 0, 15)
TBGL_EntitySetTargetPos(%sScene, %eCamera, 0, 0, 0)
TBGL_EntityCreateLight(%sScene, %eLight)
TBGL_EntitySetPos(%sScene, %eLight, 0, 0, 5)
TBGL_NewList 2
TBGL_Translate 3, 0, -4
TBGL_BeginPoly %GL_TRIANGLES
TBGL_Normal 0, 0, 1
TBGL_Vertex -1, 0.5
TBGL_Vertex -1, -0.5
TBGL_Vertex 1, 0
TBGL_EndPoly
TBGL_EndList
TBGL_EntityCreateDLSlot(%sScene, %eArrow, 0, 1)
TBGL_EntitySetPos(%sScene, %eArrow, 1, 1, 0)
TBGL_EntitySetColor(%sScene, %eArrow, 255, 0, 0)
TBGL_EntityCreateSphere(%sScene, %eTarget, 0, 0.5)
End Sub thanks frank