• What are you working on? v67 - March 2017
    2,541 replies, posted
  • Avatar of Mechanical43
  • a project class of mine has us building a robot with an atmega324 as brain. then we have to resolve what is basically a travelling salesman problem with it on a graph with 17 nodes. edit: with C++ but no STL
  • Avatar of Zyx
  • [vid]https://i.imgur.com/YolVGx0.mp4[/vid] I got animations working. This "idle" animation only has 5 keyframes and plays at 10 fps. The game is running at 60fps, so it interpolates between the frames linearly. The top part is me putting in random rotation numbers to see what would happen.
  • Avatar of DrLuke
  • Funfact: When you override the "drawBackground" method of Qt's GraphicsView framework with an opengl viewport you get a free opengl context which you can use to render opengl stuff and then still use the GraphicsView framework on top of that to render Text, graphics and Qt Widgets over your opengl context.
  • Avatar of Ott
  • [QUOTE=Tobba;52881368]It's all harmonics except for the 4th overtone, which is AM modulated by the fundamental at the start; it produces that "springy" sound in the start. There seems to be some funny things going on when it comes to auditory perception and the harmonics though. I noticed that the 1st to 3rd overtones are somehow special, and only the slope seems to actually matter. Removing one of those overtones on most sounds I tested oddly made pretty little perceivable difference, even though they're the second-loudest set. That, and it seems the really critical thing is how the 4th+ overtones change over time (i.e the attack, decay and some non-linearness), while their relative amplitude doesn't actually seem to matter as much as you'd expect. It's also the most painful part to get right, so yeah.[/QUOTE] Yeah, you can chop off the first handfull of harmonics and the brain will still be able to tell the pitch. We don't listen for the fundamental harmonic to tell pitch, we listen for the harmonic series as a whole.
  • Avatar of paindoc
  • god i hate legacy code and C-style C++: 1. everything uses boolean return codes for success/failure. This is a problem when errors aren't handled - instead, failures are written as an error message to a file. So if something fails to import and gets initialized with invalid values, it won't really break until you try to use it. This location in the code can be far removed from the import location, so gl debugging where things break. Enter: exceptions. As if they haven't been around for ages 2. This code has all the variables declared on the first few lines of the program. this can be as many as two dozen (holy fuck) variables. Trying to figure out why things are broken due to a poorly set variable is a bitch when you do this, because you can't use either scope or declaration location ot narrow down the region in which the bug lives. It has cost me a tremendous amount of time. 3. Lots of code is very immutable and tuned for only one situation: when finding the initial tension in the tether joining a tethered spacecraft formation, the code assumed the satellite was orbiting the earth [I]always[/I]. So when I'm testing a lunar orbit, it uses earth constants - including the gravitational force appropriate for the Earth. Despite the orbit (because it's for the moon) being [I]inside the goddamn planet[/I]. So a really high tension value got set, and my tether kept snapping. It took me 3 hours to find out why this was occurring. I'm constantly putting out little fires caused by the really awful programmer who last touched this codebase, too. My boss/CEO is a scientist, and programs like one: he doesn't do anything crazy, and the worst he does is name variables poorly. This other guy? Just a retarded engineer. He turns what should be a for loop into an if statement checking for some variable, then a do-while iterating over an array where the array index is iterated inside the do-while. Why!? I enjoy a lot of the satisfying math and logic problems I get to confront. I even enjoy, for the most part, getting to refurbish this application. But jeese, some things really exhaust me and test my patience. Like the awful hungarian notation, which truly obfuscates so much more than it can ever help.
  • That last one sounds like what a for loop compiles into. I've seen it a lot when reverse engineering code.
  • Avatar of paindoc
  • [QUOTE='[aL`H]solokiller`og;52885955']That last one sounds like what a for loop compiles into. I've seen it a lot when reverse engineering code.[/QUOTE] I've been enjoying playing with godbolt lately. One of the neatest things to see is how easily the compiler works with using "std::transform" for overloaded math operators on custom array classes - optimizes to SIMD stuff nearly every time. Although, if you enable SIMD instructions when compiling, most for loops with math inside them will compile down to SIMD stuff. Its just been generally neat seeing how stuff compiles down, and how small changes to the code or compiler arguments can hugely modify the generated assembly. another thing I dislike: no usage of pure-virtual methods. Instead, it just prints an error saying "hah lol you shouldn't be here!" (effectively). Nothing is marked override or final. There are calls to derived functions in the base classes constructor. oh, and the base class has 70+ member variables, each prefixed with dm_, of course. and the constructor takes 28 arguments. And doesn't use direct initialization, either. This code makes me sad :( [editline]edited[/editline] like, some of the stuff I've mentioned is so bad that it makes my good friend working on Excel feel like legacy Excel is in great shape wtf :scream:
  • Fuck constructors / initializers in C++ in general. It gets insanely out of hand without designated initializers or initializer lists that can deal with move semantics. Someone please tell me there's a better way to do it than having to write out every member name 3 fucking times in the constructor with std::move sprinkled in all over the place. [editline]13th November 2017[/editline] My code has a 685 character constructor for a 12 member class. I started putting them all on a single lines because I got tired of scrolling past them. Send help.
  • Avatar of DrLuke
  • Another quick one, only took me one hour. Looks a bit shite though, but I gotta go to bed. [t]https://my.mixtape.moe/rwmwzz.png[/t] [url=https://www.shadertoy.com/view/Xt2cDt]Laserworld[/url]
  • Avatar of Karmah
  • [QUOTE=DrDevil;52887097]Another quick one, only took me one hour. Looks a bit shite though, but I gotta go to bed. [t]https://my.mixtape.moe/rwmwzz.png[/t] [url=https://www.shadertoy.com/view/Xt2cDt]Laserworld[/url][/QUOTE] Doesn't work on my pc :thinking:
  • [QUOTE=Karmah;52887656]Doesn't work on my pc :thinking:[/QUOTE] Interesting, works well on my phone.
  • [QUOTE=Karmah;52887656]Doesn't work on my pc :thinking:[/QUOTE] Same, i get this [img]https://i.imgur.com/5s2Cub3.png[/img]
  • Avatar of DrLuke
  • What the fuck, maybe your WebGL version is too old...? texelFetch apparently wasn't available in earlier versions of WebGL. [editline]14th November 2017[/editline] [QUOTE=Karmah;52889426]Gtx1070, updated drivers. The screen was just black[/QUOTE] Could you try again? I replaced texelFetch with a simple texture call.
  • Avatar of paindoc
  • [QUOTE=DrDevil;52889709]What the fuck, maybe your WebGL version is too old...? texelFetch apparently wasn't available in earlier versions of WebGL. [editline]14th November 2017[/editline] Could you try again? I replaced texelFetch with a simple texture call.[/QUOTE] God webgl is a pain. Khronos is apparently working on a Vulkan web/light version, and I really hope it is to WebGL what Vulkan is to OpenGL. Are all the people having errors using Nvidia hardware? In other news, I'm refactoring a class today with a grand total of 177 member variables
  • Avatar of DrLuke
  • [QUOTE=paindoc;52889774]God webgl is a pain. Khronos is apparently working on a Vulkan web/light version, and I really hope it is to WebGL what Vulkan is to OpenGL. Are all the people having errors using Nvidia hardware? In other news, I'm refactoring a class today with a grand total of 177 member variables[/QUOTE] Well, I have a GTX660Ti and it works perfectly for me. Maybe my GPU is blessed or maybe it's because I run linux... I don't know. [editline]14th November 2017[/editline] Personally I'm a bit torn on Vulkan. It seems like you need a massive amount of code just to get one silly triangle onto the screen.
  • Avatar of Layla
  • Yeah man, you should see the code to get 2 triangles on the screen, crazy!
  • [QUOTE=DrDevil;52889847]Well, I have a GTX660Ti and it works perfectly for me. Maybe my GPU is blessed or maybe it's because I run linux... I don't know. [editline]14th November 2017[/editline] Personally I'm a bit torn on Vulkan. It seems like you need a massive amount of code just to get one silly triangle onto the screen.[/QUOTE] You're basically taking over a lot of responsibility that used to be in the driver for OpenGL. EDIT: Also, your shadertoy runs fine on my desktop as well (AMD 290 series).
  • Avatar of Karmah
  • [QUOTE=DrDevil;52889709]What the fuck, maybe your WebGL version is too old...? texelFetch apparently wasn't available in earlier versions of WebGL. [editline]14th November 2017[/editline] Could you try again? I replaced texelFetch with a simple texture call.[/QUOTE] That fixed it.
  • Avatar of DrLuke
  • [QUOTE=Karmah;52890053]That fixed it.[/QUOTE] Weeeeird... but this one worked on your machine? [url]https://www.shadertoy.com/view/ltSyDc[/url] It also uses texelFetch
  • Avatar of paindoc
  • [QUOTE=DrDevil;52889847]Well, I have a GTX660Ti and it works perfectly for me. Maybe my GPU is blessed or maybe it's because I run linux... I don't know. [editline]14th November 2017[/editline] Personally I'm a bit torn on Vulkan. It seems like you need a massive amount of code just to get one silly triangle onto the screen.[/QUOTE] Vulkan has a lot of boiler plate code, yes, but unlike OpenGL nearly everything about Vulkan is [I]easily[/I] abstracted away and wrapped with RAII stuff (or not, where appropriate, as in device memory and limited resources). Compare the Sascha-Williams [URL="https://github.com/SaschaWillems/Vulkan/blob/master/base/VulkanTexture.hpp"]Vulkan example code for setting up textures[/URL], to the [URL="https://github.com/fuchstraumer/VulpesRender/blob/master/include/resource/Texture.hpp"]texture class I arrived at[/URL] after 3-4 months of using Vulkan. Lots of the boilerplate and redundant code is easily identified and pulled into it's own methods, and the lack of state in the API is just so nice once you get used to it. That and multithreading is easier, recording commands is a lot nicer and more explicit, push constants are awesome, subpasses are awesome, SPIR-V and shaders are easier than OpenGL shaders, and the whole API is in a very "clean" state that leaves it feeling lightweight and generally pleasurable to use (vs wrestling OpenGL versions and extensions). It's not for everybody, but I think it'll begin seeing a lot more use. More and more games are using it, and more and more resources + projects are starting to appear showing how to use it. I enjoy it loads, and I have no plans to return to OpenGL so long as I shall live tbh [editline]edited[/editline] Are there any good places to ask for code reviews on larger codebases? I don't get any code reviews to speak of at work, so I'm mostly relying on reading as much as I can on how to code better and trying to always improve my own code. I'd like to get a review on something like VulpesRender though, for the sake of learning more from other devs and so I can have the chance to improve that codebase even more.
  • Avatar of DrLuke
  • [QUOTE=paindoc;52890099]Vulkan has a lot of boiler plate code, yes, but unlike OpenGL nearly everything about Vulkan is [I]easily[/I] abstracted away and wrapped with RAII stuff (or not, where appropriate, as in device memory and limited resources). Compare the Sascha-Williams [URL="https://github.com/SaschaWillems/Vulkan/blob/master/base/VulkanTexture.hpp"]Vulkan example code for setting up textures[/URL], to the [URL="https://github.com/fuchstraumer/VulpesRender/blob/master/include/resource/Texture.hpp"]texture class I arrived at[/URL] after 3-4 months of using Vulkan. Lots of the boilerplate and redundant code is easily identified and pulled into it's own methods, and the lack of state in the API is just so nice once you get used to it. That and multithreading is easier, recording commands is a lot nicer and more explicit, push constants are awesome, subpasses are awesome, SPIR-V and shaders are easier than OpenGL shaders, and the whole API is in a very "clean" state that leaves it feeling lightweight and generally pleasurable to use (vs wrestling OpenGL versions and extensions). It's not for everybody, but I think it'll begin seeing a lot more use. More and more games are using it, and more and more resources + projects are starting to appear showing how to use it. I enjoy it loads, and I have no plans to return to OpenGL so long as I shall live tbh [/QUOTE] Yes, using Vulkan over OpenGL/DirectX is absolutely the right thing to do when making engines/games. But I just want to make silly stuff with GLSL, so all I need is a way to draw two triangles and apply a shader to them with the least amount of boilerplate code, which is why I will stick to OpenGL for now and probably a long time.
  • Avatar of Karmah
  • [QUOTE=DrDevil;52890091]Weeeeird... but this one worked on your machine? [url]https://www.shadertoy.com/view/ltSyDc[/url] It also uses texelFetch[/QUOTE] Nope [t]https://i.imgur.com/kwM8PNP.png[/t]
  • Avatar of DrLuke
  • [QUOTE=Karmah;52890136]Nope [t]https://i.imgur.com/kwM8PNP.png[/t][/QUOTE] Hmmm... is your chrome up to date? That's the only thing I can think of right now.
  • Avatar of Karmah
  • [QUOTE=DrDevil;52890147]Hmmm... is your chrome up to date? That's the only thing I can think of right now.[/QUOTE] Yep, version 62.0.3202.94 (64-bit)
  • Avatar of Zyx
  • For a few hours I couldn't figure out why the vertices shared between 2 bones wouldn't be correctly transformed. No matter how many adjustments I made the joints would be all fucked. Like so: [img_thumb]https://i.imgur.com/o7hoDIu.png[/img_thumb] Then I realized why.... The GPU was expecting "Index, Index, Weight, Weight", but I was sending "Index, Weight, Index, Weight" :goodjob: So now it works: [img_thumb]https://i.imgur.com/6wg0q6O.png[/img_thumb] Does anyone know where I can get a fully rigged and animated mesh I could experiment with?
  • [QUOTE=DrDevil;52890132]Yes, using Vulkan over OpenGL/DirectX is absolutely the right thing to do when making engines/games. But I just want to make silly stuff with GLSL, so all I need is a way to draw two triangles and apply a shader to them with the least amount of boilerplate code, which is why I will stick to OpenGL for now and probably a long time.[/QUOTE] Any sufficiently complicated (read: high performing) OpenGL engine is gonna port almost 1:1 to Vulkan anyways, aside from the pipeline state objects. [editline]15th November 2017[/editline] There's [i]one[/i] fast path, and it's the set of OpenGL calls that are basically directly equivalent to what you would do in Vulkan (sans command lists, sorta; if you went full AZDO you'd essentially be emulating it with indirect draws).
  • Avatar of Karmah
  • [QUOTE=Zyx;52890328]For a few hours I couldn't figure out why the vertices shared between 2 bones wouldn't be correctly transformed. No matter how many adjustments I made the joints would be all fucked. Like so: [img_thumb]https://i.imgur.com/o7hoDIu.png[/img_thumb] Then I realized why.... The GPU was expecting "Index, Index, Weight, Weight", but I was sending "Index, Weight, Index, Weight" :goodjob: So now it works: [img_thumb]https://i.imgur.com/6wg0q6O.png[/img_thumb] Does anyone know where I can get a fully rigged and animated mesh I could experiment with?[/QUOTE] What format? If you support mdl just grab any from any source engine game.