• What are you working on? V2
    2,001 replies, posted
[QUOTE=garry;16347393]I did see that, I much prefer a book though[/QUOTE] Oh. I mean, GPU Gems isn't really something you'd sit down and read ... it's more of a "hey, I wonder what it says about so-and-so."
Holy shit, it's got a guide on Core Image :fuckyou:
Oh, this page looks pretty interesting: [url]http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html[/url] I must read more.
It's annoying how small all the images are in those articles.
[img]http://www.cubeupload.com/files/7df800untitled.png[/img] I hope it's working, but I started with a glider... [editline]03:45PM[/editline] Argh, that was a =/== typo. It works now, now I'll have to find a way to scale the image because I can't see anything. Why isn't it aliased, though? [img]http://www.cubeupload.com/files/400400untitled.png[/img]
[img]http://i28.tinypic.com/35m2hs0.png[/img] Moving platforms! [code]virtual void think() { mover->x = clamp(mover->x + 100*dir, 18000, WORLD_WIDTH-8000); }[/code] Now how do I solve this: [code] #include "levels/Level1.cpp" #include "levels/Level2.cpp" #include "levels/Level3.cpp" ... switch(levelnum) { case 1: level = new Level1(); break; case 2: level = new Level2(); break; case 3: level = new Level3(); break; case 4: level = new Level4(); break; case 5: level = new Level5(); break; case 6: level = new Level6(); break; ... } [/code] Agh
Vampired, please don't troll this thread.
Eleventeen. Wtf? I'm serious. There's not much point making a thread for small questions.
You should probably have a level class and create instantiations from that, not have seperate classes for each level.
Each level has a different constructor and think function etc. How would I go about that with one level class?
[QUOTE=Vampired;16351379]Each level has a different constructor and think function etc. How would I go about that with one level class?[/QUOTE] Scripting would be one way. Another would be to have a bunch of static methods that create the levels. You then store those functions in a vector and call them whenever you want.
There's lots of ways to make a class factory, I haven't read through it all but this seems to be what you're after: [url]http://stackoverflow.com/questions/363453/looking-for-a-better-c-class-factory[/url]
[QUOTE=HubmaN;16349377] It works now, now I'll have to find a way to scale the image because I can't see anything. Why isn't it aliased, though? [url]http://www.cubeupload.com/files/400400untitled.png[/url][/QUOTE] Instead of pixels use sprites?
[QUOTE=ZomBuster;16352272]Instead of pixels use sprites?[/QUOTE] Eh, I'm not about to mangle with an array of sprites, this is killing the framerate as it is. I just ended up having to roll my own nearest-neighbor scaling function (by default, whenever a sprite is resized SFML defaults to bilinear interpolation). Here's something interesting, though - for some reason, it's blurrier in the corners than in the center. [img]http://www.cubeupload.com/files/396e00untitled.png[/img]
I was working on a threaded MP3 searcher using the Google API. I had a thread for each Google page which started a thread for each search result which started a thread for each link to an mp3 it found which checked the MIME type and how relevant it was to the search keywords and added it to a list. I thought it worked quite well and was pretty fast too. Today I found a plugin for NetBeans to track all the Threads a program started. Now I found out why the JVM crashed sometimes. I did something horribly wrong and it started over 3700 threads. D: Surprisingly the CPU usage peaked at 70%. And no, it's not just finding 3700 results. It stops searching after a while and still has 1999 threads.
[QUOTE=Robber;16354025]I was working on a threaded MP3 searcher using the Google API. I had a thread for each Google page which started a thread for each search result which started a thread for each link to an mp3 it found which checked the MIME type and how relevant it was to the search keywords and added it to a list. I thought it worked quite well and was pretty fast too. Today I found a plugin for NetBeans to track all the Threads a program started. Now I found out why the JVM crashed sometimes. I did something horribly wrong and it started over 3700 threads. D: Surprisingly the CPU usage peaked at 70%. And no, it's not just finding 3700 results. It stops searching after a while and still has 1999 threads.[/QUOTE] I'm probably end up stupid asking this question but shouldn't there be just 2 threads if you have dual core and 4 threads if you have quad core?
[QUOTE=Vampired;16350849][img]http://i28.tinypic.com/35m2hs0.png[/img] Moving platforms! [code]virtual void think() { mover->x = clamp(mover->x + 100*dir, 18000, WORLD_WIDTH-8000); }[/code] Now how do I solve this: [code] #include "levels/Level1.cpp" #include "levels/Level2.cpp" #include "levels/Level3.cpp" ... switch(levelnum) { case 1: level = new Level1(); break; case 2: level = new Level2(); break; case 3: level = new Level3(); break; case 4: level = new Level4(); break; case 5: level = new Level5(); break; case 6: level = new Level6(); break; ... } [/code] Agh[/QUOTE] Easy. don't include CPP files...
[QUOTE=HubmaN;16352721]Eh, I'm not about to mangle with an array of sprites, this is killing the framerate as it is. I just ended up having to roll my own nearest-neighbor scaling function (by default, whenever a sprite is resized SFML defaults to bilinear interpolation). Here's something interesting, though - for some reason, it's blurrier in the corners than in the center. [/QUOTE] You're right, it is slow [URL=http://www.cubeupload.com][IMG]http://www.cubeupload.com/files/ef2400gol.png[/IMG][/URL] (stole your idea lol) it works a lot faster without that much blocks (with the corect code) [URL=http://www.cubeupload.com][IMG]http://www.cubeupload.com/files/2ac600gol.png[/IMG][/URL]
[QUOTE=Sporbie;16354248]I'm probably end up stupid asking this question but shouldn't there be just 2 threads if you have dual core and 4 threads if you have quad core?[/QUOTE] Only if I would be calculating something. But in this case, what's limiting the speed is the download speed from each website and the time it takes to answer. Lets say it takes 1 second to download a website's HTML code. When I download 10 website in 1 thread it takes 10 seconds. If I download each one in it's own thread it takes 1-3 seconds, because my local resources aren't the limiting factor. And if a website doesn't reply (timeout) it's thread waits for 10 seconds and stops. If I did everything in 1 (or 2) threads all the other downloads would have to wait until it didn't answer for 10 seconds.
I made the physics world render code into a GUI object, so now it's easy as hell to do this: [img]http://i31.tinypic.com/300xt79.jpg[/img] I don't really know any uses for it, but now that the rendered world is handled as a GUI object, adding stuff like dragging to create objects is easier than before. Here's the code to create these controls: [cpp]guibox2dworld worldRender( 0, 0, 500.0f, 350.0f, physics::world ); guibox2dworld worldRender2( 500.0f, 0, 500.0f, 350.0f, physics::world ); guibox2dworld worldRender3( 0.0f, 350.0f, 500.0f, 350.0f, physics::world ); guibox2dworld worldRender4( 500.0f, 350.0f, 500.0f, 350.0f, physics::world ); guimanager::addControl( &worldRender ); guimanager::addControl( &worldRender2 ); guimanager::addControl( &worldRender3 ); guimanager::addControl( &worldRender4 );[/cpp]
Running at a fixed framerate of 40FPS: [IMG]http://i31.tinypic.com/30d8qs6.png[/IMG] It's not using sprites though. :frown: [B]Edit:[/B] Using sprites now. Running at 55FPS. :D
Having a bit of trouble with specular lighting in my raytracer when dealing with planes. With specular lighting: [img]http://returnnull.dyndns.org/img/spec_error.png[/img] and with specular lighting disabled. [img]http://returnnull.dyndns.org/img/spec_error_no_spec.png[/img] Here's the relevant bit of code. [cpp]// now specular shading if ( ENABLE_SPEC_LIGHTING && prim->getSpecular() > 0 ) { Vec3 refl_vec = light_pos_norm - ( norm * light_pos_norm.dot( norm ) * 2.0f ); float dot = dir.dot( refl_vec ); if ( dot > 0 ) { float spec = powf( dot, 20 ) * prim->getSpecular() * shade; col += spec * light->getColor(); } } [/cpp]
[QUOTE=Overv;16354861]I made the physics world render code into a GUI object, so now it's easy as hell to do this: *screenshot* I don't really know any uses for it, but now that the rendered world is handled as a GUI object, adding stuff like dragging to create objects is easier than before.[/QUOTE] You could make windows inside the main window which contain their own world.
After rewriting our GUI Manager from scratch, I've finally got back to skinning [url]http://www.youtube.com/watch?v=5vFRTDfRY0g&hd=1[/url] Older video before skinning [url]http://www.youtube.com/watch?v=m2tb_RUWWHE&hd=1[/url]
[URL=http://www.cubeupload.com][IMG]http://www.cubeupload.com/files/ca6c00gol.png[/IMG][/URL] :v: ok enough game of life
[QUOTE=foszor;16355333]After rewriting our GUI Manager from scratch, I've finally got back to skinning [url]http://www.youtube.com/watch?v=5vFRTDfRY0g&hd=1[/url] Older video before skinning [url]http://www.youtube.com/watch?v=m2tb_RUWWHE&hd=1[/url][/QUOTE] That's cool, is a skin simply overriding drawing code?
[QUOTE=efeX;16354253]Easy. don't include CPP files...[/QUOTE] Why ever not?
[QUOTE=Overv;16355598]That's cool, is a skin simply overriding drawing code?[/QUOTE] There's a base skin with virtual functions. Any new skin just derives from it and overrides the different drawing routines. Each skin has their own content manager as well, so switching skins frees up resources used by the previous.
Game of Life is officially the new fad!
[QUOTE=Vampired;16355716]Why ever not?[/QUOTE] [quote]There's nothing inherently wrong about including a .cpp file since the compiler doesn't care what the extension is on an included file. However, you may be missing the bigger picture here. C++ supports compilation of multiple separate files ("translation units" to be precise). Among these, there are certain elements which may appear in multiple translation units (e.g., function _declarations_) and other elements which must appear in exactly one translation unit (e.g., non-inlined function _definitions_). The reason one commonly uses .h and .cpp files is that the .h files are typically used for the elements which may appear multiply, and the .cpp files are typically used for the elements which must appear once.[/quote] [url]http://bytes.com/groups/cpp/636932-include-cpp-file-instead-h-file[/url]
Sorry, you need to Log In to post a reply to this thread.