Recent posts

#41
OxygenBasic / Question about Redim String
Last post by Roland Stowasser - July 13, 2024, 10:56:07 AM
Hi Charles,

it seems to me that redim string(n) does not preserve contents if using in a  procedure? Is there a solution / workaround or am I doing simply something wrong?

Test_redim_string.o2bas:

uses console

cls
printl "Redim String Test in procedure"
printl
 
int count = 20
redim string dat(count)
printl "count = " count
dat(10) = "Hello" : dat(11) = "World!"
printl dat(10) " " dat(11) : printl
'dat(40) = "Goodbye!" // will crash, which is ok

count += 20
printl "count = " count
redim string dat(count)
dat(40) = "Goodbye!"
printl dat(10) " " dat(11) " " dat(40) : printl

sub Extend_dat(string dat(), int count)
printl "in Extend_dat procedure:"
printl "count = " count
printl dat(10) " " dat(11) " " dat(40) : printl
 
count +=20
printl "count = " count
redim string dat(count)
printl "dat(10,11,40) = ? " dat(10) " " dat(11) " " dat(40) : printl
end sub

Extend_dat(dat(), count)

printl "Enter ..." : waitkey

#42
OxygenBasic Examples / Re: OpenGL question gprint
Last post by Frank Brübach - July 13, 2024, 12:08:59 AM
Hello Charles.. only a Message that I Have built an Powerbasic example with rotating Font with 90 degrees and that was some piece of Work to find the solution ;) I did and found solution in a gprint function of an NeHe 17 example..

Thx nevertheless.. its Always interesting to Adept Code example or looking for similar Setups in OpenGL or other winapi examples.. I wanted to solve the solution and I did it..

Regards, Frank
#43
General Discussion / Re: Stack Overflow stopped car...
Last post by Theo Gottwald - July 12, 2024, 01:58:33 PM
𝙸 𝚍𝚘𝚗'𝚝 𝚗𝚎𝚎𝚍 𝚝𝚑𝚎𝚖 𝚝𝚘 𝚌𝚊𝚛𝚎 𝚏𝚘𝚛 𝚖𝚎. 𝙰𝚕𝚜𝚘, 𝚒𝚗 𝚝𝚒𝚖𝚎𝚜 𝚘𝚏 𝙰𝙸, 𝚒𝚝 𝚜𝚑𝚘𝚞𝚕𝚍𝚗'𝚝 𝚋𝚎 𝚊 𝚙𝚛𝚘𝚋𝚕𝚎𝚖 𝚝𝚘 𝚐𝚎𝚝 𝚑𝚊𝚗𝚍𝚜 𝚘𝚗 𝚊𝚗𝚢 𝚜𝚘𝚛𝚝 𝚘𝚏 𝚌𝚘𝚍𝚎 𝚜𝚊𝚖𝚙𝚕𝚎𝚜.

𝙸𝚌𝚑 𝚋𝚛𝚊𝚞𝚌𝚑𝚎 𝚔𝚎𝚒𝚗𝚎 𝙵ü𝚛𝚜𝚘𝚛𝚐𝚎. 𝙸𝚗 𝚉𝚎𝚒𝚝𝚎𝚗 𝚟𝚘𝚗 𝙺𝙸 𝚜𝚘𝚕𝚕𝚝𝚎 𝚎𝚜 𝚊𝚞𝚌𝚑 𝚔𝚎𝚒𝚗 𝙿𝚛𝚘𝚋𝚕𝚎𝚖 𝚜𝚎𝚒𝚗, 𝚊𝚗 𝚓𝚎𝚐𝚕𝚒𝚌𝚑𝚎 𝙰𝚛𝚝𝚎𝚗 𝚟𝚘𝚗 𝙲𝚘𝚍𝚎𝚋𝚎𝚒𝚜𝚙𝚒𝚎𝚕𝚎𝚗 𝚣𝚞 𝚐𝚎𝚕𝚊𝚗𝚐𝚎𝚗. 
#𝙺𝙸 #𝙲𝚘𝚍𝚎𝚋𝚎𝚒𝚜𝚙𝚒𝚎𝚕𝚎 #𝚃𝚎𝚌𝚑𝚗𝚘𝚕𝚘𝚐𝚒𝚎 #𝚉𝚞𝚔𝚞𝚗𝚏𝚝
#44
General Discussion / Re: Stack Overflow stopped car...
Last post by Zlatko Vid - July 12, 2024, 10:25:36 AM
what to say SO become real bu** sh**
it is really pain in the as** to find something usefull
#45
OxygenBasic Examples / Re: OpenGL question gprint
Last post by Frank Brübach - July 12, 2024, 10:11:05 AM
PS: thats what I have explored about buildFont etcpp..

' oxygen
#ifndef opengles
    #ifdef fontA
      BuildFont hWnd, hDC, hRC, 1024,"Arial",FW_NORMAL,0
    #endif
    #ifdef fontB
      BuildFont hWnd, hDC, hRC ,1280, "Courier New",600,1
      'BuildFont hWnd, hDC, hRC ,1280, fontB
    #endif
  #endif
   #ifndef opengles
    uses Glo2\OpenglSceneUtil
  #endif

sub BuildFont (sys hWnd,hDC,hRC, int base=1024, string name="Arial", int weight=FW_NORMAL, charset=DEFAULT_CHARSET)
  ===================================================================================================================
  indexbase 0
  LOGFONT   glFont
  sys       glFontHandle
  '
  glFont.lfHeight         = 1                             'Height Of Font
  glFont.lfWeight         = weight                        'Font Weight FW_BOLD etc
  glFont.lfCharSet        = charset                       'Character Set Identifier
  glFont.lfOutPrecision   = OUT_TT_PRECIS                 'Output Precision
  glFont.lfClipPrecision  = CLIP_DEFAULT_PRECIS           'Clipping Precision
  glFont.lfQuality        = ANTIALIASED_QUALITY           'Output Quality
  glFont.lfPitchAndFamily = FF_DONTCARE or DEFAULT_PITCH  'Family And Pitch
  glFont.lfFaceName       = name    ' "Arial" "Lucida Console" "Consolas" ' "Courier New"    'Font Name
  '
  glFontHandle = CreateFontIndirect(@glFont)
  glFontHandle = SelectObject(hDC, glFontHandle)
  wglUseFontOutlinesA (hDC, 0, 256, base, 0.0, .25, WGL_FONT_POLYGONS, @gmf[base-1024])
  DeleteObject(glFontHandle)
  end sub

' powerbasic
DECLARE FUNCTION CreateFontIndirectA IMPORT "GDI32.DLL" ALIAS "CreateFontIndirectA" ( _
   BYREF lplf AS LOGFONTA _                             ' __in CONST LOGFONTA *lplf
 ) AS DWORD                                             ' HFONT

DECLARE FUNCTION CreateFontIndirectW IMPORT "GDI32.DLL" ALIAS "CreateFontIndirectW" ( _
   BYREF lplf AS LOGFONTW _                             ' __in CONST LOGFONTW *lplf
 ) AS DWORD                                             ' HFONT


#IF %DEF(%USEPBDECL)
DECLARE FUNCTION wglUseFontOutlinesA LIB "OPENGL32.DLL" _
    ALIAS "wglUseFontOutlinesA" (BYVAL hdc AS DWORD, BYVAL dFirst AS DWORD, _
    BYVAL dCount AS DWORD, BYVAL dListBase AS DWORD, _
    BYVAL deviation AS SINGLE, BYVAL extrusion AS SINGLE, _
    BYVAL iFormat AS LONG, BYVAL lpgmf AS DWORD) AS LONG
#ELSE
DECLARE FUNCTION wglUseFontOutlinesA IMPORT "OPENGL32.DLL" ALIAS "wglUseFontOutlinesA" ( _
   BYVAL hdc AS DWORD _                                 ' __in HDC hdc
 , BYVAL dFirst AS DWORD _                              ' __in DWORD dFirst
 , BYVAL dCount AS DWORD _                              ' __in DWORD dCount
 , BYVAL dListBase AS DWORD _                           ' __in DWORD dListBase
 , BYVAL deviation AS SINGLE _                          ' __in FLOAT deviation
 , BYVAL extrusion AS SINGLE  _                         ' __in FLOAT extrusion
 , BYVAL iFormat AS LONG _                              ' __in int iFormat
 , BYREF lpgmf AS GLYPHMETRICSFLOAT _                   ' __out LPGLYPHMETRICSFLOAT lpgmf
 ) AS LONG                                              ' BOOL
#ENDIF

' -- > glFontHandle = CreateFontIndirect(@glFont)
' -- > createFontIndirect (wingdi.h)

#46
OxygenBasic Examples / Re: OpenGL question gprint
Last post by Frank Brübach - July 12, 2024, 09:22:57 AM
Many thanks Charles :) my example Works Well here.. Looks simple but IT isnt.. and I have explored also include files whats the meaning of build Font Function..

I dont understand a Powerbasic NeHe 13 example and tried to rotate a Font but without success..

Here's my Code snippets.. perhaps you have an Idea how I can rotate this Font Text would be great thanks, Frank

....
METHOD SetupScene

      ' Select smooth shading
      glShadeModel %GL_SMOOTH
      ' Specify clear values for the color buffers
      glClearColor 0.0!, 0.0!, 0.0!, 0.0!
      ' Specify the clear value for the depth buffer
      glClearDepth 1.0!
      ' Enable depth comparisons and update the depth buffer
      glEnable %GL_DEPTH_TEST
      ' Specify the value used for depth-buffer comparisons
      glDepthFunc %GL_LEQUAL
      ' Really nice perspective calculations
      glHint %GL_PERSPECTIVE_CORRECTION_HINT, %GL_NICEST

      ' Storage for 96 characters
      m_FontBase = glGenLists(96)
      ' Build the font
      m_hFont = CreateFont(-24, _                             ' Height of the font
                           0, _                              ' Width of the font
                           0, _                              ' Angle of escapement
                           0, _                              ' Orientation angle
                           %FW_BOLD, _                       ' Font weight
                           0, _                              ' Italic
                           0, _                              ' Underline
                           0, _                              ' Strikeout
                           %ANSI_CHARSET, _                  ' Character set identifier
                           %OUT_TT_PRECIS, _                 ' Output precision
                           %CLIP_DEFAULT_PRECIS, _           ' Clipping precision
                           %ANTIALIASED_QUALITY, _           ' Output quality
                           %FF_DONTCARE OR %DEFAULT_PITCH, _ ' Family and pitch
                           "Courier New")                    ' Font name

      ' Select our font
      m_hOldFont = SelectObject(m_hdc, m_hFont)
      ' Builds 96 characters starting at character 32
      wglUseFontBitmaps m_hdc, 32, 96, m_FontBase
      ' Select previous font
      SelectObject m_hdc, m_hOldFont
      ' Delete the font
      DeleteObject m_hFont

   END METHOD
   ' =====================================================================================

' ...

   ' =======================================================================================
   ' Render the scene
   ' =======================================================================================
METHOD RenderScene

      ' Clear the screen buffer
      glClear %GL_COLOR_BUFFER_BIT OR %GL_DEPTH_BUFFER_BIT
      ' Reset the view
      glLoadIdentity

      ' Move one unit into the screen
      glTranslatef 0.0!, 0.0!, -1.0!
      ' Pulsing colors based on text position
      glColor3f 1.0! * COS(m_cnt1), 1.0! * SIN(m_cnt2), 1.0! - 0.5! * COS(m_cnt1 + m_cnt2)

      '----------------------------------- problem zone for rotate font text to 90.0 degrees
      '
      ' glrotatef 90.0,0.0,0.0,1.0 '' thats my problem that doesnt run with only this code line
      '
      ' Position the text on the screen
      glRasterPos2f -0.45! + 0.05! * COS(m_cnt1), 0.32! * SIN(m_cnt2)
      ' Print GL text to the screen
      m_szText = "Active OpenGL Text With NeHe - " & FORMAT$(m_cnt1, "#.00")
      '----------------------------------- problem zone for rotate font text to 90.0 degrees

      ' Pushes the display list bits
      glPushAttrib %GL_LIST_BIT
      ' Sets the base character to 0
      glListBase m_FontBase - 32
      ' Draws the display list text
      glCallLists LEN(m_szText), %GL_UNSIGNED_BYTE, m_szText
      ' Pops the display list bits
      glPopAttrib
      ' Increase counters
      m_cnt1 = m_cnt1 + 0.051!
      m_cnt2 = m_cnt2 + 0.005!

      ' // Exchange the front and back buffers
      SwapBuffers m_hdc

   END METHOD
      ' =======================================================================================
   
#47
General Discussion / Stack Overflow stopped caring ...
Last post by Charles Pegge - July 12, 2024, 03:16:13 AM
Coding with Dee


#48
OxygenBasic Examples / Re: OpenGL question gprint
Last post by Charles Pegge - July 12, 2024, 03:00:17 AM
Hi Frank,

I have marked my changes '***

  ' how to set a simple text with gprint to this opgl scene ?
  '
  'includepath "$\inc\"
  $ FileName "t.exe"
  'include   "RTL32.inc"
  'include   "RTL64.inc"
  $ title    "Rotating Triangle"
  $ fontA =  "Arial",FW_SEMIBOLD '***  set font
  int width=640
  int height=480

  uses OpenglSceneFrame


  sub Initialize(sys hWnd)
  '=======================
  end sub
  '
  sub Scene(sys hWnd)
  '==================
  '
  static single ang1,angi1=1
  '
  glClearColor 0.3, 0.3, 0.5, 0
  glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
  '
  glLoadIdentity
  '
  '
  gltranslatef    0.0, 0.0, -4.0
  glrotatef ang1, 0.0, 0.0,  1.0
  '
  glBegin GL_TRIANGLES
  glColor3f   1.0, 0.0, 0.0 : glVertex3f   0.0,  1.0, 0.0
  glColor3f   0.0, 1.0, 0.0 : glVertex3f  -1.0, -1.0, 0.0
  glColor3f   0.0, 0.0, 1.0 : glVertex3f   1.0, -1.0, 0.0
  glEnd
  '
  'UPDATE ROTATION ANGLES
  '----------------------
  '
  glPushMatrix
  '
  glLoadIdentity
  static int framecount
  sys x,y
  framecount++
  gltranslatef -.5,.25,-4.0
  ''getwordarea "batman",x,y ---> dont want to use it here ;)
  glColor3f    .99,.50,.50
  glscalef     .2,.2,.01 '*** larger scale fron ,06
  gprint       str(framecount)
  '
  glpopmatrix

  glpushMatrix
  'glClearColor 0.8, 0.3, 0.5, 0 '*** remove
  glscalef     .2,.2,.01 '*** respecify scale
  glRotatef 90.0,0,0,1
  gprint "Hello triangle"
  glPopMatrix

  ang1+=angi1
  if ang1>360 then ang1-=360
  '
  end sub


  sub Release(sys hwnd)
  '====================
  end sub
#49
News and Announcements / ** Revolutionizing Automation ...
Last post by Theo Gottwald - July 11, 2024, 10:19:56 PM
The next update gives the Smart Package Robot (SPR) full access to Anthropic's powerful AI API! 🌟🔧💡

And yes, full functionality! 🔥🔍

Here are two example codes below. You can program dialogues, embed images, and ask the AI about what's in the images or if there are differences between them. 💬🖼�🤔

Currently, Anthropic AI can analyze or link up to five images. Naturally, all this is supported by SPR! 📸🤖💬

There are also many other options that are particularly useful for social network automations, such as Unicode fonts and much more. 🖋�🌐🔄

#TechNews #AI #Innovation #SmartPackageRobot #Anthropic #Automation 🚀🤖✨

[German]
🚀 Mit dem nächsten Update erhält der Smart Package Robot (SPR) vollen Zugriff auf die API von Anthropic, der leistungsstärksten KI in vielen Bereichen. 🤖✨

💥 Und zwar auf den vollen Leistungsumfang!

📌 Unten habe ich zwei Beispielcodes eingefügt. Man kann also Dialoge programmieren oder Bilder in die Dialoge einbauen und die KI fragen, was auf den Bildern zu sehen ist oder ob es Unterschiede zwischen den Bildern gibt. 🖼�🤔

📊 Derzeit erlaubt die Anthropic KI bis zu fünf Bilder zu analysieren oder zu vernetzen. Natürlich wird das alles vom SPR unterstützt! 🤝📈

💡 Es gibt auch viele weitere Optionen, die speziell im Zusammenhang mit Automatisierungen in sozialen Netzwerken sinnvoll sind, wie zum Beispiel Unicode-Fonts und vieles mehr. 🌐📲

#TechNews #AI #Innovation #SmartPackageRobot #Anthropic #Automation 🤖🚀📈🖼�

The new Social Media Influencer AddOn is free for everyone to download. It shows what you can do using the Smart Package Robot and AI.


Sample Code uses only Text-Prompts:

Set up the AI model and parameters
AIK.Set Key|Any
$$MOD=claude-3-5-sonnet-20240620
AIK.Set Mes Model|$$MOD
$$LDA=0.21
AIK.Set Temperature|$$LDA
' Initialize the conversation array
ARR.Set Array|1|0|u:Hello, I'd like to discuss some vacation plans.
ARR.Set Array|1|1|a:Hello! I'd be happy to help you with your vacation plans. What kind of vacation are you thinking about?
ARR.Set Array|1|2|u:I'm considering a beach vacation. Can you show me some popular destinations?
ARR.Set Array|1|3|a:Certainly! I'd be glad to suggest some popular beach destinations. However, as an AI language model, I can't actually show you images. But I can describe some popular beach vacation spots for you. Would you like me to list a few options?
ARR.Set Array|1|4|u:Yes, please list a few options.
' Send the conversation to the AI and store the response
AIK.Ask Chat|1|$$RES|1
' Display the AI's response
DBP.Result=$$RES
ENR.

QuoteGreat! Here are some popular beach vacation destinations:
1. Maldives: Known for its crystal-clear waters, white sandy beaches, and luxurious overwater bungalows.
2. Bali, Indonesia: Offers a mix of beautiful beaches, rich culture, and lush landscapes.
3. Maui, Hawaii: Features stunning beaches, volcanic landscapes, and excellent water sports opportunities.
4. Amalfi Coast, Italy: Combines picturesque beaches with charming coastal towns and delicious cuisine.
5. Bora Bora, French Polynesia: Famous for its turquoise lagoon, overwater bungalows, and romantic atmosphere.
Would you like more information about any of these destinations?


Sample 2 using a System Prompt and Auto-Increment variables:
Using a System Prompt can give better results:
AIK.Set Key|Any
$$MOD=claude-3-5-sonnet-20240620

AIK.Set Mes Model|$$MOD
$$LDA=0.21
AIK.Set Temperature|$$LDA

$$PRO=s:You are a Picture Detective finding the smallest difference between pictures using all technical tricks to do so.
AIK.Set System Prompt|$$PRO

' Using Auto-Increment Variable (RIV. / #aiv#) we can easily add more Parts inbetween
RIV.0
$$PIC=u:"%Image=?path\SampleA.png"
ARR.Set Array|1|#aiv#|$$PIC

$$PRO=a:Let this be Picture 1.
ARR.Set Array|1|#aiv#|$$PRO

$$PIC=u:"%Image=?path\SampleC.png"
ARR.Set Array|1|#aiv#|$$PIC

$$PRO=a:Let this be Picture 2.
ARR.Set Array|1|#aiv#|$$PRO

$$PRO=u:Was ist unterschiedlich zwischen den Bildern?
ARR.Set Array|1|#aiv#|$$PRO

AIK.Ask Chat|1|$$RES|0
'AIC.Show Error|$$RES
DBP.Temp=$$LDA
DBP.Result=$$RES
ENR.
'-------------------------------------
[19:57:43] Result=
QuoteNach sorgfältigem Vergleich der beiden Bilder habe ich drei kleine Unterschiede gefunden:
1. In Bild 2 gibt es einen gelben Punkt oder Fleck in der oberen rechten Ecke des Fensters, der in Bild 1 nicht vorhanden ist.
2. In Zeile 7 des Codes wurde in Bild 2 ein Teil des Textes nach '#EXE:' mit Gelb markiert. In Bild 1 ist dieser Teil nicht hervorgehoben.
3. In Zeile 19 des Codes wurde in Bild 2 das letzte 'S' von '$RES' gelb markiert. In Bild 1 ist dieses 'S' nicht hervorgehoben.
Diese subtilen Unterschiede beziehen sich hauptsächlich auf kleine Farbänderungen oder Hervorhebungen im zweiten Bild, die im ersten Bild nicht vorhanden sind.


#50
OxygenBasic Examples / OpenGL question gprint
Last post by Frank Brübach - July 11, 2024, 10:16:19 PM
Hello Charles..

I have some Problems to Display for this Kind of OpenGL a simple gprint for Text Message in this Scene. I dont want anything with getwordarea putboxarea.. I need it pure  Like in the beginning and simple..

Thanks


  ' how to set a simple text with gprint to this opgl scene ?
  '
  'includepath "$\inc\"
  $ FileName "t.exe"
  'include   "RTL32.inc"
  'include   "RTL64.inc"
  $ title    "Rotating Triangle"
  int width=640
  int height=480

  uses OpenglSceneFrame


  sub Initialize(sys hWnd)
  '=======================
  end sub
  '
  sub Scene(sys hWnd)
  '==================
  '
  static single ang1,angi1=1
  '
  glClearColor 0.3, 0.3, 0.5, 0
  glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
  '
  glLoadIdentity
  '
  '
  gltranslatef    0.0, 0.0, -4.0
  glrotatef ang1, 0.0, 0.0,  1.0
  '
  glBegin GL_TRIANGLES
  glColor3f   1.0, 0.0, 0.0 : glVertex3f   0.0,  1.0, 0.0
  glColor3f   0.0, 1.0, 0.0 : glVertex3f  -1.0, -1.0, 0.0
  glColor3f   0.0, 0.0, 1.0 : glVertex3f   1.0, -1.0, 0.0
  glEnd
  '
  'UPDATE ROTATION ANGLES
  '----------------------
  '
  glPushMatrix
  '
  glLoadIdentity
  static int framecount
  sys x,y
  framecount++
  gltranslatef -.5,.25,-4.0
  ''getwordarea "batman",x,y ---> dont want to use it here ;)
  glColor3f    .99,.50,.50
  glscalef     .06,.06,.01
  gprint       str(framecount)
  glpopmatrix

  glpushMatrix
  glClearColor 0.8, 0.3, 0.5, 0
  glRotatef 90.0,0,0,1
  gprint "Hello triangle"
  glPopMatrix

  ang1+=angi1
  if ang1>360 then ang1-=360
  '
  end sub


  sub Release(sys hwnd)
  '====================
  end sub