Fractal Tree Variation on TBgrabmp Done: Now working on OpenGL Version lazarus / 39-Graphics ---------------------------------------------------------------------- Boleeman · 2024-10-03 07:55 Fractal Tree with Lines Variation on TBgrabmp Variation in line thickness and colour. Added randomness Filter out branch sizes. Save to opaque or transparent background. Some nice trees can be made with this one. Needed to reduce the attached png file sizes by reducing the size of each picture. Also found an interesting Javascript variation here: https://www.johnpaulryan.com/blog/2016/09/20/Fun-with-Fractal-Trees Source: https://www.johnpaulryan.com/documents/tree.txt Rename that to index.html and open in a browser. ---------------------------------------------------------------------- Boleeman · 2024-10-03 07:59 Actually I would like to see an OpenGL version of this one (like the attached png below), with rounded branches. This is the Python Script that makes such a tree (fromm https://trinket.io/glowscript/d6813f0f82) Would be nice to make a Lazarus OpenGL version. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  GlowScript 2.9 VPython #this is the tree functiondef tree(limblen,r,a):  #theta is the "bend angle" for each branching  theta=30*pi/180  #short is the amount each branch decreases by  short=15 #this is the amount each branch is decreased by  fract=.75  #repeat the branching until the length is shorter than 5  if limblen>5:    #each branch is a cylinder    #a is a vector that points in the direction of the branch    tcolor=vector(100,42,42).hat    if limblen<10:      tcolor=color.green    cylinder(pos=r,axis=a*limblen, radius=0.15*limblen,     color=tcolor, texture=textures.rough)    #r is the position of the next branch    r=r+a*limblen    #rotate turns the pointing direction    a=rotate(a, angle=theta, axis=vector(0,0,1))    #here is the recursive magic    tree(limblen*fract,r,a)    #now you have to go back to where you were    a=rotate(a,angle=-2*theta,axis=vector(0,0,1))    #this does the otherside (also recursive)    tree(limblen*fract,r,a)    a=rotate(a,angle=theta,axis=vector(0,0,1))    r=r-limblen*a     #this starts the tree with the starting branchlength = 75startingbranch=75 #this is the location of the basestartingposition=vector(0,-75,0) #this is the direction of the first branch (up)startingdirection=vector(0,1,0)tree(startingbranch,st artingposition, startingdirection) ---------------------------------------------------------------------- Boleeman · 2024-10-03 09:40 I had a go at converting the Python  version with cylinders for branches to Lazarus OpenGL but I am not seeing the OpenGL fractal Tree. Only scattered colours. What could be the fault ? Perhaps the fault has to do with the projection I am using. I Don't Know: glMatrixMode(GL_PROJECTION); glLoadIdentity; gluPerspective(45.0, OpenGLControl1.Width / OpenGLControl1.Height, 0.1, 500.0);