Forum > OpenGL
Flock of Birds (boids) With Class and operation overloading takes too much mem
(1/1)
Dzandaa:
Hi
This is a demonstration showing a Flock of Birds based on Boids artificial life program created by Craig Reynolds.
Using OpenGL, work on Linux and Windows.
https://en.wikipedia.org/wiki/Boids
Have fun.
B->
Dzandaa:
Hi again,
I realize that I Didn't manage well operator overloading with a Class (memory eating!!!)
This version is just using records.
B->
cdbc:
Hi
Memory eating... You think :D
The first version just "bricked" my lappy >:D
Regards Benny
Dzandaa:
Hi,
@cbdc
I'm very sorry for that!!!
I didn't find any example with operator overloading in a class.
Just overloading of Records.
The problem come with vector2u.
If anybody have an example with overloading operators in classes, I'm interested (Form based application)
Example:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---operator + (const V1: Vector2; Val: Single): Vector2;begin// result.X := V1.X + Val; // <-- Solution one crashes because result is not initialized.// result.Y := V1.Y + Val; exit(Vector2.Create(V1.X + Val, V1.Y + Val)); // Solution 2 works but didn't free the memoryend;
B->
MarkMLl:
"Bricked"? Rendered indistinguishable from a boat anchor? Surely not... :-)
@Dzandaa You should have put "boids" in the subject line: I'm sure I'm not the only person around here who'd understand the allusion. I remember when this was first discussed in the late 80s, and always find myself thinking of it when I see something like the Rutan Ares.
MarkMLl
Navigation
[0] Message Index