Author Topic: Cubic Sphere example how to convert to 64bits  (Read 120 times)

0 Members and 1 Guest are viewing this topic.

chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Cubic Sphere example how to convert to 64bits
« on: April 11, 2018, 08:17:24 PM »
Hello

In the examples, there is a program called cubicsphere.o2bas

i'm trying to convert this program to 64bit but can't. 
 i  uses RTL64  , it can be compiled  to exe but when run it became a blank screen

if i uses RTL32  the cubic sphere is shown


Code: [Select]
  $ title "Cubic sphere"
  $ FileName "Cubicsphere.exe"
  uses RTL64

  % ExplicitMain
  % MultiSamples 4 '0..4..16
  include "OpenglSceneFrame.inc"
  uses glo2\shapes
  uses glo2\materials
  uses glo2\textures
  uses particles
  uses MinMidi

  indexbase 1
  float ang1
  sys   cube,sphere,helix,tors,csface
  sys hmo 'midi
  Cloud cloud1
  Smoke smoke1
  Plant fern

  sub InitMidi()
  ================
  sys er
  er=midiOutOpen(hmo, 0, 0, 0, CALLBACK_NULL) '0=synth a 2=soft synth
  midiOutShortMsg(hmo, 0xC0+0x0D00)           'Xylophone Bells assign
  end sub

  function ding(sys v,n)
  ======================
  if v>127 then v=127
  if v<10 then v=10
  'midiOutShortMsg(hmo, v*0x10000+n*0x100+0x89) 'percussion off
  midiOutShortMsg(hmo, v*0x10000+n*0x100+0x99) 'percussion on
  end function


  sub initialize(sys hWnd)
  ========================
  '
  InitMidi
  GDIplus 1
  '
  static sys p,res=256
  BuildTextures 16,res
  p=fern.new res,32000 'pixel map
  MakeTexture p,res,res,texn[12]
  fern.free

  cube=CompileList   : CubeForm      : glEndList
  sphere=CompileList : Spheric 1,1,6 : glEndList
  '
  SetTimer hWnd,1,10,null
  end sub


  sub Release(sys hwnd)
  '====================
  DeleteAllGlCompiled
  DeleteTextures  16
  Gdiplus         0
  killTimer       hwnd, 1
  MidiOutClose    hmo
  end sub

  sub RenderPlane(float tex,u,v)
  ==============================
  glBindTexture GL_TEXTURE_2D,tex
  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
  end sub


  sub scene(sys hWnd)
  ===================
  '
  static single ra,ri,angi1=.4
  '
  ActiveFrame
  glClearColor 0.5, 0.5, 0.7, 0
  Fog          0.5, 0.5, 0.7, 0.020
  StandardLighting li
  '
  sys t1=texn[10]
  sys t2=texn[11]
  '
  'MYSTERIOUS RED PLANET
  glPushMatrix
  glTranslatef -20.,10.,-95.0
  RedMaterial.act
  glScalef      6.,6.,6.
  glEnable GL_LIGHTING
  glCallList sphere
  'glDisable GL_LIGHTING
  WhiteMaterial.act
  glPopMatrix
  '
  'TILES
  glPushMatrix
  glEnable GL_TEXTURE_2D
  glTranslatef -8.0,-1.99,-5.0
  glScalef     .25,1.,.25
  glPushMatrix
  sys i,j
  for j=1 to 16
    for i=1 to 16
      RenderPlane  t1,1.,1.
      glTranslatef 4.,0.,0.
    next
    glTranslatef -62.,0.,-2.
  next
  glPopMatrix
  glDisable GL_TEXTURE_2D
  glPopMatrix
  '
  'GREEN PLANE
  glPushMatrix
  glEnable GL_TEXTURE_2D
  glTranslatef 0.0,-2.0,-29.0
  glScalef     16.,1.,16.
  RenderPlane  t2,8.,8.
  glDisable GL_TEXTURE_2D
  glPopMatrix
  '
  'SOFT SHADOWS
  glEnable GL_TEXTURE_2D
  glPushMatrix
  glTranslatef -1.2,-1.98,-5.8 'for plinth
  glScalef     2.,1.,1.5
  RenderPlane  texn[4],1.,1.
  glPopMatrix
  '
  glPushMatrix
  glTranslatef -3.5,-1.98,-7.5 'for cylinder
  glScalef     1.,1.,1.
  RenderPlane  texn[3],1.,1.
  glPopMatrix
  '
  glPushMatrix
  glTranslatef 2.5,-1.98,-5.5 'for sphere
  glScalef     .7,.7,.7
  RenderPlane  texn[3],1.,1.
  glPopMatrix
  'glDisable GL_TEXTURE_2D
  '
  glPushMatrix
  glTranslatef -0.,-1.98,-10. 'for metal balls
  glScalef     .7,.7,.7
  RenderPlane  texn[3],1.,1.
  glPopMatrix
  glDisable GL_TEXTURE_2D
  '
  '
  'RING
  GoldMaterial.act
  'glEnable GL_TEXTURE_2D
  'glBindTexture GL_TEXTURE_2D,texn[2]
  glPushMatrix
  glTranslatef 3.0,-1.6,-7.0
  'glrotatef -45.,0,1,0
  'glrotatef 90.0,1,0,0
  glScalef      .75,1.00,.75
  if not tors
    tors=CompileList : torus 1.,.20 : glEndList
  end if
  glCallList tors
  glPopMatrix
  glDisable GL_TEXTURE_2D
  '
  'METALLIC ORBS
  glPushMatrix
  glTranslatef 0.5,-1.5,-8.0
  glScalef      .25,.25,.25
  SilverMaterial.act
  glCallList sphere
  glPopMatrix
  '
  glPushMatrix
  glTranslatef 1.0,-1.5,-9.0
  glScalef      .25,.25,.25
  SteelMaterial.act
  glCallList sphere
  glPopMatrix
  '
  'GLOBE
  if not csface
    csface=CompileList
    CubicFace 8
    glEndList
  end if
  glPushMatrix
  glTranslatef -1.0,0.,-6.0
  glRotatef ang1,0,1,0
  'RedShinyMaterial.act
  whiteMaterial.act
  glEnable GL_TEXTURE_2D
  glBindTexture GL_TEXTURE_2D,t2'texn(3)
  glCallList csface
  glRotatef 90.0,0,1,0
    glCallList csface
  glRotatef 90.0,0,1,0
  glCallList csface
  glRotatef 90.0,0,1,0
  glCallList csface
  glRotatef 90.0,1,0,0
  glCallList csface
  glRotatef 180.0,1,0,0 'top
  glCallList csface
  glPopMatrix
  '
  'BACKGROUND MOUND
  glPushMatrix
  glTranslatef 7.0,-9.5,-20.0
  glRotatef -90.,1,0,0
  glScalef    10.,10.,10.
  glCallList csface
  glPopMatrix
  glDisable GL_TEXTURE_2D
  '
  'CONE
  glPushMatrix
  SilverMaterial.act
  glTranslatef -2.0,-1.5,-6.0
  glScalef    .5,.5,.5
  glBindTexture GL_TEXTURE_2D,t1
  ConeFaces 16,0.,2.,0.
  glPopMatrix
  '
  'CYLINDER
  glPushMatrix
  BronzeMaterial.act
  glTranslatef -4.,-2.,-8.0
  glScalef    .25,.5,.25
  ConeFaces 16,1.,8.,1.
  glPopMatrix
  '
  'LIGHT SPHERE
  float e[8]={1.,1.,.5,.1}
  glMaterialfv GL_FRONT, GL_EMISSION, e
  glPushMatrix
  glTranslatef -4.0,2.5,-8.0
  glScalef      .5,.5,.5
  SteelMaterial.act
  glCallList sphere
  glPopMatrix
  glMaterialfv GL_FRONT, GL_EMISSION, e[5] 'emission off
 
  '
  'CYLINDER (SMOKER)
  glPushMatrix
  SteelMaterial.act
  gltranslatef  2, -2.,-30.
  glScalef      .125,.5,.125
  ConeFaces 16,1.,2.,1.
  glPopMatrix
  '
  '
  glEnable GL_TEXTURE_2D
  WhiteMaterial.act
  '
  'PLINTH
  glPushMatrix
  glTranslatef -1.0,-1.5,-6.0
  glrotatef   30.0,0,1,0
  glScalef    .5,.5,.5
  glBindTexture GL_TEXTURE_2D,t1
  glCallList cube
  glPopMatrix

  glDisable GL_TEXTURE_2D
  glDisable GL_LIGHTING
  '
  'CLOUD
  glEnable GL_TEXTURE_2D
  glPushMatrix
  gltranslatef -10.0, -10.0, -90.0
  glscalef      20.0,12.0,1.0
  cloud1.render 30 'max 50
  glPopMatrix
  glDisable GL_TEXTURE_2D
  '
  'SMOKE
  glDisable GL_LIGHTING
  glEnable GL_TEXTURE_2D
  glBindTexture GL_TEXTURE_2D,texn[2]
  glPushMatrix
  gltranslatef  2, -.9, -30.
  glScalef      2.,2.5,1.0
  smoke1.r<=    .45,.45,.55
  smoke1.render 25 'max 50
  'cloud1.render  15
  glPopMatrix
  glDisable GL_TEXTURE_2D
  'glEnable GL_LIGHTING
  '
  'PLANTS
  glBindTexture GL_TEXTURE_2D,texn(12)
  glEnable GL_TEXTURE_2D
  '
  glPushMatrix
  glTranslatef 1.,-1.,-3.0
  glScalef    .9,.9,1.
  glColor4f   .0,.1,.0,1.
  quadtex     1,1,0
  glPopMatrix
  '
  glPushMatrix
  glTranslatef .7,-1.,-2.99
  glscalef     .9,.9,1.
  glColor4f    .0,.2,.0,1.
  glRotatef    10.,0,0,1
  quadtex      1.,1.,0
  glPopMatrix
  '
  glPushMatrix
  glTranslatef .5,-1.,-2.98
  glscalef     .9,.9,1.
  glColor4f    .0,.3,.0,1.
  'quadtex      1.,1.,0
  glPopMatrix
  '
  glDisable GL_TEXTURE_2D
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  sleep 10
  end sub

  MainWindow width,height,WS_OVERLAPPEDWINDOW




Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3584
    • Oxygen Basic
Re: Cubic Sphere example how to convert to 64bits
« Reply #1 on: April 12, 2018, 05:30:04 AM »
Hi Chris,

Examples such as this, require a general sys/int cleanup for 64bit operation

I've done 3 important ones attached below

Also included: shapes.inc and materials.inc to go into the inc\glo2 folder.

chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Re: Cubic Sphere example how to convert to 64bits
« Reply #2 on: April 12, 2018, 06:08:24 AM »
Very impressive Charles, the exe files are so tiny!

Thanxx a lot,  so can we just find and replace int with sys in the include files in order to
compile to 64bits?


chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Re: Cubic Sphere example how to convert to 64bits
« Reply #3 on: April 12, 2018, 06:18:42 AM »
Hi Charles

how to add some labels into the background of these spheres?

i have a PB program that can do this, but i do not know how to do it in O2, see the atteched image


chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Re: Cubic Sphere example how to convert to 64bits
« Reply #4 on: April 12, 2018, 06:25:24 AM »
here's the PB program which does sprites and has background labels

Code: [Select]
' Sprite Trans.bas  clean
#COMPILE EXE
DEFLNG I - N
#INCLUDE "Win32API.inc"



 GLOBAL hWin AS DWORD


'dialog screen size
%w_wide = 440
%w_high = 380



'sprite type; expandable by user
TYPE sprite
    Merge AS DWORD
    Mask  AS DWORD
    high  AS LONG
    wide  AS LONG
    xpos  AS LONG
    ypos  AS LONG
    xdir  AS LONG
    ydir  AS LONG
    skip  AS LONG
END TYPE





'==================================
FUNCTION PBMAIN () AS LONG
      DispMainDialog
END FUNCTION


'====================================
SUB DispMainDialog
    LOCAL bg_bmp AS DWORD
    LOCAL ball() AS sprite
    LOCAL sTemp AS STRING
    LOCAL hDC AS LONG

    ' if this is commented off then it would display a continous
    ' strings of balls
      background_setup bg_bmp

    RANDOMIZE TIMER
    ' Note that no caption will mean no title bar  %SS_NOTIFY
    GRAPHIC WINDOW NEW "", 300, 200, %w_wide, %w_high TO hWin
    GRAPHIC ATTACH hWin, 0
    GRAPHIC CLEAR %RGB_HONEYDEW


    GRAPHIC ATTACH hWin, 0
    GRAPHIC COPY bg_bmp, 0


    sprite_setup ball()
    GRAPHIC ATTACH hWin, 0
    FOR I = 0 TO UBOUND(Ball)
      GRAPHIC COPY Ball(I).Merge, 0 TO (Ball(I).Xpos, Ball(I).Ypos), %MIX_MERGESRC
      GRAPHIC COPY Ball(I).Mask, 0 TO (Ball(I).Xpos, Ball(I).Ypos), %MIX_MASKSRC
    NEXT I


    GRAPHIC DETACH

  ' display the text labels -- if commented off we can exit
  ' the program using the ESC key
    'ShowLabels

    DO
        SLEEP 1
        GRAPHIC ATTACH hWin, 0
        DrawFixLabels

       'if a key is pressed - exit the program
        GRAPHIC INKEY$ TO sTemp
        IF LEN(sTemp) >= 1 THEN
             GRAPHIC WINDOW END
              EXIT LOOP
        END IF
        IF ASC(sTemp)= 27 THEN
          '  exit if ESCAPE key is pressed
            GRAPHIC WINDOW END
            EXIT LOOP
        END IF

        'GRAPHIC DETACH

        'update sprites
        sprite_update ball()
        DrawFixLabels

        'update screen
        screen_update(hWin, bg_bmp, ball())
        DrawFixLabels
        IF ISWIN(hWin) = 0 THEN
             GRAPHIC WINDOW END
             EXIT LOOP
        END IF

        'reduce CPU resource consumption
        SLEEP 1

       'if hDC becomes 0, program is closing
        GRAPHIC GET DC TO hDC
  LOOP UNTIL hDC = 0
END SUB





'================================
' Draws the labels
SUB DrawFixLabels
  GRAPHIC ATTACH hWin, 0

    LOCAL  hFONT_bold AS DWORD
    ' Bold font for the label
    FONT END hFONT_bold
    FONT NEW "Arial",9,1 TO hFONT_bold
    GRAPHIC SET FONT  hFONT_bold


  ' the -2 makes the label background transparent
  GRAPHIC COLOR  %RGB_DARKGREEN, -2    '%RGB_HONEYDEW            '-1, -2
  GRAPHIC SET POS (45, 80)
  GRAPHIC PRINT "This is fixed Label 1 but it does NOT flicker **** "

  GRAPHIC COLOR  %RGB_DARKGREEN,%RGB_HONEYDEW
  GRAPHIC SET POS (45, 120)
  GRAPHIC PRINT "This is fixed Label 2 and this label flickers  "

  GRAPHIC COLOR  %RGB_DARKGREEN,-2
  GRAPHIC SET POS (45, 160)
  GRAPHIC PRINT "This is fixed Label 3 and this label flickers  "

  GRAPHIC COLOR  %RGB_DARKGREEN, -2
  GRAPHIC SET POS (45, 200)
  GRAPHIC PRINT "This is fixed Label 4 and this label flickers  "

  ' clean up
  FONT END hFONT_bold

END SUB






'=====================================
' draw the background graphic
SUB background_setup(hbmp AS DWORD)
    LOCAL  x, y AS LONG
    GRAPHIC BITMAP NEW %w_wide, %w_high TO hbmp
    GRAPHIC ATTACH hbmp, 0
    GRAPHIC CLEAR %RGB_HONEYDEW

     GRAPHIC DETACH
END SUB


'========================================
SUB sprite_setup(mobs() AS sprite)
LOCAL itr8, shadow, shine, bmpindex, color_red, color_green,_
       color_blue, color_show, offset, limit AS LONG
limit = 64 - 1
shine = 20
REDIM mobs(5)
FOR bmpindex = 0 TO 5
    GRAPHIC BITMAP NEW limit, limit TO mobs(bmpindex).Merge
    GRAPHIC ATTACH mobs(bmpindex).Merge, 0
    GRAPHIC CLEAR %RGB_HONEYDEW

    FOR shadow = 0 TO shine
        offset = shadow * 2
        SELECT CASE bmpindex
            CASE 0
              color_red = 255
              color_green = shadow * 8
              color_blue = shadow * 8

            CASE 1
              color_red = shadow * 8
              color_green = 255
              color_blue = shadow * 8

            CASE 2
              color_red = shadow * 8
              color_green = shadow * 8
              color_blue = 255

            CASE 3
              color_red = 175 + (4*shadow)
              color_green = 175 + (4*shadow)
              color_blue = shadow * 8

            CASE 4
              color_red = 175 + (4*shadow)
              color_green = shadow * 8
              color_blue = 175 + (4*shadow)

            CASE 5
              color_red = shadow * 8
              color_green = 175 + (4*shadow)
              color_blue = 175 + (4*shadow)
        END SELECT

        color_show = RGB(color_red, color_green, color_blue)
        GRAPHIC ELLIPSE (shadow, shadow)-(limit - offset, limit - offset), color_show, color_show
    NEXT
    GRAPHIC DETACH
    mobs(bmpindex).xpos = RND(1, 336)
    mobs(bmpindex).ypos = RND(1, 336)
    mobs(bmpindex).xdir = RND(1, 6)
    mobs(bmpindex).ydir = RND(1, 6)
    mobs(bmpindex).skip = %RGB_HONEYDEW
    mobs(bmpindex).high = limit + 1
    mobs(bmpindex).wide = limit + 1

    CALL CreateBitMapMask(Mobs(bmpindex).Merge, Mobs(bmpindex).Mask, Mobs(bmpindex).Skip)

NEXT
END SUB



'======================================
SUB CreateBitMapMask(MergeHndl AS DWORD, _
    MaskHndl AS DWORD, BYVAL BackColor AS DWORD)

REGISTER I          AS LONG

LOCAL Xwide, _
      Yhigh         AS LONG

LOCAL MergeStr, _
      MaskStr       AS STRING

LOCAL MrgPtr, _
      MskPtr        AS DWORD POINTER

LOCAL BkgPtr        AS BYTE POINTER

GRAPHIC ATTACH MergeHndl, 0
GRAPHIC GET BITS TO MergeStr$

MaskStr$ = MergeStr$

MrgPtr = STRPTR(MergeStr$)
MskPtr = STRPTR(MaskStr$) + 8

' SAME AS BGR(COLOR) BUT
' REQUIRES 1 LESS FUNCTION CALL
BkgPtr = VARPTR(BackColor)
SWAP @BkgPtr[0], @BkgPtr[2]

'  FIRST 8 BYTES OF THE STRING
'  IS THE WIDTH AND HEIGHT OF THE IMAGE
Xwide = @MrgPtr[0]
Yhigh = @MrgPtr[1]

MrgPtr = MrgPtr + 8

' PARSE STRING FOR COLOR VALUES
FOR I = 1 TO Xwide * Yhigh
  IF @MrgPtr = BackColor THEN
    @MrgPtr = %BLACK
  ELSE
    @MrgPtr = %WHITE
  END IF

  IF @MskPtr = BackColor THEN @MskPtr = %WHITE
  MrgPtr = MrgPtr + 4
  MskPtr = MskPtr + 4
NEXT I

GRAPHIC SET BITS MergeStr$

GRAPHIC BITMAP NEW Xwide, Yhigh TO MaskHndl
GRAPHIC ATTACH MaskHndl, 0
GRAPHIC SET BITS MaskStr$
GRAPHIC DETACH

END SUB






'========================================
'this updates sprites; here is where you would put
'all your sprite movements and interactions
SUB sprite_update(mobs() AS sprite)
    LOCAL l_lb, itr8 AS LONG
    l_lb = LBOUND(mobs)

    RANDOMIZE TIMER
    FOR itr8 = UBOUND(mobs) TO l_lb STEP -1
        mobs(itr8).xpos += mobs(itr8).xdir
        mobs(itr8).ypos += mobs(itr8).ydir
        IF mobs(itr8).xpos + Mobs(itr8).Wide > %w_wide THEN mobs(itr8).xdir = RND(-1, -6)
        IF mobs(itr8).ypos + Mobs(itr8).High > %w_high THEN mobs(itr8).ydir = RND(-1, -6)
        IF mobs(itr8).xpos < 0 THEN mobs(itr8).xdir = RND(1, 6)
        IF mobs(itr8).ypos < 0 THEN mobs(itr8).ydir = RND(1, 6)
    NEXT
END SUB


'=================================
'this applies the sprites to the display
SUB screen_update(hwin AS DWORD, bmp AS DWORD, mobs() AS sprite)
    LOCAL target, spritebmp AS STRING, l_lb, itr8 AS LONG
    l_lb = LBOUND(mobs)

    GRAPHIC ATTACH hWin, 0, REDRAW
    GRAPHIC COPY bmp, 0

    FOR itr8 = UBOUND(Mobs) TO l_lb STEP -1
      GRAPHIC COPY Mobs(itr8).Merge, 0 TO (Mobs(itr8).Xpos, Mobs(itr8).Ypos), %MIX_MERGESRC
      GRAPHIC COPY Mobs(itr8).Mask, 0 TO (Mobs(itr8).Xpos, Mobs(itr8).Ypos), %MIX_MASKSRC
    NEXT itr8
  ' Draw the fix labels here
    DrawFixLabels
    GRAPHIC REDRAW
END SUB



it uses the below code GRAPHIC PRINT  to draw labels
Code: [Select]
' the -2 makes the label background transparent
  GRAPHIC COLOR  %RGB_DARKGREEN, -2    '%RGB_HONEYDEW           
  GRAPHIC SET POS (45, 80)
  GRAPHIC PRINT "This is fixed Label 1 but it does NOT flicker **** "

how to do it in O2  ?  say place some labels inside the TravelTowardsPick.o2bas  program ?



Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3584
    • Oxygen Basic
Re: Cubic Sphere example how to convert to 64bits
« Reply #5 on: April 12, 2018, 06:27:21 AM »
Well, generally speaking, integers are all 32bit int, and floats for Opengl are all 32bit single.

Only handles and pointers are sys.

In fact, most computations at the assembler level, are still 32 bit.

chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Re: Cubic Sphere example how to convert to 64bits
« Reply #6 on: April 12, 2018, 06:35:16 AM »
Thanxx Charles

this means that when we are converting from 32bit to 64bit, we convert by the rules below

Code: [Select]
int  -->  int

but for DWORD for handles and pointers  -->  sys

for floats in OpenGL  -->  SINGLE



Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3584
    • Oxygen Basic
Re: Cubic Sphere example how to convert to 64bits
« Reply #7 on: April 12, 2018, 07:16:29 AM »
Yes, though there are some doubles in the glu functions. But floating-point remains unchanged when going 64bit.

We have quite a few examples with text overlays, and planar graphics in front of 3d.

Take a look at examples/opengl/control*.o2bas.

ControlCraft has a labelled control that glides into position when you point at the bottom of the window.

chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Re: Cubic Sphere example how to convert to 64bits
« Reply #8 on: April 12, 2018, 08:59:16 AM »
Thanxx Charles

the space craft can fly well together with the Joy stick and control panels
  but how do you place a label infront of the graphics? using gprint  ?   

 how to use gprint  together with its coordinates x , y  and color ?

i couldn't find its command format in oxygen_help.htm

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3584
    • Oxygen Basic
Re: Cubic Sphere example how to convert to 64bits
« Reply #9 on: April 12, 2018, 09:16:12 AM »
gprint is defined in OpenglSceneFrame.inc. It is placed, rotated, scaled, and colored by Opengl calls, as you can see from this very simple example:

examples\OpenGL\KeyboardCodes.o2bas
Code: [Select]

  $ FileName  "t.exe"
  'uses    RTL64
  '
  % width     640
  % height    160
  $ title     "Key codes"
  $ fontA     "Arial",FW_SEMIBOLD

  macro keydown
  case 27 : 'no action
  case 32 : 'no action
  end macro
  '
  uses OpenglSceneFrame
  indexbase 1
 

  sub initialize(sys hWnd)
  ========================
  end sub

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


  sub scene(sys hWnd)
  '==================
  DozyFrame
  glClearColor 0.5, 0.5, 0.7, 0
  glPushMatrix
  gltranslatef  -1.5,0.,-1.0
  glscalef      .25,.3,.01
  glColor3f     .99,.99,.00
  gprint        "Last key pressed: "
  glColor3f     .99,.99,.99
  if lastkey
    gprint lastkey() " = 0x" hex(lastkey)
  else
    gprint "(none)"
  end if
  glPopMatrix
  end sub

John

  • Hero Member
  • *****
  • Posts: 3001
Re: Cubic Sphere example how to convert to 64bits
« Reply #10 on: April 12, 2018, 11:48:42 AM »
Quote
ControlCraft has a labelled control that glides into position when you point at the bottom of the window.

I don't see the controls when I run this under Wine.

It does run smoothly and my first CO2 self moving graphics example.

I think we have a Linux solution for O2 that makes it cross platform.

Mike Lobanovsky

  • Admin Support Member
  • *****
  • Posts: 1770
Re: Cubic Sphere example how to convert to 64bits
« Reply #11 on: April 12, 2018, 12:02:04 PM »
John,

The screenshot you posted belongs to Craft.o2bas. It doesn't feature the sliding control panel. Run ControlCraft.o2bas instead.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, 2 x nVidia GTX 650Ti w/ 2GB VRAM, Windows 7 Ultimate Sp1)

John

  • Hero Member
  • *****
  • Posts: 3001
Re: Cubic Sphere example how to convert to 64bits
« Reply #12 on: April 12, 2018, 12:35:01 PM »
Thanks Mike!

I associated .exe file attributes on my Linux system to run under Wine which makes running O2 Windows programs seamless.

chrisc

  • Sr. Member
  • ****
  • Posts: 257
  • beginner programmer
Re: Cubic Sphere example how to convert to 64bits
« Reply #13 on: April 12, 2018, 04:10:24 PM »
Got the label compiled ok
Thanxxx a lot Charles