Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Aug 2000
Offline Last Active Today, 04:11 AM

#5187012 [SOLVED] MinGW, Glut, Glew problems

Posted by BitMaster on 14 October 2014 - 02:30 PM

If you link the static version of GLEW (that is, glew32s.lib), you need to define GLEW_STATIC before including the header.


Also, I'm not sure about the prebuilt libraries with MinGW. Oftentimes projects will only supply prebuilt MSVC binaries for Windows. Personally I just build libraries (like GLEW) myself to avoid any such problems. It should be trivial for GLEW, especially if your MinGW comes with msys.

#5186965 Object disappears using glm::lookAt when eye and center vectors have 2 coords...

Posted by BitMaster on 14 October 2014 - 10:45 AM

Your up-vector (the third parameter) must not be collinear with your forward vector (target - eye). It should be (0, 0, 1) or one of the many other possibilities. If you modify just one of the coordinates you did, glm::lookAt can orthogonalize the whole thing but that is mathematically impossible like you wrote it.

#5185973 NCurses-like functionality - Does anyone know a library?

Posted by BitMaster on 09 October 2014 - 06:56 AM

The last time I checked Dwarf Fortress was using PDCurses. There is also libtcod but I never really used it and it appears to not be actively developed anymore.

Sniffing around on Rogue Basin might produce more libraries or similar libraries for different languages.

#5185485 avoid localhost // verify url

Posted by BitMaster on 07 October 2014 - 02:56 AM

The L just means it's a long constant instead of an integer constant.

That said, I do not think you can solve the problem with cURL. cURL needs to resolve a DNS. It has to ask the operating system to do that, and Windows will lie as much as the user wants to with just a hosts entry.

Sik_the_hedgehog: I don't think just any https will do. You need to validate (with the public key contained in your client) that the server uses the exact matching private key.

#5185478 Knowing my REAL OpenGL version - RESOLVED

Posted by BitMaster on 07 October 2014 - 02:19 AM

According to the GLEW documentation it's safe as long as the used pixel formats have the same capabilities.

#5185474 avoid localhost // verify url

Posted by BitMaster on 07 October 2014 - 01:57 AM

The obvious solution would be to only allow https connections and the client validates the expected certificate is used. Obviously the client could still be manipulated to ignore the certificate check but it's a bit more involved than redirecting a DNS query.

#5185467 Is upper division Linear Algebra a good idea or necessary?

Posted by BitMaster on 07 October 2014 - 12:55 AM

The particular multiplication of a vector, defined in linear algebra, considers a vector of 2 dimensions nx1 or 1xn. And this multiplication operation thus runs in pattern of being complex  . But you can validly define a multiplication operation to be not complex (as in GLSL or HLSL),  and have a vector space. Making the multiplication of vectors comutative.

As the last time we talked about that: you can certainly add additional stuff (like operators) to a vector space. You might even be able to do more with it then (although the polite way in mathematics is to give it's proper name then), but that doesn't suddenly give all vector spaces that property.

Even so, if I remember correctly the last time that discussion came up you needed something like getting rid of a vector \(v\) on the right in an expression \(Av\) for a suitable matrix \(A\). Even if you have an inner product \(*: V \times V \rightarrow V\) that does not work: first, not every vector has an inverse element regarding \(*\). Second, even if you had the expression \(Ae\) (where \(e\) is the one-element regarding \(*\)), you cannot make the \(e\) vanish. It's the multiplicative neutral element for \(*\), not for (matrix, vector) multiplication. The result of \(Ae\) is a vector, not another matrix, definitely not \(A\) itself (except in the degenerate case of one-dimensional vector spaces).

You surely agree then that there are plenty of differences fired in also morphisms , transformations. Yes, the multiplication of matricies is not associative then, having multiplication of matricies undestood as F(L(D(v))) where F, L D are linear functions of v vector (linear functions can be multiplied to one function)

I have no clue what you are talking about. Function composition is always associative. You don't even need linear functions for that, it's a basic property. Changing the representation to \((F \circ L \circ D)(x)\) instead of matrices has no influence on that, you still have \((F \circ L) \circ D = F \circ (L \circ D)\).

#5184566 Some move semantic confusion

Posted by BitMaster on 02 October 2014 - 07:38 AM

In addition to what the posters above have already said, in your second example, your "crap" variable has undefined state after the std::move, so you should never use it again (it's safe to destroy, but otherwise you have no guarantees).

That is untrue. The object must be in an "unspecified but valid" state, not "undefined". You are for example allowed to call member function which have no specific preconditions. So calling std::vector::empty after a move is perfectly fine while std::vector::pop_back could or could not work. See also this discussion.

#5184519 Why do i get lag?

Posted by BitMaster on 02 October 2014 - 02:44 AM

If TCP_NODELAY is not explicitly enabled (which is often disabled by default) your TCP implementation will not send data immediately and instead see if it can combine more data into a single packet. If that is indeed the case you are sending a packet every N frames (where N depends on your packet size and what timeout/size your TCP stack considers reasonable).

#5184516 json c++

Posted by BitMaster on 02 October 2014 - 02:07 AM

You do not have to load the content yourself. You can create an std::ifstream, open the file and then pass the stream to Json::Reader::parse.

You can also wrap a block of memory into an std::istringstream (or a custom stream) and pass it to Json::Reader::parse.

You can also create a custom stream which can load directly from a network source or your custom package format and pass it directly to Json::Reader::parse.

That's the nice thing about abstraction. A stream is just a source of data until it says it has no more data. Whether the data is coming from a file, the network or some other arcane source is irrelevant for the user of the stream.

#5184505 json c++

Posted by BitMaster on 02 October 2014 - 12:51 AM

I had a quick flip through the documentation and there appears to be an overload of Json::Reader::parse (which you are already using) which takes an std::istream as input. Doesn't that solve your problem right away?

#5184401 Bad code or usefull ...

Posted by BitMaster on 01 October 2014 - 02:10 PM

It is not a bold it is the conclusion I draw after reading most of replies, as for the analogy sorry if that offended people but I stand by it. If you don't agree that is fine by me but just because something is written and designed a certain way does not mean it is the correct way and telling people to go away or to use something else because they don't share your view point is counter productive.

You did notice the important bits already discussed in this thread? Mainly:
1) the behavior is implementation defined. It's not undefined (relying on that would be bad), it's implementation defined (preferably avoided but real life does not always give us that pleasure).
2) using a static_assert (either mine or Hodgman's) reliably detects incompatible implementations at compile-time. There is no potential to run into sudden, inexplicable, hard-to-find bugs, the compiler while simply refuse to compile it. If your compiler does not yet support C++11, there is a Boost implementation of static assert which has been working for ages.

The example is nice but it does not solve the problem mentioned, it still leaves room for serious bugs in release build and that is simply unacceptable to me, prevention is still better then fixing in my mind. (but that’s just my believe)

You do not have much experience in working with actual, real-life, non-trivial C++ codebases, do you?

#5184296 Bad code or usefull ...

Posted by BitMaster on 01 October 2014 - 05:39 AM

Personally I would probably do it for my own projects because I know what platforms it compiles on. I would however add a static assert to be immediately notified about the need for intervention, probably something like that: static_assert(sizeof(Vec3) == 3 * sizeof(float), "unexpected packing");

#5184257 Qt Creator does not honor CMAKE_MAKE_PROGRAM

Posted by BitMaster on 01 October 2014 - 03:10 AM

I might be wrong but I think QtCreator always injects the compiler specified in the currently active kit (including switching the compiler when the active kit is changed).

#5183752 Build with specified features

Posted by BitMaster on 29 September 2014 - 09:11 AM

Several build system generators (like for example CMake) should be up to the job but introducing them retroactively will probably be an uphill battle.