Author Topic: Pix3D  (Read 2078 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2391
  • Gender: Male
    • www.zapsolution.com
Pix3D
« on: December 31, 2014, 06:06:49 PM »
This project computes a grayed intensity for each pixel color, and it turns them into 3D visualization.
This could be used to perform ground topography or any other mathematical computation, or just for fun.

The default representation is using raster point (gl_dPoint) , but it could also use line (gl_dLine) or any other 3D primitive.

To switch between point and line, you have to edit the code shown below:

        glPushMatrix()
          glRotatef(90, 1, 0, 0)  '// ROTATION
          glTranslatef(0, 0, -rH) '// TRANSLATION
          if (nAnimate) then rPenSize = 2 else rPenSize = 1
          glPointSize(rPenSize)
          nPixStep = 2
          for y = 0 to nH - 1 step nPixStep
              for x = 0 to nW -1 step nPixStep
                  zSplitColorARGB(PixColor(x, y), A, R, G, B)
                  if (A) then
                      rSize = rAlpha(x, y) * nMove

                      'gl_dLine(rX1 - rW + x, rY1, rX1 - rW + x, rY1 - rSize, PixColor(x, y), rPenSize)
                      gl_dPoint(rX1 - rW + x, rY1 - rSize, PixColor(x, y))
                  end if
              next
              glTranslatef(0, 0, nPixStep) '// TRANSLATION
          next
        glPopMatrix()



The scene has been setup to render the 3D image to match exactly the pixel resolution of the 2D image, when shown in front of the camera.

Screen shot:



...

« Last Edit: January 12, 2015, 04:18:35 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Offline Patrice Terrier

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2391
  • Gender: Male
    • www.zapsolution.com
Re: Pix3D
« Reply #1 on: January 04, 2015, 07:33:05 PM »
The first post of this thread has been updated with 2 new versions.

Pix3D_32.zip written in PowerBASIC
Pix3D_64.zip written in C++ (VS2010)

The two SDK versions are almost identical, except that PB's dual array is using row/colum order, while C++ uses colum/row.

What is new in this release:
- Image drag and drop of any type and size from the Explorer.
- Deprecated "gluPerspective" removed and replaced with the new "gl_Perpective" API that is based on direct call to glFrustum.
- Couple of minor bugs have been fixed.

...

« Last Edit: January 12, 2015, 04:19:40 PM by Patrice Terrier »
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com