Author Topic: axis and metrics  (Read 872 times)

0 Members and 1 Guest are viewing this topic.

Frankolinox

  • Guest
axis and metrics
« on: January 20, 2019, 11:47:55 PM »
wanted to create a simple metric with vertical marks and distance on x and y axes, any help is welcome, thanks
regards frank

Code: [Select]
  #compact
  includepath "$\inc\"
  $ FileName  "t.exe"
  'include    "RTL32.inc"
  'include    "RTL64.inc"
  $ title     "Create_Lines with Coordinates"
  include     "OpenglSceneFrame.inc"


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

  sub scene(sys hWnd)
  '==================
  '
  static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
  sys i
  '
  glLoadIdentity
  glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
  glClearColor 0.5, 0, 0, 0
  '

  'glrotatef    ang1, 0,0,1
  gltranslatef 0,0,-1
  glscalef     0.001,0.001,0.001
  '
  glLineWidth 3.0
  '
  glBegin GL_LINES
  glColor4ub  250,250,150,250
  glVertex2i -100,-100
  glVertex2i  100, 100
  glColor4ub  150,250,250,250
  glVertex2i -100, 100
  glVertex2i  100,-100
  glEnd
  '
  glLineWidth 2.0
  '
  ri=0
  glBegin GL_LINE_LOOP
  for i=0 to 360 step 10
    ra=rad(i)
    glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
    ri=30-ri
  next
  glEnd

'-------------------------------------------------------------
'---'---'---'---'---'---'---'
  glLineWidth 1.0
  '
  glBegin GL_LINES
  glColor4ub  250,250,250,0
 
  glColor4ub  0,0,0,0   
      ' -- Marks on axes vertical
      for i = -450 to 450
        glVertex2i  i, -10
        glVertex2i  i,  10
       
        glVertex2i -10, i
        glVertex2i  10, i
      next 
    glEnd

  glBegin GL_LINES
  glColor4ub  250,50,0,0
' -- X axis
  glVertex2i -500,0
  glVertex2i 500,0
  '-- Y axis     
  glVertex2i 0,500
  glVertex2i 0,-500
  glEnd
'---'---'---'---'---'---'---'
'----------------------------------------------------------------
  '
  ang1+=angi1
  if ang1>360 then ang1-=360
  '
  end sub


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


Arnold

  • Guest
Re: axis and metrics
« Reply #1 on: January 21, 2019, 01:18:47 AM »
Hi Frank,

I follow your examples with interest. For me it is a good way to get a bit familiar with OpenglSceneFrame and also check how this works with Win64.

I can run your code with all my three versions of Oxygen.dll, which I use at the moment and I can create and run 32-bit executables.

In the beginning of the code I added the statement: uses console, because there is an interesting aspect for 64-bit executables. It is possible to create and run 64-bit executables, but the window will not be shown. The memory for the app will not be freed, and without the console the program must be terminated with the task manager.

At the moment I do not know what is missing, perhaps a pointer somewhere in the code or a member in a structure which must be 8 bytes in 64-bit. Charles and Mike know a lot more about this topic.

Roland




« Last Edit: January 22, 2019, 11:02:02 PM by Arnold »

Frankolinox

  • Guest
Re: axis and metrics
« Reply #2 on: January 23, 2019, 01:28:43 AM »
it's a special form with numeration found yesterday examples in openGL folders I didn't know yet.. something like that one :-)

Code: [Select]
include "GraphUtil.inc"
...
 
'X AXIS VALUES
  'color .5,1
  pushstate
  move 0,-1.5
  numscale 0,0,10,0,  0,10,2,1,  3 'X NUMBERS
  glEnd


so I will follow to check and learn these examples first to solve my problem with numerations and marks

thanks arnold for feedback, have fun by learning too