Menu

Simple Mesh demo

Help
2016-03-01
2016-03-04
  • Agocs Laszlo

    Agocs Laszlo - 2016-03-01

    I wish to draw a 3d polygon, which has not only x-y, but z dimesions.
    I have a planar polygon (concave or convex) in the P array of TPoint3d.

    TPoint3d = record x,y,z : double end;

    GLScene can draw this polygon (TGLPolygon). But I want a 3d polygon, as you cut a figure from a thick board.
    Egg: an O,Z,W char or other animal figure.
    I think, I must use the TGLMesh object.

    Will you please, give me a little code and comment to it?

    Thank you: A Biginer (don't laugh me)

     

    Last edit: Agocs Laszlo 2016-03-02
  • Jerome.D (BeanzMaster)

    Hi i don't undestrand very well what you want exactly, can you explain more ?
    Do you want 3 Animals Meshes ? or do you want 1 Animal model with 3 differents pose like an animation ?

     
  • Agocs Laszlo

    Agocs Laszlo - 2016-03-02

    Simply: I want show a 3d figure (with parallel coincident irregular polygon face, and it has a thickness).
    But I give the points of polygon in an array.
    I hink, first I must to tessalate this polygon. Second: I can found a suitable glScene object to reprezent this 3d figure.
    I don't know, which object is is.
    I have weote a simple pure code in nature OpenGl. In OnPaint event. The ciklus draw the parallel poligons, and a GL_QUAD_STRIP the sides.

      For i:=0 to 1 do begin
      G.SetColor(clWhite);
      glBegin(GL_TRIANGLE_STRIP);
        glvertex3f(-3,3,i);
        glvertex3f(0,0,i);
        glvertex3f(0,-3,i);
        glvertex3f(3,3,i);
        glvertex3f(0,0,i);
        glvertex3f(0,-3,i);
      glEnd();
    
      G.SetColor(clSilver);
    
      glBegin(GL_QUAD_STRIP);
        glvertex3f(-3,3,0);
        glvertex3f(-3,3,1);
    
        glvertex3f(0,0,0);
        glvertex3f(0,0,1);
    
        glvertex3f(3,3,0);
        glvertex3f(3,3,1);
    
        glvertex3f(0,-3,0);
        glvertex3f(0,-3,1);
    
        glvertex3f(-3,3,0);
        glvertex3f(-3,3,1);
      glEnd();
    

    But it is a special case. I need a general solution in glScene. An exemple program could help me a lot.
    Thanks!

     
  • Jerome.D (BeanzMaster)

    Ok, i think the best is to use TGLFreeForm with the MeshObject inside and MeshGroup. For Tesselate and other take look in GLTriangulation, GLMeshBuilder, GLMeshUtils and GLMeshOptimizer units.
    I share with you a little unit from the GLSceneEditor project it's a class helper for construct Freeform's Meshes with quad instead of triangle like in GLMeshBuilder (becareful some object like torus, the normals are wrong) this class is still in developpment, it give you some clues. Also look at the FreeForm relative demos like formula, subdivide, mesh explosion, and MeshObject's demos and samples in Graph and Extrusion folder

     

    Last edit: Jerome.D (BeanzMaster) 2016-03-04

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.