View Full Version : Why is my texture not showing
Michael Hartlef
01-10-2008, 12:24
Hi Petr,
could you please have a look at my attached code and tell me why the hell the texture of the trackelement isn't shown? I can't see the silly mistake I make here. If I use that model inside another code, it works there but I think all the setup and rendering is the same. Obviously it isn't but I can't see why.
Michael
Edit: attached version with the changes Michael suggested
Michael Hartlef
01-10-2008, 12:41
Also where should I place a call of TBGL_MouseGetWheelDelta in the code to get a result? I placed it inside the Render_01 function but it doesn't return anything besides 0.
Michael Clease
01-10-2008, 14:21
I have something like this before its to do with trying to work with TBGL before creating the window.
in this case find the chunk of code after you setup the menus and things. Then create your models.
DIALOG SET MINSIZE hDlg, 400, 350
TBGL_TestFunction = "Render_01"
TBGL_BINDCANVAS( hCtrl )
modelDIR = dir_getcurrent & "models\"
textureDIR = dir_getcurrent & "textures\"
msgbox(0,modelDIR & $CRLF & textureDIR)
If modelDIR <> "" Then
NumberofFiles = DIR_ListArray(TheFileList, modelDIR, "*.m15", %FILE_NORMAL Or %FILE_ADDPATH)
tbgl_m15InitModelBuffers NumberofFiles, 2000
maxElements = NumberofFiles
FOR count = 1 TO MaxElements
vList( Count ) = file_pathsplit(TheFileList(count), %Path_File)
tbgl_m15LoadModel TheFileList(count), "textures\", Count, Count, %TBGL_NORMAL_smooth
NEXT
if count >= 1 then partno = 1
DIALOG SHOW MODAL hDlg, CALL DlgProc
END FUNCTION
hope that helps ;)
Michael Clease
01-10-2008, 14:29
TBGL_MouseGetWheelDelta
Restrictions
This functionality is not available for canvas, only for TBGL window
Its all the help mike :P
Michael Hartlef
01-10-2008, 14:41
Thanks Mike, but that didn't change anything. :'(
Michael Clease
01-10-2008, 15:23
Try this mike.
Michael Hartlef
01-10-2008, 16:35
::) Doooh, I give up coding. Thanks for the file. Your first suggestion works perfect, once I remove the TBGL_M15LOADMODEL from its old location.
Thank you!!!
Petr Schreiber
01-10-2008, 18:17
Hi,
I am sorry to reply late again but Monday - Thursday I am from morning to late afternoon in school with no chance to get on the net.
MichaelAbraxas is right, all you need to do is to move code after creation of TBGL_CreateWindowEx or TBGL_BindCanvas. In other cases the OpenGL context is not active.
All mouse functionalities should work for control. Just that mouse wheel breaks the party.
The solution is to handle %WM_MOUSEWHEEL in dialog callback on your own.
CASE %WM_MOUSEWHEEL
Delta = HIWRD(CBWPARAM)
IF Delta/120 = Delta\120 THEN
Delta = 1
ELSE
Delta = -1
END IF
I will add this workaround to help file immediately, I am very sorry I made you scratch your head :(
I attach code for you.
Petr
UPDATED
Michael Hartlef
01-10-2008, 18:43
Thanks, no problem. Mike was a great help.
Petr Schreiber
01-10-2008, 19:10
Here is version with wheel for you,
the editor looks very promising by the way ;)
Petr
Michael Hartlef
01-10-2008, 19:40
Thanks Petr, was looking allready into it. Don't get sidetracked.
Wow, this is really great start Mike! I was not expecting anything like this so soon, thanks!