My Plan of a 3d modeller (oxygen)

Started by Frank Brübach, November 05, 2023, 01:50:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank Brübach

Hey all, thats only a dream to realize with oxygen but I will going on step by step to build a Kind of 3d modeller like Lightwave GUI or Cinema 4d...  One Idea ist to start with mainmenuobject example / OpenGL but I am Not Sure...

The learning effect is my prime Goal Not to bei perfekt cause I am still learning with oxygen and Here OpenGL... I See No Limits and hurdles  to climb with programming and time by time I will Post Here some efforts thx Frank

Charles Pegge

That is a good aspiration to have, Frank, I would normally rate it as a 10-15 year project but who knows what accelerated development AI assistance may bring.

With regard to Windows GUI controls, I think that most of them are intended for 'office use' and are too cumbersome to use in a graphics environment where you need access to moveable tool boxes, pickers and morphers. So for my part, apart from menus, I aim to concentrate on developing opengl based-controls.

Frank Brübach

#2
Good evening..
I have Made Up my mind with the First issue of the OpenGL modeller "promethan4d" but dont expect too much its only a starting point... Not more... Thx Charles for the OpenGL mainmenuobject example AS a Basis...

Use IT at own RISC all Work in Progress...
Use right Mouse click in Scene...
I added to "shapes"  new grids Mark linecross moving Text and a Floor

Code example in zip folder and exe File

Bye Frank

  '----------- menuObject plus Meno+Objects new 5.+7.+9.+10.Nov, 2023
  '----------- new: grid, lines,marks,floor,running text by frank brübach, germany
  '#compact
  '$ FileName  "t.exe"
  'uses RTL32
  'uses RTL64
  '
  $filename "Promethan4d_0.1g.exe"
  % MultiSamples 4
  % ExplicitMain
  % title        "Promethan4d: Pick / move objects / right-click for menu"
  % fontA        "Arial",FW_SEMIBOLD

  'macro keydown
  'case 27 : 'no action
  'case 32 : 'no action
  'end macro
  '
  uses OpenglSceneFrame
  '
  uses glo2\shapes
  uses glo2\materials
  uses glo2\particles

  %TPM_LEFTBUTTON  0x0000
  %TPM_RIGHTBUTTON  0x0002
  %TPM_LEFTALIGN    0x0000
  '
  '
  print "please take attention: use this example with own risc, all work in progress"
 
  'SCENE GLOBALS
  ==============

  indexbase 1
  float ma[16]
  float li[16]
  sys    texn[16]    'ARRAY OF TEXTURE NUMBERS
  sys    GdiplusToken '
  float  ang1        'ANIMATION ANGLE
  sys    cmd          'COMMAND MESSAGE WPARAM
  sys    cube,sphere,cylinder,cone,tors,helix,line,grid,mark,kolorbox
  sys    csface,floors,sky,camera,lights,polygonfaces,klear 'SHAPES
  sys    picknext
  sys hmo 'midi
  'Cloud cloud1
  'Smoke smoke1
  'plant fern

  static sys hMM 'main menu
  cone =-1

  sub MinTextureA(int n,f,h,b)
  ============================
  static long v[16]
  v<=
  b,b,b,b,
  b,f,h,b,
  b,h,h,b,
  b,b,b,b
  MakeTexture @v, 4, 4, n
  End sub

  =================
  class SceneObject
  =================
  '
  float  x,y,z          'POSITION
  float  sc,rz,ry      'PROPORTIONS
  float  sm            'SMOOTHING
  sys    n              'FACETS
  sys    shape
  '
  float  a.x,a.y,a.z    'ORIENTATION
  float  ax,ay,az      'ANCHOR ROTATION
  float  bx,by,bz      'ANCHOR POSITION
  '
  float*ma              'MATERIALS
  '
  method setdims(float px,py,pz,psc,prz,pry,psm,pn)
  =================================================
  x=px : y=py : z=pz : sc=psc : rz=prz : ry=pry
  sm=psm
  n=pn
  end method
  '
  method setmat(float*m) 'materials
  =================================
  @ma=@m
  end method
  '
  method setshape(sys sh)
  =======================
  shape=sh
  end method
  '
  method Render()
  ===============
  Material ma
  glPushMatrix
  gltranslatef  x,y,z
  glrotatef    a.x,1,0,0 'rotate yz  : PITCH
  glrotatef    a.y,0,1,0 'rotate xz  : YAW
  glrotatef    a.z,0,0,1 'rotate xy  : ROLL
  glscalef      sc,sc,sc
  if shape=cone
    ConeFaces    n,rz,ry,sm
  elseif shape>0
    glCallList shape
  end if
  a.y+=1 : if a.y=360 then a.y=0
  glPopMatrix
  end method
  '
  method anchor()
  ===============
  ax=a.x : ay=a.y : az=a.z
  bx=x : by=y : bz=z
  end method
  '
  method move(single mx,my,mz)
  ============================
  x=bx+mx : y=by+my : z=bz+mz
  limit
  end method
  '
  method rotate(single mx,my,mz)
  ==============================
  a.x=ax+mx : a.y=ay+my : a.z=az+mz
  end method
  '
  method limit()
  ==============
  float d=-z,id=-1/z
  if  x*id<-0.5 then x=-.5*d
  if  y*id<-0.4 then y=-.4*d
  if z>-1.0 then z=-1.0
  if x*id>.5  then x=.5*d
  if y*id>.4 then y=.4*d
  end method
  '
  method drag()
  =============
  float dx,dy,dz
  dx=mposx-sposx
  dy=sposy-mposy
  if key[VK_CONTROL]
    'a.z=-dx : a.x=-dy
    'rotate(-0.5*dy,0.0,-0.5*dx)
    rotate(-0.5*dy,0.0,0.0)
  elseif key[VK_SHIFT]
    dx=mposx-sposx
    dz=(mposy-sposy)/crect.right 
    move 0,0,20*dz
  else
    dx=mposx-sposx
    dy=sposy-mposy
    dz=-z/crect.right
    move dx*dz,dy*dz,0
  end if
  end method
  '
  end class

  sub RenderPlane(int tex, float u,v)
  ===================================
  glBindTexture GL_TEXTURE_2D,tex
  glBegin GL_QUADS
  glNormal3f 0.,1.,0.
  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
  end sub

 '#recordof sceneobject
'--------------------
  sub lines(single x,y) 'cross
'--------------------
  glPushMatrix 
  glLineWidth 4.0
  gltranslatef 0,0,-1
  glscalef    0.01,0.01,0.01
  '
  glBegin GL_LINES
  glColor4ub  250,250,150,250
  glVertex2i -200,-200
  glVertex2i  200, 200
  glColor4ub  50,250,250,250
  glVertex2i -200, 200
  glVertex2i  200,-200
  glEnd
  '
  glPopMatrix
  end sub
'-----------------
  sub marks(sys i,j)
'-----------------
  glBegin GL_LINES
  glLineWidth 1.0

  'glrotatef    ang1, 0,0,1
  gltranslatef 0,0,-1
  glscalef    0.01,0.01,0.01
  '
  'glBegin GL_LINES
  glColor4ub  250,50,0,0
  'glColor4ub  0,0,0,0
' -- X axis
  glVertex2i -500,0
  glVertex2i 500,0
  '-- Y axis     
  glVertex2i 0,500
  glVertex2i 0,-500
  glEnd

  glLineWidth 2.0
  glBegin GL_LINES   
      for i = -45 to 45 step 1 '-25 to 25
        glColor4ub 255, 200, 0, 0
        glVertex2i i, sin(i)
        glVertex2i i+1, sin(i+1)
        'glVertex2i i+0.1, sin(i+0.1)

        glColor4ub 0, 255, 200, 0
        glVertex2i i, cos(i)
        glVertex2i i+1, cos(i+1) '0.1
        'glVertex2i i+0.1, sin(i+0.1)
      next 
  glEnd
  end sub
'-----------------
  sub grids(sys i,j)
'-----------------
  glLineWidth 2.0
  gltranslatef 0,-3.5,-1.0
  glBegin GL_LINES
  for i = -20 to 20 '-10 to 10
          for j = -20 to 20
            glVertex3i -20, 0,  j   
            glVertex3i  20, 0,  j   
            glVertex3i  i,  0, -20   
            glVertex3i  i,  0,  20   
          next
        next
  glEnd
end sub
'-------------------
  sub floory(sys x,y)
'-------------------  '
  li[2]=-li[2] : lighting li 'y position 'flackert wenn aktiv
  '
  static int t1,t2,t3
  't1=texn[10] :
  't2=texn[11] :
  t3=texn[12]
  sys t1=texn[10] 'marble
  sys t2=texn[11] 'green
 

  'FLOOR TILES
  glPushMatrix
  glEnable GL_TEXTURE_2D
  glTranslatef -8.0,-1.99,-5.0
  glScalef    .25,1.,.25
  'glScalef    .75,1.6,.55
  glPushMatrix
  int i,j,a
  macro rtile1
    Material gold 'White
    RenderPlane  t3,1.,1.
    glTranslatef 2.,0.,0.
  end macro
  macro rtile2
    Material gold 'White   
    RenderPlane  t3,1.,1.
    glTranslatef 2.,0.,0.
  end macro
  for j=1 to 16
    for i=1 to 16
      if a
        rtile1
        rtile2
      else
        rtile2
        rtile1
      end if
    next
    glTranslatef -64.0,0.,-2.
    'glTranslatef -24.0,0.,-2.
    a=1-a 'alternate
  next
  glPopMatrix
  glDisable GL_TEXTURE_2D
  glPopMatrix
  Material Gold 'White

end sub

sub faces (sys a,b,c,d)
 'polygon faces not yet
end sub
'------------------ not yet
sub sauber (sys hwnd) 'clear scene
'------------------ not yet
  DeleteAllGlCompiled
  DeleteTextures  3
  Gdiplus        0
  killTimer hwnd, 1 'hwnd
end sub

  '-----------------------------------------------------------------------------------------
  function WndMessages( sys hWnd, wMsg, wParam, lparam ) as sys, link WndProcExtra, callback
  ==========================================================================================
  '
  static String      szAppName
  static POINT      pt 
  '
  select wMsg
  ===========
     
  case WM_CREATE
  '
  if mincreate then return

  'MENU ITEMS
            hMM  = CreateMenu
  static sys hMP1  = CreateMenu
  static sys hMP2  = CreateMenu
  static sys hMP3  = CreateMenu
  static sys hMP4  = CreateMenu
  static sys hMP5  = CreateMenu
 
  '
  AppendMenu hMP1 , MF_STRING,    5001,  "&New"
  AppendMenu hMP1 , MF_STRING,    5002,  "&Open..."
  AppendMenu hMP1 , MF_STRING,    5003,  "&Save"
  AppendMenu hMP1 , MF_STRING,    5004,  "Save &As..."
  AppendMenu hMP1 , MF_SEPARATOR, 0  ,  null
  AppendMenu hMP1 , MF_STRING,    4005,  "E&xit"

  AppendMenu hMP2 , MF_STRING,    5011,  "&Undo"
  AppendMenu hMP2 , MF_SEPARATOR, 0  ,  null
  AppendMenu hMP2 , MF_STRING,    5012,  "Cu&t"
  AppendMenu hMP2 , MF_STRING,    5013,  "&Copy"
  AppendMenu hMP2 , MF_STRING,    5013,  "&Paste"
  AppendMenu hMP2 , MF_STRING,    5014,  "De&lete"

  AppendMenu hMP3 , MF_STRING,    5021,  "&Help"
  AppendMenu hMP3 , MF_STRING,    5022,  "&About MenuDemo..."
  AppendMenu hMP3 , MF_STRING,    5023,  "&Objects"

  AppendMenu hMP4 , MF_STRING,    5024,  "&Polygons"
  AppendMenu hMP4 , MF_STRING,    5025,  "&Floor"
  AppendMenu hMP4 , MF_STRING,    5026,  "&Sky"
  AppendMenu hMP4 , MF_STRING,    5027,  "&B-Spline"

  AppendMenu hMP5 , MF_STRING,    7000,  "&all_objects_menu"
  AppendMenu hMP5 , MF_STRING,    7001,  "&all_material_menu"
  AppendMenu hMP5 , MF_STRING,    7002,  "&all_camera_menu"
  AppendMenu hMP5 , MF_STRING,    7003,  "&all_nature_menu"
  AppendMenu hMP5 , MF_STRING,    7012,  "&cleary"

  AppendMenu hMM  , MF_POPUP,    hMP1,  "&File"
  AppendMenu hMM  , MF_POPUP,    hMP2,  "&Edit"
  AppendMenu hMM  , MF_POPUP,    hMP3,  "&Help"
  AppendMenu hMM  , MF_POPUP,    hMP4,  "&Objects"
  AppendMenu hMM  , MF_POPUP,    hMP5,  "&FeaturesAll"
  '
  'SetMenu      hwnd, hMM

  static sys hCursorMenu
  static sys hMenu = CreateMenu 'top level popup menu
  static sys hSMe  = CreateMenu 'submenu 
  static sys hSMe1 = CreateMenu 'submenu 1 
  static sys hSMe2 = CreateMenu 'submenu 2
  static sys hSMe3 = CreateMenu 'submenu 3
  static sys hSMe4 = CreateMenu 'submenu 4
  ' 
  AppendMenu hSMe1,  MF_STRING,  4021,  "Shiny Red"
  AppendMenu hSMe1,  MF_STRING,  4022,  "Shiny Black"
  AppendMenu hSMe1,  MF_STRING,  4023,  "Steel"
  AppendMenu hSMe1,  MF_STRING,  4024,  "Bronze"
  AppendMenu hSMe1,  MF_STRING,  4025,  "Silver"
  AppendMenu hSMe1,  MF_STRING,  4026,  "Gold"
 
  'AppendMenu hSMe2,  MF_STRING,  4039,  "ColorCube"'
  AppendMenu hSMe2,  MF_STRING,  4041,  "Cube"
  AppendMenu hSMe2,  MF_STRING,  4042,  "Cone"
  AppendMenu hSMe2,  MF_STRING,  4043,  "Sphere"
  AppendMenu hSMe2,  MF_STRING,  4044,  "Torus"
  AppendMenu hSMe2,  MF_STRING,  4045,  "Helix"
  AppendMenu hSMe2,  MF_STRING,  4146,  "polygon-faces"

  AppendMenu hSMe3,  MF_STRING,  4049,  "polygon"
  AppendMenu hSMe3,  MF_STRING,  4050,  "floor"
  AppendMenu hSMe3,  MF_STRING,  5051,  "b-spline"
  AppendMenu hSMe3,  MF_STRING,  5052,  "camera"
  AppendMenu hSMe3,  MF_STRING,  5053,  "plane"

  AppendMenu hSMe4,  MF_STRING,  6000,  "direct-light"
  AppendMenu hSMe4,  MF_STRING,  6001,  "spot"
  AppendMenu hSMe4,  MF_STRING,  6002,  "parallel"
  AppendMenu hSMe4,  MF_STRING,  6003,  "diffuse"
 
  AppendMenu    hSMe2,  MF_STRING,    4046,        "Lines"
  AppendMenu    hSMe2,  MF_STRING,    4047,        "Grid"
  AppendMenu    hSMe2,  MF_STRING,    4048,        "Mark"
  AppendMenu    hSMe2,  MF_STRING,    4050,        "floor"
  AppendMenu    hSMe2 , MF_SEPARATOR, 0  ,  null
  AppendMenu    hSMe2,  MF_STRING,    4051,        "sky"
  AppendMenu    hSMe2,  MF_STRING,    5052,        "camera"
  AppendMenu    hSMe2,  MF_STRING,    5054,        "lights"
  AppendMenu    hSMe2,  MF_STRING,    5055,        "polygon-faces"

  AppendMenu hSMe ,  MF_POPUP,  hSMe1, "&Materials"
  AppendMenu hSMe ,  MF_POPUP,  hSMe2, "&Shapes"
  AppendMenu hSMe ,  MF_POPUP,  hSMe3, "&Objects"
  AppendMenu hSMe ,  MF_POPUP,  hSMe4, "&Lights"
 
  AppendMenu hSMe ,  MF_STRING,  4005,  "E&xit"
  AppendMenu hMenu,  MF_POPUP,  hSMe,  "O&bjects"
  '
  '  CheckMenuItem  hMenu,4022,  MF_CHECKED
  '  EnableMenuItem hMenu,4024,  MF_DISABLED or MF_GRAYED
  '
  hCursorMenu = GetSubMenu(hMenu, 0)
  '
  '---------------     
  case WM_COMMAND
  '---------------
  if wparam = 4005 then 'Exit       
    SendMessage hwnd, WM_CLOSE, 0, 0
  end if
  cmd=wParam
 
  case WM_KEYDOWN
    cmd=12
    act=1
  case WM_KEYUP
    cmd=12
  case WM_RBUTTONUP
    GetClientRect crect
    GetCursorPos(pt)
    TrackPopupMenu(hCursorMenu, TPM_LEFTALIGN or TPM_LEFTBUTTON or TPM_RIGHTBUTTON,
    pt.x, pt.y, 0, hwnd, null)
    bright=0 : return 1
  end select
  end function


  ========================
  sub initialize(sys hWnd)
  ========================
  '
  GDIplus 1

  static int res=256,texspace
  texspace=res*res*4
  string imgs[3]
  imgs[1]=nuls texspace
  imgs[2]=imgs[1]
  imgs[3]=imgs[1]
  'LoadPixImage "../images/crate.jpg",res,imgs[1]
  '
  glGenTextures 16, texn
  '
  seed=0x12345678
  MinTexture  texn[1],0xffffffff,0x80ffffff,0x00ffffff 'whitecloud
  MinTexture  texn[2],0xffffffff,0x80ffffff,0x00000000 'smoke
  MinTextureA texn[3],0x80000000,0x40000000,0x00000000 'soft light shadow
  MinTextureA texn[4],0xc0000000,0x60000000,0x00000000 'soft medium shadow
  MinTextureA texn[5],0xff000000,0x80000000,0x00000000 'soft intense shadow
  '
  'pixbase,width,height,stride,colorval,offset
  --------------------------------------------
  AddNoiseC strptr imgs[1],res,res,32,060,060,100,255,0x53535353,1
  AddNoiseC strptr imgs[1],res,res,16,060,060,100, 0,0x35353535
  AddNoiseC strptr imgs[1],res,res,08,070,070,050, 0,0x53535353
  AddNoiseC strptr imgs[1],res,res,02,010,010,005, 0,0x53535353
  MakeTexture strptr imgs[1],res,res,texn[10]
  '
  AddNoiseC strptr imgs[2],res,res,08,100,100,000,255,0x35353535,1
  AddNoiseC strptr imgs[2],res,res,02,100,100,000, 0,0x35353535
  AddNoiseC strptr imgs[2],res,res,01,050,050,000, 0,0x35353535
  MakeTexture strptr imgs[2],res,res,texn[11]
  '
 'AddNoiseC strptr imgs[3],res,res,32,060,060,100,128,0x53535353,1 'const alpha
  AddNoiseC strptr imgs[3],res,res,32,060,060,100,255,0x53535353
  AddNoiseC strptr imgs[3],res,res,16,060,060,100,  0,0x35353535
  AddNoiseC strptr imgs[3],res,res,08,070,070,050,  0,0x53535353
  AddNoiseC strptr imgs[3],res,res,02,010,010,005,  0,0x53535353
  MakeTexture strptr imgs[3],res,res,texn[12]
 

  'BUILD SHAPES
  cube=CompileList  : CubeForm      : glEndList
  sphere=CompileList : Spheric 1,1,6 : glEndList
  tors=CompileList  : torus 1.,.20  : glEndList
  helix=CompileList : toroid 1.,.25,.8,.16,5.,6. : glEndList
  line=CompileList  : lines 1,1      : glEndList
  grid=CompileList  : grids 1,2    : glEndList
  mark=CompileList  : marks 1,2    : glEndList
  floors=CompileList  : floory 1,2    : glEndList
  polygonfaces=CompileList  : faces 1,2,3,4    : glEndList 'not yet
  'klear=CompileList  : sauber 1    : glEndList 'clear a scene complete
  'sensitive to Compilelists:
  SetMenu hwnd, hMM
  end sub


  =====================
  sub Release(sys hwnd)
  =====================
  '
  DeleteAllGlCompiled
  Gdiplus 0
  end sub

  ===================
  sub scene(sys hWnd)
  ===================
  '
  static single ra,ri,ang1,angi1=.5
  static int framerate
  static int textrun
  local bDone as long
  static single run
  '
  '
  Lighting li
  sys hwnd
 
  ActiveFrame
  glClearColor 0.5, 0.5, 0.7, 0.0
  Fog          0.5, 0.5, 0.7, 0.035 'rgb and density
  BeginPick
    '
  'standard lighting
  ------------------
  li<=
  0.0, 8.0, 8.0, 1.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

  '
  SetTimer hWnd,1,10,null
  'end sub

  StandardLighting li
  StandardMaterial ma
  '
  'sys  t1=texn[1] 'texture'
  '
  static int t1,t2,t3
  t1=texn[10] :
  t2=texn[11] :
  t3=texn[12]
 
  '------------------------------ //
  'OBJECTS REFLECTED IN FLOOR
  ---------------------------
  'li[3]=-li[3] : lighting li 'y position
  li[2]=-li[2] : lighting li 'y position
  '
  'FLOOR TILES -------------------------- //
  glPushMatrix
  glEnable GL_TEXTURE_2D
  glTranslatef -8.0,-2.09,-5.0 '-1.99
  glScalef    .25,1.,.25
  glPushMatrix
  int i,j,a
  macro rtile1
    Material White 'gold
    RenderPlane  t3,1.,1.
    glTranslatef 2.,0.,0.
  end macro
  macro rtile2
    Material White   
    RenderPlane  t3,1.,1.
    glTranslatef 2.,0.,0.
  end macro
  for j=1 to 16
    for i=1 to 16
      if a
        rtile1
        rtile2
      else
        rtile2
        rtile1
      end if
    next
    glTranslatef -64.0,0.,-2.
    'glTranslatef -24.0,0.,-2.
    a=1-a 'alternate
  next
  glPopMatrix
  glDisable GL_TEXTURE_2D
  glPopMatrix
  Material White 
  '---------------------------------------- //
  li[2]=-li[2] : lighting li 'y position
  '-------------------------------------- //
  static SceneObject c[100]
  '
  'INITIAL DATA
  if opening
    '
    'shape        x    y    z    sc  rz ry  sm n
    '
    c[10].setdims  -0.5, -1.0, -4.0, 0.5, 0, 4. , 0, 4
    c[9].setdims  -1.5, -1.9, -4.0, 0.5, 0, 4. , 0, 4
    c[8].setdims  1.5, -1.9, -4.0, 0.5, 0, 4. , 0, 4
    c[7].setdims  2.5, -0.9, -4.0, 0.5, 0, 4. , 0, 4

    c[6].setdims  -2.5, 0.9, -10.0, 0.5, 0, 4. , 0, 4 '-16.0
    c[5].setdims  3.5, -0.29, -8.0 , 0.5, 0, 2. , 0, 10
    c[4].setdims  0.5, -0.9, -4.0 , 0.5, 0, 3. , 0, 15
    c[3].setdims -0.5, -0.6, -2.0 , 0.5,.5, 1. , 1, 30
    c[2].setdims -0.5, -0.1, -2.0 , .25,1., 2. , 1, 30
    c[1].setdims -0.5,  0.4, -2.0 , .25,0., 2. , 1, 30
    '
    c[10].setshape floors
    c[9].setshape mark
    c[8].setshape grid
    c[7].setshape line
   
    c[6].setshape cube
    c[5].setshape helix
    c[4].setshape cone
    c[3].setshape tors
    c[2].setshape sphere
    c[1].setshape cone
    '
    c[6].setmat RedShiny
    c[5].setmat BlackShiny
    c[4].setmat Steel
    c[3].setmat Bronze
    c[2].setmat Silver
    c[1].setmat Gold
    picknext=7
  end if
  '
  'PICK OR RENDER MODE
  '
  int a=lastkey-48
  select a
  case 1 to 12 : picked=a 'number keys 1..12
  end select
  '
  MoveObjectWithKeys c[picked], 0.01, 1.0
  '
  '
  'RESPOND TO MENU SELECTION
  '
  if cmd
    if picked
      if cmd=12
        if bleft or bright
          c[picked].anchor
          sposx=mposx : sposy=mposy
        end if
        goto ncmd
      end if
      float *m
      select cmd
      case 4021 : @m=@RedShiny
      case 4022 : @m=@BlackShiny
      case 4023 : @m=@Steel
      case 4024 : @m=@Bronze
      case 4025 : @m=@Silver
      case 4026 : @m=@Gold
      end select
      if @m
        c[picked].setmat m
        goto ncmd
      end if
    end if
    sys shape
    select cmd
    'case 4039 : shape=klear
    case 4041 : shape=cube
    case 4042 : shape=cone
    case 4043 : shape=sphere
    case 4044 : shape=tors
    case 4045 : shape=helix
    case 4046 : shape=line
    case 4047 : shape=grid
    case 4048 : shape=mark
    case 4050 : shape=floors
    case 4051 : shape=sky+print "sky not ready"
    case 5052 : shape=camera+print "camera not ready"
    case 5054 : shape=lights+print "lights not ready"
    case 5055 : shape=polygonfaces+print "polygonfaces not ready"
   

    end select
    if shape then
      if picked=0 then
        if picknext<=100 then
          picked=picknext
          c[picked].setdims -0.0, -0.0, -5.0 , 0.5,.5, 1. , 1, 30
          c[picked].setmat Silver
          picknext++
        end if
      end if
      if picked then c[picked].setshape shape
    end if
  end if
  ncmd:
  cmd=0 'FINISHED WITH COMMAND
  '
  'RENDER OBJECTS
  '
  sys i
  SceneObject *cc
  for i=1 to <picknext
    PickLabel i
    @cc=@c[i]
    if bleft
      if picked=i
        cc.drag
      end if
    else
      cc.anchor
    end if
    cc.render
  next
  '
  'PRINTING INFO / LABELS
  '
  'glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  if picked
    glPushMatrix
    glLoadIdentity
    gltranslatef -.5,.35,-1.0
    float w,h
    glscalef    .07,.07,.01
    GetWordArea  "Shape:",w,h
    if pick
      PutBoxArea  w,h
    else
      glColor3f    .99,.99,.00
      gprint      "Shape: "
      glColor3f    .99,.99,.99
      gprint      picked
    end if
    glPopMatrix
  end if
 '
 '--- running text ------------ //
 do until bdone
 
  'text
  gldisable GL_LIGHTING
  glloadidentity
  static int framecount
  framecount++
  run++
  gltranslatef -0.5, 1.45,-6.0
  glcolor3f .99, .50, .50
  'glscalef .06, .06, .01
  glscalef 0.4,0.4, 0.4
  gprint "frames: "+str(framecount)

  gltranslatef    0.0, -2.5, -4.0 '-4.0
  glrotatef ang1, 0.0, 0.0,  1.0
  '
  glBegin GL_TRIANGLES
  glColor3f  1.0, 0.0, 0.0 : glVertex3f  0.0,  2.0, 0.0
  glColor3f  0.0, 1.0, 0.0 : glVertex3f  -2.0, -2.0, 0.0
  glColor3f  0.0, 0.0, 1.0 : glVertex3f  2.0, -2.0, 0.0
  glEnd
  '
  glloadidentity '2
  framecount++
  run++
  gltranslatef -.5, -.25,-1.0
  'glcolor3f .29, .50, .20
  glscalef .06, .06, .01
  gltranslatef    1.0, sin(0.0+run/100), -1.0
  glColor3f 255,255,0
  gprint "counter: "+str(gettickcount/1000)
  '----------------------------------------------------------- //
  '
  bDone = true
  loop
  EndPick
  '
  'ang1+=angi1
  if ang1>360 then ang1-=360
 
  end sub
  '--------------------------------------------------- //
  MainWindow 200+width,100+height,WS_OVERLAPPEDWINDOW
  '--------------------------------------------------- //
  '

Frank Brübach

#3
Hi Charles... I have a General question about consoleG using and OpenGL whats the better way of working If I want to model via mouseclick a rectangle or Other Polygon similar to Triangel vector Data example?
I have constructed a simple Demo with rectangle Data vector and two OpenGL objects in IT See Pic below...
I suppose I cant working with both Systems together in one OpenGL window frame

Thanks Frank

Charles Pegge

I would focus on consoleG since it allows individual objects to be moved easily, and includes OpenglSceneFrame. I will also be adding shaders soon.