Recent posts

#1
Yes try to ask Mistral I am curious but I know there is much more to implement with vector classes ;) perhaps its possible to build Up a raytracing Rendering Scene step by step

Beside that I have a c++ Code saved Up already

Thx for asking , Frank
#2
Quote from: Frank Brübach on Today at 01:51:53 PMHello all

Hi Charles did you ever build  an example with raytracing with oxygen?
How I can mirror a sphere Texture or making some reflections?

See Photo four

I have used light Position light Ambient light diffuse light specular for my example below but thats Not enough isnt IT?

Do you have any Idea or example to study? Would be great one example I have found in c++

Oxygen openGl
  ' -- oxygen basic spheres and reflections
  ' -- how to make a mirror reflections and/or Raytracing?
  '
  #compact
  $ FileName "t.exe"
  'uses RTL32
  'uses "RTL64
  % title="Spheres and Reflections"
  % ExplicitMain ' MainWindow width,height,WS_OVERLAPPEDWINDOW
  uses OpenglSceneFrame
  uses glo2\shapes
  uses glo2\textures
  uses glo2\materials
  uses glo2\particles

  indexbase 1
  sys  GdiplusToken
  float ang1
  float ma[16]
  float li[16]
  sys  cube,sphere
  Cloud cloud1


  sub initialize(sys hWnd)
  ========================
  '
  GDIplus 1
  '
  BuildTextures 16,256
  '
  cube=CompileList  : CubeForm      : glEndList
  sphere=CompileList : Spheric 1,1,6 : glEndList
  '
  'standard lighting
  ------------------
  'li<=
  '0.0, 8.0, 8.0, 0.0,  'position / w=0 parallel or w=1 for directional
  '1.0, 1.0, 1.0, 1.0,  'ambient
  '1.0, 1.0, 1.0, 1.0,  'diffuse
  '1.0, 1.0, 1.0, 1.0  'specular


  Lighting li
  material white
  '
  end sub

  sub Release(sys hwnd)
  '====================
  glDeleteLists    cube,1
  glDeleteLists    sphere,1
  glDeleteTextures 4, texn
  Gdiplus 0
  end sub

  sub RenderCube(float x,y,z,sc,sys tex)
  ======================================
  glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef x,y,z
  glscalef sc,sc,sc
  glCallList cube
  'glCallList pent
  glPopMatrix
  end sub

  sub RenderPlane(float x,y,z,sc,tex,u,v)
  =======================================
  glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef x,y,z
  glscalef sc,1,sc
  glBegin GL_QUADS
  glTexCoord2f 0.0,0.0 : glVertex3f -1.0,0,-1.0
  glTexCoord2f u  ,0.0 : glVertex3f  1.0,0,-1.0
  glTexCoord2f u  ,v  : glVertex3f  1.0,0, 1.0
  glTexCoord2f 0.0,v  : glVertex3f -1.0,0, 1.0   
  glend
  glPopMatrix
  end sub


  sub scene(sys hWnd)
  '==================
  '
  static single ra,ri,angi1=.5
  '
  SnapShots hWnd 'Ctrl-P take snapshot
  NewFrame
  glClearColor 0.5, 0.5, 0.7, 0.0
  Fog          0.5, 0.5, 0.7, 0.035 'rgb and density
  '
  glPolygonMode GL_FRONT_AND_BACK, GL_FILL
  glEnable GL_LIGHTING
  glEnable GL_NORMALIZE

  static as single,
 
  model_diffuse(4)  => (1.0, 1.0, 1.0, 1.0), '(1.0, 0.8, 0.0, 1.0),
  model_specular(4) => (1.0, 1.0, 1.0, 1.0), '(0.0, 0.0, 1.0, 1.0),
  model_ambient(4) => (0.9, 0.9, 0.9, 1.0), '(0.0, 0.0, 1.0, 1.0),
  'model_ambient(4) => (0.75, 0.75, 0.75, 1.0), '(0.0, 0.0, 1.0, 1.0),

  model_shininess=0.1
  glColor4fv model_diffuse

  'glDisable GL_LIGHTING
  'glDepthMask GL_FALSE

  'glDisable GL_LIGHTING
 
  sys bb
  static as single,
  light_position(4) => (0.0, 8.0, 8.0, 0.0), '(0.0, 8.0, 8.0, 1.0),
  light_diffuse (4) => (0.29, 0.29, 0.29, 1.0), '(0.5, 0.5, 0.5, 1.0),
  light_specular(4) => (0.59, 0.59, 0.59, 1.0), '(0.5, 0.5, 0.5, 1.0),
  light_ambient (4) => (0.75, 0.75, 0.75, 1.0) '(0.5, 0.5, 0.5, 1.0)
  static as double aspect
 
  'Configure and enable light source 1
 
  ' here you can do some changes --------------------- //
  glLightfv GL_LIGHT1, GL_POSITION, light_position '(4) '' activate use all is white-black
  glLightfv GL_LIGHT1, GL_AMBIENT,  light_ambient(4)
  glLightfv GL_LIGHT1, GL_DIFFUSE,  light_diffuse(4) 'red effect
  glLightfv GL_LIGHT1, GL_SPECULAR, light_specular '(4)

  ' here you can do some changes --------------------- //

  glEnable GL_LIGHT1
  glEnable GL_LIGHTING


  '
  sys t1=texn[10]
  sys t2=texn[11]
  '
  'SPHERES
  glPushMatrix
  indexbase 1
  glTranslatef 4.,2.,-20.0 '-20.,10.,-60.0
  Material Red
  glScalef      4.,4.,4.
  glCallList sphere
  Material White
  glPopMatrix
  glPushMatrix
  glTranslatef 2.5,-1.0,-6.0
  glScalef      .5,.5,.5
  'glCallList sphere
  glPopMatrix
  '
  'SPHERES
  glPushMatrix
  indexbase 1
  glTranslatef -1.,2.,-10.0
  Material Gold
  glScalef      3.,3.,3.
  glCallList sphere
  Material White
  glPopMatrix
 
  glPushMatrix
  glTranslatef 2.5,-1.0,-6.0
  glScalef      .75,.75,.75
  glCallList sphere
  glPopMatrix

  glPushMatrix
  glTranslatef -2.5,-1.0,-6.0
  Material silver
  glScalef      .75,.75,.75
  glCallList sphere
  glPopMatrix


  glEnable GL_TEXTURE_2D
  '
  'RenderCube  2.5,-2.0,-6.0, 0.5,t1
  '
  RenderPlane  0.0,-2.0,-16.0,16.0,t2,8,8
  '
  glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  '
  'CLOUD
  glEnable GL_TEXTURE_2D
  glPushMatrix
  gltranslatef -10.0, -10.0, -48.0
  glscalef      20.0,12.0,1.0
  cloud1.render 30 'max 50
  glPopMatrix
  glDisable GL_TEXTURE_2D

  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 10
  end sub

  MainWindow width,height,WS_OVERLAPPEDWINDOW


Hallo Frank that looks impressive (seen from the Perspective of 2012) i remember, i have a book about AMIGA-BASIC from Data Becker which describes Raytracing in BASIC.

Let me add that you can get your answer easy and immediately if you ask
MISTRAL-AI

Don't worry, its free!

Generally Ray Tracing is a very special topic, you can not expect that Charles knows the answer.
He may also need to look it up somewhere. Means you can do that too.
Besides that Algorythms fo this topic change with time, i remember that there was "Phong Shading" and other options available in earlier times.
#3
Hello all

Hi Charles did you ever build  an example with raytracing with oxygen?
How I can mirror a sphere Texture or making some reflections?

See Photo four

I have used light Position light Ambient light diffuse light specular for my example below but thats Not enough isnt IT?

Do you have any Idea or example to study? Would be great one example I have found in c++

Oxygen openGl
  ' -- oxygen basic spheres and reflections
  ' -- how to make a mirror reflections and/or Raytracing?
  '
  #compact
  $ FileName "t.exe"
  'uses RTL32
  'uses "RTL64
  % title="Spheres and Reflections"
  % ExplicitMain ' MainWindow width,height,WS_OVERLAPPEDWINDOW
  uses OpenglSceneFrame
  uses glo2\shapes
  uses glo2\textures
  uses glo2\materials
  uses glo2\particles

  indexbase 1
  sys  GdiplusToken
  float ang1
  float ma[16]
  float li[16]
  sys  cube,sphere
  Cloud cloud1


  sub initialize(sys hWnd)
  ========================
  '
  GDIplus 1
  '
  BuildTextures 16,256
  '
  cube=CompileList  : CubeForm      : glEndList
  sphere=CompileList : Spheric 1,1,6 : glEndList
  '
  'standard lighting
  ------------------
  'li<=
  '0.0, 8.0, 8.0, 0.0,  'position / w=0 parallel or w=1 for directional
  '1.0, 1.0, 1.0, 1.0,  'ambient
  '1.0, 1.0, 1.0, 1.0,  'diffuse
  '1.0, 1.0, 1.0, 1.0  'specular


  Lighting li
  material white
  '
  end sub

  sub Release(sys hwnd)
  '====================
  glDeleteLists    cube,1
  glDeleteLists    sphere,1
  glDeleteTextures 4, texn
  Gdiplus 0
  end sub

  sub RenderCube(float x,y,z,sc,sys tex)
  ======================================
  glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef x,y,z
  glscalef sc,sc,sc
  glCallList cube
  'glCallList pent
  glPopMatrix
  end sub

  sub RenderPlane(float x,y,z,sc,tex,u,v)
  =======================================
  glBindTexture GL_TEXTURE_2D,tex
  glPushMatrix
  gltranslatef x,y,z
  glscalef sc,1,sc
  glBegin GL_QUADS
  glTexCoord2f 0.0,0.0 : glVertex3f -1.0,0,-1.0
  glTexCoord2f u  ,0.0 : glVertex3f  1.0,0,-1.0
  glTexCoord2f u  ,v  : glVertex3f  1.0,0, 1.0
  glTexCoord2f 0.0,v  : glVertex3f -1.0,0, 1.0   
  glend
  glPopMatrix
  end sub


  sub scene(sys hWnd)
  '==================
  '
  static single ra,ri,angi1=.5
  '
  SnapShots hWnd 'Ctrl-P take snapshot
  NewFrame
  glClearColor 0.5, 0.5, 0.7, 0.0
  Fog          0.5, 0.5, 0.7, 0.035 'rgb and density
  '
  glPolygonMode GL_FRONT_AND_BACK, GL_FILL
  glEnable GL_LIGHTING
  glEnable GL_NORMALIZE

  static as single,
 
  model_diffuse(4)  => (1.0, 1.0, 1.0, 1.0), '(1.0, 0.8, 0.0, 1.0),
  model_specular(4) => (1.0, 1.0, 1.0, 1.0), '(0.0, 0.0, 1.0, 1.0),
  model_ambient(4) => (0.9, 0.9, 0.9, 1.0), '(0.0, 0.0, 1.0, 1.0),
  'model_ambient(4) => (0.75, 0.75, 0.75, 1.0), '(0.0, 0.0, 1.0, 1.0),

  model_shininess=0.1
  glColor4fv model_diffuse

  'glDisable GL_LIGHTING
  'glDepthMask GL_FALSE

  'glDisable GL_LIGHTING
 
  sys bb
  static as single,
  light_position(4) => (0.0, 8.0, 8.0, 0.0), '(0.0, 8.0, 8.0, 1.0),
  light_diffuse (4) => (0.29, 0.29, 0.29, 1.0), '(0.5, 0.5, 0.5, 1.0),
  light_specular(4) => (0.59, 0.59, 0.59, 1.0), '(0.5, 0.5, 0.5, 1.0),
  light_ambient (4) => (0.75, 0.75, 0.75, 1.0) '(0.5, 0.5, 0.5, 1.0)
  static as double aspect
 
  'Configure and enable light source 1
 
  ' here you can do some changes --------------------- //
  glLightfv GL_LIGHT1, GL_POSITION, light_position '(4) '' activate use all is white-black
  glLightfv GL_LIGHT1, GL_AMBIENT,  light_ambient(4)
  glLightfv GL_LIGHT1, GL_DIFFUSE,  light_diffuse(4) 'red effect
  glLightfv GL_LIGHT1, GL_SPECULAR, light_specular '(4)

  ' here you can do some changes --------------------- //

  glEnable GL_LIGHT1
  glEnable GL_LIGHTING


  '
  sys t1=texn[10]
  sys t2=texn[11]
  '
  'SPHERES
  glPushMatrix
  indexbase 1
  glTranslatef 4.,2.,-20.0 '-20.,10.,-60.0
  Material Red
  glScalef      4.,4.,4.
  glCallList sphere
  Material White
  glPopMatrix
  glPushMatrix
  glTranslatef 2.5,-1.0,-6.0
  glScalef      .5,.5,.5
  'glCallList sphere
  glPopMatrix
  '
  'SPHERES
  glPushMatrix
  indexbase 1
  glTranslatef -1.,2.,-10.0
  Material Gold
  glScalef      3.,3.,3.
  glCallList sphere
  Material White
  glPopMatrix
 
  glPushMatrix
  glTranslatef 2.5,-1.0,-6.0
  glScalef      .75,.75,.75
  glCallList sphere
  glPopMatrix

  glPushMatrix
  glTranslatef -2.5,-1.0,-6.0
  Material silver
  glScalef      .75,.75,.75
  glCallList sphere
  glPopMatrix


  glEnable GL_TEXTURE_2D
  '
  'RenderCube  2.5,-2.0,-6.0, 0.5,t1
  '
  RenderPlane  0.0,-2.0,-16.0,16.0,t2,8,8
  '
  glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  '
  'CLOUD
  glEnable GL_TEXTURE_2D
  glPushMatrix
  gltranslatef -10.0, -10.0, -48.0
  glscalef      20.0,12.0,1.0
  cloud1.render 30 'max 50
  glPopMatrix
  glDisable GL_TEXTURE_2D

  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 10
  end sub

  MainWindow width,height,WS_OVERLAPPEDWINDOW
#4
What overpopulation looks like

Best Documentary
18 jun 2023 / orig 2021


#5
General Discussion / New Photonic Chip: The Next Er...
Last post by Charles Pegge - Yesterday at 02:13:14 PM
Use of photonics in AI / low power /  massively parallel

Anastasi In Tech
25 apr 2024


#6
OxygenBasic Examples / Re: Oxygen and c++ expl
Last post by Frank Brübach - Yesterday at 11:58:03 AM
Good morning all

So far AS I have understood namespace Works in oxygen Like
This expl I have built

' -- oxygen basic
' -- example 1)

' global_var is in the global namespace
int global_var = 10

function outer_function() as integer

    '  outer_var is in the local namespace
    int outer_var = 20

        function inner_function() as integer
        'inner_var is in the nested local namespace
        int inner_var = 30

        print inner_var
        end function

    print outer_var

    inner_function()
end function

' print the value of the global variable
print global_var

' call the outer function and print local and nested local variables
outer_function()

'------------------- //
' -- example 2)
'
'NESTABLE NAMESPACES
int vic=99

namespace maria
  namespace tom
      int vic = 200
  end namespace
end namespace
'
print maria..tom..vic '200
print vic '99
#7
OxygenBasic Examples / Re: Oxygen and c++ expl
Last post by Charles Pegge - April 28, 2024, 07:37:25 PM
<< and >> are left-shift and right shift operators. They cannot be redefined though they can be overloaded for UDTs.

namespace symbols are expressed using double dot instead of double colon.

int i=1
namespace nn
int i=2
end namespace
print i "  " nn..i '1  2
#8
OxygenBasic Examples / Oxygen and c++ expl
Last post by Frank Brübach - April 28, 2024, 02:50:51 PM
Hi Charles

I played around with c++ and oxygen and tested this example  and its running Well
I have changed Oxygen.dll for this translation you can find in ZIP folder

Oxygen basic

' oxygen basic c++ translation, 28-04-2024, frank bruebach
'
' a) only "<<" and ">>" doesnt work (double quotation mark)
' b) and "namespace" doesnt know how to use, as function ?

' include <iostream>
' using namespace std;

int main {
const int myAge = 35;
'cout << "I am " << myAge <<

cout "I am "; '\n
cout myAge " years old ";
'cout str(myAge) " years old "; ' this line works too
return 0
}
' output 35 ' ok :-)

' changed oxygen.dll for it, see zip folder

New edit: result must be " I am 35 years old"
The example gives correct result Back I did another example too
#10
Code to share / Zstring example
Last post by Frank Brübach - April 27, 2024, 09:35:36 PM
Here an interesting zstring example

'
' zstring example: reduces text with value -1
'
dim as zstring myzText = "I love Ironman"

dim i as long
for i  = 0 to len(myzText) - 1
   print "zero based try: " + myzText[i]
next

for i  = 1 to len(myzText)
   print "one based try: " + myzText[i]
next

print "fine"