Ciao Michael,
well, just a little some thousands of changes occurred in the last 7 years
I will check, it should allow to pass.
If you are in hurry just pass a LONG when you need to pass a pointer to something.
Eros
Hi Eros,
I am browsing through my huge library of TB code from back then and found that the parser doesn't like some things these days. Maybe TB has changed in the last 7 years, i don't know.
For an example, this function definition:
The parser complains about the PTR after SDL_AudioSpec. It expects a ). Is PTR not valid anymore?Function SDL_LoadWAV (ByRef szFile As Asciiz, ByVal spec As SDL_AudioSpec Ptr, ByRef audio_buf As DWord, ByRef audio_len As DWord) As DWord FUNCTION = SDL_LoadWAV_RW(SDL_RWFromFile(szFile, "rb"), 1, spec, audio_buf, audio_len) END FUNCTION
Ciao Michael,
well, just a little some thousands of changes occurred in the last 7 years
I will check, it should allow to pass.
If you are in hurry just pass a LONG when you need to pass a pointer to something.
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
No problem Eros, I am just going through some old code of mine and others I had collected over the years. And I am sure that thinBasic has envolved over such a long time. I am glad to see that you still keep your motivation high to support TB!!!!!
Michael,
I checked Core source code and I cannot find the possibility to declare function/sub parameters using PTR like: Byval <paramName> As <anytype> PTR
I also checked in old version code but nothing.
If you are sure it was thinBasic code, it is very strange: maybe some code ported from other Basic but never used?
Instead that syntax is supported in thinBasic only when using DECLARE Function/Sub .... to interface external functions from DLLs.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
It is inside an SDL.inc file . MAybe it was a powerbasic file. The calling tbasic script was from Kent, but maybe it never worked. Sorry.
But could you look at the attached scripts if you have a chance? The parser always complains and I don't know why?
Hi Michael
about the SDL there is an old posts here
http://www.thinbasic.com/community/s...ders-supported
haven't read it yet. hope it contains an answer.
but about the buggy scripts, i have corrected 3 and still trying the fourth.
Bezier-Try_Frankos_NURBS_2D.tbasic : thinbasic stopped at :
%GL_MAP1_VERTEX_3 = &H00D97
since it is loaded before, it is defined in thinbasic_gl.inc
so i have deleted it
HoverCraftAI_JasonMod_ works again if we corrected
Dim stime, etime, dtime, ifps, fps as single
seems was working before
Thanks primo. I see that with the missing type declaration now (etime).
And thanks for the link too. Next time I will better search the forum first!
I wonder what the problem with the render text demo is.
Eros: Imho the parser should have complaint about the missing type of give it a standard type.
Same goes for a duplicatedefinition of identifieres.
Hi Michael
regarding RenderedTextDemo02.tbasic
in line 31 glTexImage2D ( %GL_TEXTURE_2D.... texture) change texture to texture(1)
and change all the words size to sizo since size seems a keyword
the original thread is here
http://www.thinbasic.com/community/s...namic-textures
the Petr version in Page 2 gives more interesting graphics, just apply the same changes above
here is kryton9 program again (corrected to the current TB version)
' Demo 2 of Rendered Text by Kryton9 ' based on the great base code from ' Demonstration of rendering to texture ' Copyright (C) 2005 Julien Guertault Uses "TBGL" uses "UI" #INCLUDE "%APP_INCLUDEPATH%\thinbasic_gl.inc" #INCLUDE "%APP_INCLUDEPATH%\thinbasic_glu.inc" %_sizo = 256 static texture(3 * %_sizo * %_sizo) as GLvoid static texture_id as GLuint static window_width as LONG = 500 static window_height as LONG = 500 dim speed as double = 75 dim sizze as double = 2 dim hWnd as dword hWnd = TBGL_CreateWindowEX("Render to texture - press ESC to quit",window_width,window_height,32,0) TBGL_ShowWindow '/* OpenGL settings */ glEnable (%GL_DEPTH_TEST) '/* Texture setting */ glEnable (%GL_TEXTURE_2D) glGenTextures (1, texture_id) glBindTexture (%GL_TEXTURE_2D, texture_id) glTexImage2D ( %GL_TEXTURE_2D, 0, %GL_RGB, %_sizo, %_sizo, 0, %GL_RGB, %GL_UNSIGNED_BYTE, texture(1)) glTexParameteri (%GL_TEXTURE_2D, %GL_TEXTURE_MIN_FILTER, %GL_LINEAR) glTexParameteri (%GL_TEXTURE_2D, %GL_TEXTURE_MAG_FILTER, %GL_LINEAR) glTexParameteri (%GL_TEXTURE_2D, %GL_TEXTURE_WRAP_S, %GL_CLAMP) glTexParameteri (%GL_TEXTURE_2D, %GL_TEXTURE_WRAP_T, %GL_CLAMP) GetAsyncKeyState(%VK_ESCAPE) ' Resets ESC key status before checking while IsWindow(hWnd) glClear (%GL_COLOR_BUFFER_BIT OR %GL_DEPTH_BUFFER_BIT) glLoadIdentity glTranslatef (0, 0, -10) glRotatef (30, 1, 0, 0) glRotatef (GetTickCount/speed, 0, 1, 0) '/* Define a view-port adapted to the texture */ glMatrixMode(%GL_PROJECTION) glLoadIdentity () gluPerspective (20, 1, 5, 15) glViewport(0, 0, %_sizo, %_sizo) glMatrixMode(%GL_MODELVIEW) '/* Render to buffer */ glClearColor (255, 175, 1, 0) glClear (%GL_COLOR_BUFFER_BIT or %GL_DEPTH_BUFFER_BIT) plane() 'Cube () glFlush () '/* Copy buffer to texture */ glCopyTexSubImage2D(%GL_TEXTURE_2D, 0, 5, 5, 0, 0, %_sizo - 10, %_sizo - 10) '/* Render to screen */ glMatrixMode(%GL_PROJECTION) glLoadIdentity () gluPerspective (20, window_width / window_height, 5, 15) glViewport(0, 0, window_width, window_height) glMatrixMode(%GL_MODELVIEW) glClearColor (0, 0, 0, 0) glClear (%GL_COLOR_BUFFER_BIT or %GL_DEPTH_BUFFER_BIT) 'plane() Cube () TBGL_DrawFrame if GetAsyncKeyState(%VK_ESCAPE) THEN exit while if GetAsyncKeyState(%VK_UP) THEN speed += 1 : if speed <= 0 then speed = 1 endif if GetAsyncKeyState(%VK_DOWN) THEN speed -= 1 if GetAsyncKeyState(%VK_RIGHT) THEN sizze += 0.1 :sleep 100 if GetAsyncKeyState(%VK_LEFT) THEN sizze -= 0.1 :sleep 100 if GetAsyncKeyState(%VK_SPACE) THEN sizze = 2 speed = 75 end if TBGL_SetWindowTitle (hwnd,"ESC to quit speed = "+Format$(speed,"0.00")+" sizo = "+Format$(sizze,"0.00")) wend TBGL_DestroyWindow ' Closes TBGL window sub Cube() glBegin %GL_QUADS glTexCoord2i (0, 0) : glVertex3f (-1, -1, -1) glTexCoord2i (0, 1) : glVertex3f (-1, -1, 1) glTexCoord2i (1, 1) : glVertex3f (-1, 1, 1) glTexCoord2i (1, 0) : glVertex3f (-1, 1, -1) glTexCoord2i (0, 0) : glVertex3f ( 1, -1, -1) glTexCoord2i (0, 1) : glVertex3f ( 1, -1, 1) glTexCoord2i (1, 1) : glVertex3f ( 1, 1, 1) glTexCoord2i (1, 0) : glVertex3f ( 1, 1, -1) glTexCoord2i (0, 0) : glVertex3f (-1, -1, -1) glTexCoord2i (0, 1) : glVertex3f (-1, -1, 1) glTexCoord2i (1, 1) : glVertex3f ( 1, -1, 1) glTexCoord2i (1, 0) : glVertex3f ( 1, -1, -1) glTexCoord2i (0, 0) : glVertex3f (-1, 1, -1) glTexCoord2i (0, 1) : glVertex3f (-1, 1, 1) glTexCoord2i (1, 1) : glVertex3f ( 1, 1, 1) glTexCoord2i (1, 0) : glVertex3f ( 1, 1, -1) glTexCoord2i (0, 0) : glVertex3f (-1, -1, -1) glTexCoord2i (0, 1) : glVertex3f (-1, 1, -1) glTexCoord2i (1, 1) : glVertex3f ( 1, 1, -1) glTexCoord2i (1, 0) : glVertex3f ( 1, -1, -1) glTexCoord2i (0, 0) : glVertex3f (-1, -1, 1) glTexCoord2i (0, 1) : glVertex3f (-1, 1, 1) glTexCoord2i (1, 1) : glVertex3f ( 1, 1, 1) glTexCoord2i (1, 0) : glVertex3f ( 1, -1, 1) glEnd end sub sub plane() glBegin %GL_QUADS glColor3ub 255, 0, 0 : glTexCoord2i 0,0 : glVertex3f -sizze , -sizze, 0 glColor3ub 0 , 255, 0 : glTexCoord2i 0,1 : glVertex3f sizze , -sizze, 0 glColor3ub 0 , 0, 255 : glTexCoord2i 1,1 : glVertex3f sizze , sizze, 0 glColor3ub 255, 200, 0 : glTexCoord2i 1,0 : glVertex3f -sizze , sizze, 0 glEnd glColor3ub 255, 175, 0 end sub
In script scrollingtext_2.tbasic variable defined twice
In script RenderedTextDemo02.tbasic a pointer to the first element of the array is needed, 9th parameter is declared as GLpointer (alias of DWord) while texture is declared as GLVoid alias of ANY.FUNCTION ScrollText() STATIC MoveLeft as boolean = %true STATIC cx,cy, xpos as long static Characterwidth as long = 12 ' change this value if you choose another font. Always use a fixed font, otherwise it won't work. Static maxpos As Long = (Len($ScrollText)*Characterwidth)-cx Static MoveLeft As Boolean = %TRUE '<<<-----------Defined twice
So pass somthing like VarPtr(texture(1))
In script HoverCraftAI_JasonMod_.tbasic some variables are declared as VARIANT because they have no type declared.glTexImage2D ( %GL_TEXTURE_2D, 0, %GL_RGB, %_SIZE, %_SIZE, 0, %GL_RGB, %GL_UNSIGNED_BYTE, VarPtr(texture(1)))
In older versions of thinBasic variables declared without type were considered DOUBLE but when I introduced VARIANT this changed.
Change line 8 from
toDim stime, etime, dtime, ifps, fps As Quad
Dim stime, etime, dtime, ifps, fps As Quad as Quad '---or whatever type
In script Bezier-Try_Frankos_NURBS_2D.tbasic an hexadecimal number is not valid. It must have an even number of digits after &H.
Change line 9 from
to something like%GL_MAP1_VERTEX_3 = &H00D97
%GL_MAP1_VERTEX_3 = &H000D97
I will see if I can better intercepts those kind of errors and give better error messages.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thank you both!!!
Bookmarks