Author Topic: Very impressed  (Read 7302 times)

0 Members and 2 Guests are viewing this topic.

Patrice Terrier

  • Guest
Very impressed
« on: January 15, 2015, 05:37:10 AM »
Charles--

I did check all your OpenGL demo, and i must say that i have been very impressed by the huge amount of work you have done with O2.

Congratulations!

...



Charles Pegge

  • Guest
Re: Very impressed
« Reply #1 on: January 15, 2015, 11:04:14 AM »
Thank you, Patrice.

It certainly accumulates, and I am still intent upon producing a full OpenGL GUI :)

Patrice Terrier

  • Guest
Re: Very impressed
« Reply #2 on: January 16, 2015, 03:09:17 AM »
Charles--

Speaking of full OpenGL GUI

Do you remember this The Panther GUI demo video

...


Patrice Terrier

  • Guest
Re: Very impressed
« Reply #3 on: January 16, 2015, 05:14:05 AM »
Charles--

Here is a screen shot of a wavefront object, rendered with my own viewer, i would like to achieve something similar for strereolithography, because STL files are getting more popular now because of the new 3D printers



...

Charles Pegge

  • Guest
Re: Very impressed
« Reply #4 on: January 16, 2015, 02:04:13 PM »
Yes Patrice, I remember the Panther Project - nice skins :)

STL:
Standard Tesselation Language
aka
Stereo Lithography

In STL There does not seem to be a fixed standard for defining colors, materials and other attributes, but it looks easily do-able in other respects.

http://en.wikipedia.org/wiki/STL_%28file_format%29

Charles Pegge

  • Guest
Re: Very impressed
« Reply #5 on: January 18, 2015, 12:33:23 PM »
Patrice,

I have got STL working in the  o2 projectsA/OpenglCns framework.

Here is the rendering function in OxygenBasic, for both text and binary formats:

It won't need much work for a C++ interpretation :)

Code: OxygenBasic
  1.   string STLfilename ' loaded file
  2.  string status      ' info about file
  3.  float  smax        ' max scalar size
  4.  '
  5.  function ModelRender()
  6.   ======================
  7.   indexbase 1
  8.   string d  'STRING FOR STL FILE DATA
  9.  string er 'READING ERROR MESSAGE
  10.  sys    le 'LENGTH OF STRING
  11.  sys    n  'FACET COUNT
  12.  sys    tf 'TEXT FORMAT FLAG
  13.  '
  14.  getfile stlfilename,d
  15.  
  16.   if not d then
  17.     er="Problem: Please check Filename and location " stlfilename
  18.     goto done
  19.   end if
  20.  
  21.   le=len d
  22.  
  23.  
  24.   'TEXT FORMAT
  25.  ============
  26.  
  27.   /*
  28.   solid name
  29.   where name is an optional string (though if name is omitted there must still be a space after solid). The file continues with any number of triangles, each represented as follows:
  30.  
  31.   facet normal ni nj nk
  32.     outer loop
  33.         vertex v1x v1y v1z
  34.         vertex v2x v2y v2z
  35.         vertex v3x v3y v3z
  36.     endloop
  37.   endfacet
  38.   */
  39.  
  40.   string wr   'EXTRACTED WORDS
  41.  string name 'NAME OF SOLID
  42.  sys    i=1  'STRING INDEXER
  43.  string t    'TEMP HEADER STRING
  44.  
  45.   t=left d,80
  46.   i=instr t,"solid "
  47.   'if i<>1 then
  48.  if i=0 then
  49.     goto BinaryFormat
  50.   else
  51.     tf=1
  52.   end if
  53.  
  54.   StepWord d,i
  55.   name=GetWord d,i
  56.  
  57.   sys p=strptr(d) -1 'DATA STRING POINTER BASE
  58.  float  v[3]        'VERTEX OR NORMAL
  59.  '
  60.  macro ReadVector(v)
  61.   'READ NUMBERS DIRECTLY FROM STL STRING
  62.  StepWord d,i : v[1]=valat p+sttw
  63.   StepWord d,i : v[2]=valat p+sttw
  64.   StepWord d,i : v[3]=valat p+sttw
  65.   end macro
  66.   '
  67.  glBegin GL_TRIANGLES
  68.   smax=0
  69.   do
  70.     wr=GetWord d,i
  71.     if ascw=0 then exit do
  72.     if wr="normal" then
  73.       ReadVector v : glNormal3fv v
  74.       n++
  75.     elseif wr="vertex" then
  76.       ReadVector v : glVertex3fv v
  77.   if v[1]>smax then smax=v[1]
  78.   if v[2]>smax then smax=v[2]
  79.   if v[3]>smax then smax=v[3]
  80.     end if
  81.   end do
  82.   glEnd
  83.  
  84.   goto done
  85.  
  86.  
  87.   'BINARY FORMAT
  88.  ==============
  89.  
  90.   BinaryFormat:
  91.  
  92.   /*
  93.   UINT8[80] – Header
  94.   UINT32 – Number of triangles
  95.  
  96.   foreach triangle
  97.   REAL32[3] – Normal vector
  98.   REAL32[3] – Vertex 1
  99.   REAL32[3] – Vertex 2
  100.   REAL32[3] – Vertex 3
  101.   UINT16 – Attribute byte count
  102.   */
  103.  
  104.   type STLHeader
  105.   byte  hbytes[80]
  106.   dword count
  107.   end type
  108.  
  109.   packed
  110.   type SurfaceElement
  111.   float xn,yn,zn   'NORMAL
  112.  float x1,y1,z1   'VERTEX 1
  113.  float x2,y2,z2   'VERTEX 2
  114.  float x3,y3,z3   'VERTEX 3
  115.  word  AttribSize 'N BYTES DATA FOLLOWING
  116.  end type
  117.  
  118.   if len(d)<sizeof(STLHeader) then
  119.     er="binary file too small"
  120.     goto done
  121.   end if
  122.  
  123.  
  124.   p=strptr d
  125.   stlheader h at (p)
  126.   n=h.count
  127.   if n*sizeof(SufaceElement)+sizeof(STLHeader)>le then
  128.     er="corrupt element count " n
  129.     goto done
  130.   end if
  131.  
  132.   SurfaceElement s at (p+sizeof(STLHeader))
  133.  
  134.   'OPENGL READ IN TRIANGLES
  135.  
  136.   glBegin GL_TRIANGLES
  137.   smax=0
  138.   for i=1 to n
  139.     glNormal3fv s.xn
  140.     glVertex3fv s.x1
  141.     glVertex3fv s.x2
  142.     glVertex3fv s.x3
  143.     if s.x1>smax then smax=s.x1
  144.     if s.y1>smax then smax=s.y1
  145.     if s.z1>smax then smax=s.z1
  146.     if s.x2>smax then smax=s.x2
  147.     if s.y2>smax then smax=s.y2
  148.     if s.z2>smax then smax=s.z2
  149.     if s.x3>smax then smax=s.x3
  150.     if s.y3>smax then smax=s.y3
  151.     if s.z3>smax then smax=s.z3
  152.     @s+=sizeof(s) + s.AttribSize 'STEP
  153.  next
  154.   glEnd
  155.    
  156.   done:
  157.   if er then
  158.     status=er
  159.   else
  160.     if tf then status="Text File : " else status="Binary File : "
  161.     status+=str(n)+" Facets : " str(smax,2) " Max dimension"
  162.   end if
  163.   end function 'ModelRender
  164.  

Some sources for STL files:

http://cnc-step.de/en/service-support/downloads/free-stl-files-and-3d-cad-software.html
http://www.thingiverse.com/thing:558600/#files
http://3dprintingforbeginners.com/3d-model-repositories/



.
« Last Edit: January 18, 2015, 12:44:07 PM by Charles Pegge »

Patrice Terrier

  • Guest
Re: Very impressed
« Reply #6 on: January 21, 2015, 12:08:55 PM »
Thank you Charles !

I am in the slow process of porting my wavefront obj reader to C++.
Once done i shall add the STL feature.

See the screen shot, this object is made of nearly 1 000 000 triangles, i have been able to reduce the time to load it from 72 secondes down to 7 secondes... (i am happy)

...


.

Charles Pegge

  • Guest
Re: Very impressed
« Reply #7 on: January 22, 2015, 03:45:09 AM »
Are you tempted to get a 3D printer, Patrice?

I'm curious about this model:

Checking Out the Ultimaker 2 Series of 3D Printers
https://www.youtube.com/watch?v=Sz77Tq9xzpM
--
Ultimaker 2: 3D Printing a Dragon
https://www.youtube.com/watch?v=dKPxJW65IQg
--
Ultimaker 2 Making Of Pixar Lamp With LED And Switchbox
https://www.youtube.com/watch?v=qixurWTE_T4
--

« Last Edit: January 22, 2015, 03:57:53 AM by Charles Pegge »

Patrice Terrier

  • Guest
Advanced OpenGL programming
« Reply #8 on: January 22, 2015, 05:07:04 AM »
I think it is a technlogy of the future.
I have seen that in China they are even starting to build simple houses using this process, taking just a fraction of time that would take to build it the usual way.

Here is the link to download the Hunter.obj file i have used to create the screen shot in my previous post.
http://www.zapsolution.com/preview/Hunter.zip
It takes 17 secondes to Blender to render it, and only 7 secondes into mine :)

If interrested i could send you the source code of my wavefront object viewer, definitly aimed to advanced OpenGL programmers like yourself. ;)

...
« Last Edit: January 22, 2015, 05:31:53 AM by Patrice Terrier »

Mike Lobanovsky

  • Guest
Re: Advanced OpenGL programming
« Reply #9 on: January 22, 2015, 05:37:04 AM »
If interrested i could send you the source code of my wavefront object viewer, definitly aimed to advanced OpenGL programmers like yourself. ;)

If that "you" doesn't effectively stand for "you alone", than perhaps some other humble but rather advanced OpenGL programmers on this forum might enjoy getting access to the said source code as well? ;)

Patrice Terrier

  • Guest
About YOU
« Reply #10 on: January 22, 2015, 05:54:28 AM »
YOU, was first intended to Charles, because he knows my coding style since the time of the BassBox project.

But it could be extended to more, familiar with the syntax used in my PowerBASIC GDImage projects.

I am working on the C++ version.

Note: It is intended to work on I7  8)

...

Mike Lobanovsky

  • Guest
Re: About YOU
« Reply #11 on: January 22, 2015, 09:00:40 AM »
Actually, I read and write code in Intel and AT&T assembler, C and Delphi, C++ and Java, Python and Lua, and a multitude of BASIC dialects with almost equal proficiency, and I've been doing that for a living in recent 10 years or so. I can assure you reading PowerBASIC code wouldn't be too much of a problem for me either, whatever the actual coding style may be, SDK or DDT, whatever.

I used to create my own loaders for various open-spec 3D model formats as well, both static and animated, and OpenGL renderers to match. I used to take part in hacking proprietary 3D model formats of a few popular modern video games with a view to modding their visual content and game scenario. Snapshots taken in my own OpenGL rendering engine can be found on this forum too.

Never mind my inquiry though. I already regret having meddled with the topic so please do me a favor and dismiss it altogether as irrelevant. :)

JRS

  • Guest
Re: Very impressed
« Reply #12 on: January 22, 2015, 09:12:46 AM »
I got an idea. Why don't you and Patrice agree to leave your egos at the door and accept the fact you both are VERY talented programmers that would be more productive working together than apart.


Frankolinox

  • Guest
Re: Very impressed
« Reply #13 on: January 22, 2015, 09:23:23 AM »
question general: is there any chance or realistic way to load a lightwave *.obj file (or converted *.MTL file) to oxygenbasic (openGL) ? may be it's possible to load other objects / models (cars, houses etcpp) into oxygen, but how?

thanks, regards, frank

Patrice Terrier

  • Guest
Re: Very impressed
« Reply #14 on: January 22, 2015, 09:50:40 AM »
Mike--

My purpose was not to offend you or anybody else.
It is just because i don't know who are the peoples from this forum, and their OpenGL leverage.

I shall post a link to the PowerBASIC/GDImage project, altogether with the wavefront object source code, and a couple of my best .OBJ files.

It is targeted to work on I7 and with nVidia graphic cards, thus i don't know if it would work on I5 and Intel graphic's.

...