• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

985 Good

About Zao

  • Rank

Personal Information


  • Twitter
  • Github
  • Twitch
  • Steam
  1. In this context, "relative to" means that the space it transforms from is the one mentioned, the space of the node's parent. For the root node, that is the object space. For a child node, it's the space of the parent. It's a bit unfortunate, but the "to" in this usage isn't a direction like in "from/to".
  2. The letter/digit keys have no constants because their value are the ASCII values, so you can just use a character literal 'A' etc.
  3. How to have tamplates that only takes int[] ?

    template <size_t N> void f(int (&arr)[N]) { std::cout << N << std::endl; } For taking arbitrary array types, make the int a template parameter as well.
  4. In general, newer compilers have better conformance to standards, only straying if the functionality is part of a vendor extension or a long-standing defect with the compiler. Ill-formed or non-standard code will only become less and less supported, so you don't have much choice than to update your understanding of the language if you wish to move away from ancient toolchains and their quirks.
  5. C++ Overloading Question

    The authors may have some more or less rational arguments against overloading. In this particular case, the call site may be a bit unexpected if you use NULL or 0 as a null pointer constant, as the integer overload will be chosen. There's nothing intrinsically wrong with overloading, but it can be a bit more clear at the call site what function is intended and what it does. Use common sense and adhere to local style.
  6. OpenGL OpenGL legacy to shader mapping

    The only well-defined standard location is 0 for the vertex position attribute. The use of location 2 for normals and similarly for other attributes is a NVIDIA-specific thing, and will most probably break you hard on other vendors. Please see this discussion on SO: https://stackoverflow.com/a/528824/87969 If you only care about those devices and are happy to rely on vendor-specific behaviour, the mapping should then be that gl_MultiTexCoord0 is at location 8, according to the docs.
  7. Normal question

    When showing source code in public, it may be beneficial to ensure that your indentation is consistent. You seem to have a wild mixture of four spaces and four-wide tabs that expand very poorly in a eight-wide tab world. You may want to invest in a source code formatter or an IDE that unscrews your indentation.
  8. Particle system

    You're picking the X, Y, and Z components from different unrelated positions as each call to GenSpherePointCorrect makes a completely new position. You need to generate a single Vector3 each loop iteration and assign its components to the vertex position.
  9. As this is the primary web search hit for the subject, any non-zero flags like the read-only depth/stencil ones in a DSV desc require feature level 11_0 or greater, the debug runtime returns invalid arg and issues a diagnostic: D3D11 ERROR: ID3D11Device::CreateDepthStencilView: A non-zero Flags field (0x1) is not valid, unless the GetFeatureLevel returns D3D_FEATURE_LEVEL_11_0 or greater. [ STATE_CREATION ERROR #2097153: CREATEDEPTHSTENCILVIEW_INVALIDFLAGS] D3D11 ERROR: ID3D11Device::CreateDepthStencilView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #148: CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN]
  10. Constructs like the one in fragment #4 is often erroneous even if you check both flags. eof() will not be true until a read attempt is made across the end of the file.   Unless there is additional checking below the std::getline call, it will run one final failing time after all the data is consumed and the code below may expect the string to contain valid data. Instead the code ought to inspect the state of the stream after a read operation. Typically you would design a "read all the lines" loop like: while (std::getline(is, str)) { ... }
  11. File upload server

    In the distributed storage software we use, clients authenticate with client certificates over TLS HTTP with the head nodes, which may either proxy the data to the storage pools or redirect the client to issue its PUT to the storage pools over unauthenticated HTTP.   The mechanism of redirect-on-PUT requires that the client _must_ issue a "expect 100 continue" on its initial request. This is so that the server will have the ability to decide on if to accept the data directly (by responding with a 100 continue), or redirect/reject/whatever with 30x/40x.   Our storage uses dynamically opened ports on the storage nodes and have a GUID as query parameter to figure out where to put stuff, but it's in no way secure. In your case, you'd either have to delegate credentials to the clients as part of the URLs, or make your S3 world-writable and pray.
  12.   Note that this is "new" behaviour on Vista and up, so if you're amusing enough to target XP, XP64 and/or Server 2003, you're going to end up with an interesting selection of reasonably low ports.
  13. In some projects, includes are required to be relative to the top of the hierarchy. This allows you to have a single include directory, typically with an absolute path, and simply include headers by their full path relative that location.   g++ -I%FIR_ECOSYSTEM_ROOT% foo.cc   In which foo.cc would include files in a manner like:   #include <boost/thread/thread.hpp> #include <my/awesome/graphics/buffer.hpp> #include <my/awesome/network/buffer.hpp>   By retaining the path information in the include directive you gain location independence and the ability to distinguish between several headers with the same filename.
  • Advertisement