Perl 6 - the future is here, just unevenly distributed

IRC log for #openframeworks, 2014-06-18

| Channels | #openframeworks index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
01:47 ilbot3 joined #openframeworks
01:47 Topic for #openframeworks is now Welcome to http://openframeworks.cc/ | logs at http://irclog.perlgeek.de/openframeworks/
02:43 pizthewiz joined #openframeworks
03:12 admsyn joined #openframeworks
04:38 pizthewiz joined #openframeworks
04:46 pizthewiz joined #openframeworks
05:30 pizthewiz joined #openframeworks
06:23 sebllll_ joined #openframeworks
06:31 mihi_tr joined #openframeworks
07:34 mihi_tr joined #openframeworks
07:38 martincatchoom joined #openframeworks
07:38 martincatchoom yes, I didn't, openframeworks does
07:40 ncls joined #openframeworks
07:41 martincatchoom it is using OpenSSL 1.0.0: https://github.com/openframeworks/openF​rameworks/blob/master/docs/versions.md
07:41 martincatchoom (1.0.0a)
07:41 martincatchoom the thing is that I am trying to compile a newer version and it is around 50% heavier than the one included in OF
08:23 nylki_ joined #openframeworks
10:36 nnlr joined #openframeworks
10:47 martincatchoom joined #openframeworks
12:59 nylki_ joined #openframeworks
14:19 admsyn joined #openframeworks
14:20 admsyn joined #openframeworks
14:38 pizthewiz joined #openframeworks
15:18 vade joined #openframeworks
15:21 jedahan joined #openframeworks
15:39 austinslominski joined #openframeworks
15:46 pizthewiz joined #openframeworks
15:54 aurialLoop joined #openframeworks
15:59 aurialLoop Hey, I was wondering if anyone had some advice on how I might be able to get more performance out of an application that draws many (a maximum number of say 600k),  circles per frame. I would be able to reduce the number significantly if I could remove some old circles (but not all) from the previous frame, and only add the new circles (new circles per frame would be about 1k max)
15:59 admsyn how are you drawing them?
16:00 aurialLoop just using ofCircle(...)
16:00 admsyn ah yeah, you should definitely move that over to an ofVbo, or an ofVboMesh
16:01 admsyn how I usually do it is I have a big vector<ofVec3f> for object positions, then upload that to an ofVboMesh every update() and draw() it
16:01 admsyn that assumes everything's changing every frame
16:02 admsyn if you want to start minimally, though, you could tweak your circle adding logic
16:02 admsyn how's that working?
16:03 aurialLoop thank you! let me explain further, one sec :)
16:08 aurialLoop so I'm doing some blob detection on objects from a camera. I get a feed of 125fps from the camera, and detect a max of 200 blobs per frame. Each blob position gets stored in a struct, along with a name and time, added to a vector, then get delivered to a graphics class that has a history (0 secs to 10 secs) of the previous blob positions as a large vector. The new blobs get added to
16:08 aurialLoop the history, and the blobs outside of the history length (e.g. 10 sec) get removed
16:08 aurialLoop then it's a matter of iterating over that collection and drawing an ofCircle at each blob position
16:09 admsyn yeah if you've got everything in a vector already, I'd definitely say go to ofVboMesh
16:10 admsyn have you profiled to see what's actually taking the most time?
16:11 admsyn it could be the removal of old objects, if they're always at the front of a vector (for instance)
16:11 admsyn not sure what OS you're on but it's pretty easy in Xcode
16:13 aurialLoop windows - I had been using code::blocks, but I've moved to visual studio.. I gain 1 or 2 fps by using a deque over a vector, just because it's a lot more efficient to remove elements at the front of a deque (so I've read), but I also found some occasional malloc errors from that - once the app reached 500+ mb of data usage
16:14 admsyn ah if I remember correctly the express version of visual studio doesn't ship with profiling tools
16:14 admsyn I think
16:14 admsyn not sure about that one
16:14 aurialLoop no idea if they're related actually - need to track down why malloc errors would be occuring at that sorta ram usage
16:15 admsyn anyway you're bottleneck is almost certainly the ofCircle drawing, esp if you're doing hundreds of thousands
16:15 admsyn so you need to draw a bunch of dots in 2d space, different sizes?
16:15 aurialLoop yep, that's right
16:16 aurialLoop I vary the size of the dots based on their age - creating a trail of dots, basically
16:17 admsyn ok so what you probably want then is an ofVboMesh to store your dot positions, a vertex attribute in the vbo for "age", and then a shader to use "age" to draw them with different sizes
16:17 admsyn there's other ways to go about it, fwiw
16:17 admsyn but that should work
16:18 admsyn you could also store triangle fans (i.e. circles) in the vbo mesh instead of relying on the shader
16:18 aurialLoop triangle fans = triangles rotated about their center?
16:19 admsyn yeah basically http://www.uchidacoonga.com/wp-conte​nt/uploads/2012/03/triangle_fan.png
16:19 admsyn i think ofVboMesh might actually have a thing for "append circle" one sec
16:19 aurialLoop wow, you're so helpful, thank you so much dude :)
16:21 admsyn np
16:21 admsyn I think it just has stuff for appending 3d primitives like cube / sphere / cylinder
16:21 admsyn that might get weird anyway, since you'd have to find the vertices every frame and shrink the triangle fan
16:22 admsyn yeah IMO go vector<ofVec2f> for your blob positions, upload to ofVboMesh every frame w/ an age attribute, draw as point sprites and use a shader to control the size of the circles
16:22 admsyn theres an example that kinda does that, pointsAsTextures
16:23 admsyn in the gl folder
16:23 aurialLoop oh wicked, I'll check that out
16:23 admsyn it's a little old school at this point, you could check out the shader tutorial which gets a bit more into all this vertex / vbo / attribute / shader stuff
16:23 admsyn http://openframeworks.cc/tut​orials/graphics/shaders.html
16:25 aurialLoop yeah, it's an area I certainly don't feel confident in, so anything helps
16:29 admsyn a slightly more correct way to do it would be to use a geometry shader, which lets you upload point + age and then generate triangle fans on the GPU every frame
16:30 admsyn BUT that might be overthinking it :)
16:32 aurialLoop I would love to take more advantage of the gpu, definitely
16:32 admsyn yeah then that's definitely the way to go
16:33 admsyn just didn't want to introduce too many new things between where you're at and results :)
16:33 aurialLoop yeah, baby steps
16:36 aurialLoop I hadn't had many issues with performance, not once I put blob detection/image processing on a separate thread, but my friend got these ridiculous toys and suddenly I had to track a whole bunch more points of light than before - https://scontent-a-lax.xx.fbcdn.net/h​photos-xaf1/t31.0-8/10365536_10152394​792507357_6652136689724458440_o.jpg
16:38 admsyn nice :)
16:38 admsyn yeah the performance ceiling w/ vbos is waaaayyyy higher than doing individual ofCircle
16:40 aurialLoop that's great to hear
16:59 jedahan joined #openframeworks
17:06 aurialLoop this is probably a very dumb question, but looking at the pointsAsTextures example, i see it's loading an image as the texture.. is the necessary? i ideally don't want to have to use images - I set each ofCircle colour individually, for example
17:07 jedahan_ joined #openframeworks
17:08 aurialLoop I just realised I should definitely have provided an example so you could see what I mean: https://www.youtube.com/watch?v=6sOtpBBVSMk no performance issues here because I'm working with a relatively small number of ofCircles
17:12 admsyn yeah you'd have a simple circle texture loaded to draw the points as circles (otherwise they'd be squares)
17:13 admsyn but you can tint the image as you're drawing it to get different colours
17:13 admsyn as in you take the right colour in in the shader, then apply it to the final pixel
17:13 admsyn you can see it in the example, where the point image is actually just white, but then it's made salmon-y in the final output
17:14 admsyn it's kinda sorta hacky, the geometry shader is more correct in terms of generating actual circles w/ geometry
17:15 aurialLoop hmm, yeah, I do change the shape type on the fly a lot for different effects, so loading a texture may not be the way I need to do it
17:18 austinsl1minski joined #openframeworks
17:18 aurialLoop will read into geometry shaders
17:24 admsyn fwiw the point sprite thing is more flexible than it seems
17:24 admsyn you can render into the texture for example, so instead of a constant circle you could be drawing some generative shape that changes over time
17:26 mihi_tr joined #openframeworks
17:27 aurialLoop oh, so I could draw a single ofCircle, load as a texture, then use that as my mask?
17:31 admsyn yepp
17:31 admsyn look into ofFbo for that
17:32 aurialLoop oh and the other thing I should ask - I'm drawing other things underneath all of this tracking code.. will wrapping the trail display code in a shader mean the info already drawn will be overwritten by say, a black background?
17:33 admsyn nope
17:33 aurialLoop great
18:08 GuidovanPossum joined #openframeworks
18:27 austinslominski joined #openframeworks
18:32 austinslominski joined #openframeworks
19:24 aurialLoop oh nice, the billboard example seems to cover a lot of what I want
20:12 pizthewiz joined #openframeworks
20:27 GuidovanPossum joined #openframeworks
20:30 pizthewiz @admsyn: Did my Apothecary question to Dan make sense? The response makes me feel like a dick, but I may have asked a poorly posed question.
20:39 admsyn let me check, though dan does kinda come off that way sometimes :)
20:43 admsyn yeah I gather he's just saying to handle the multipass in the individual scripts
20:45 pizthewiz Ok, so we are back to the "manual" approach right?
20:46 pizthewiz Manual in that Apothecary doesn't auto-magically already support it :0)
20:46 admsyn I think what he's saying is that basically ./apothecary update opencv should just do both configs without being told anything special
20:46 admsyn yeah I suppose so
20:46 pizthewiz But to do that, we essentially have to hack up the semantics of prepare/build/install
20:46 pizthewiz Since we are actually doing a sub-prepare/sub-build/sub-install, once for each of the two architectures.
20:47 admsyn right right
20:47 admsyn hm
20:47 pizthewiz Ok, thats totally doable, and I suppose this is transitional.
20:47 pizthewiz But it kinda undermines some of the Apothecary functions - better that than having people really build stuff by hand though.
20:49 pizthewiz I think what we could do is define new functions for OS X build32() build64() and override BUILD_ROOT_DIR in each, then in the normal build, we check for type == "osx" and then call build32() && build64()
20:52 admsyn so you mean the opencv script for osx is just kinda a shim that calls another script twice with different parameters?
20:53 admsyn by "opencv" I just mean "$LIB_NAME" of course :)
20:53 pizthewiz Exactly :0)
20:54 admsyn alright, that's not  the worst thing really
20:54 pizthewiz function build() {
20:54 pizthewiz if [ "$TYPE" == "osx" ] ; then
20:54 pizthewiz build-osx-x86-64();
20:54 pizthewiz build-osx-i386();
20:54 pizthewiz fi
20:54 pizthewiz }
20:54 admsyn it's transitional, and it avoids cluttering up the other OSs with OSX concerns
20:55 pizthewiz And inside that, we set libstdc++ vs libc++, / i386 vs x86-64 and override BUILD_ROOT_DIR.
20:55 admsyn except I'd think it'd just be like build-osx("64") but that's nitpicking really
20:55 pizthewiz Yeah, I think once the transition were over, we could copy the content of build-osx-x86-64 and pull it into the normal build()
20:55 * admsyn forgets how function params in bash work
20:56 pizthewiz Ahh, that works for me
20:56 admsyn cool
21:29 Judde joined #openframeworks
21:48 tapout joined #openframeworks
23:11 sebllll joined #openframeworks
23:39 robot joined #openframeworks
23:48 austinslominski joined #openframeworks
23:49 austinslominski Hey, I was wondering if somebody recognizes these errors. Tons of linker errors in xcode (153 or something). They look like this"ofVideoGrabber::setDesiredFrameRate(int)", referenced from: vtable for ofxPm::VideoGrabber in VideoGrabber.o construction vtable for ofVideoGrabber-in-ofxPm::VideoGrabber in VideoGrabber.o

| Channels | #openframeworks index | Today | | Search | Google Search | Plain-Text | summary