- Viewing Profile: Reputation: BitMaster
Community Stats
- Group Members
- Active Posts 838
- Profile Views 4,202
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
#5010138 Networking to Slow - Java Multiplayer Pong
Posted by BitMaster
on 13 December 2012 - 04:15 AM
#5010136 OpenGL triangle winding order
Posted by BitMaster
on 13 December 2012 - 04:09 AM
On the other hand, the triangle CBA is in CW order in the first example and in CCW order in the second example.
Most renderers (that includes DirectX and OpenGL) expect a CCW face to be the front face and will simply cull backfaces. At least in OpenGL you can specify which winding is treated as the front face and how exactly to handle front- and backfaces.
#5010112 Networking to Slow - Java Multiplayer Pong
Posted by BitMaster
on 13 December 2012 - 03:15 AM
#5009825 OpenGL triangle winding order
Posted by BitMaster
on 12 December 2012 - 08:10 AM
A |\ | \ B--CLike this, the triangle ABC is in counterclockwise order. Now move your head around the paper so you see it from the other side (alternatively, just flip it over).
What you see from this position (minus the flipped BC) is:
A /| / | C--BThe triangle ABC is now in clockwise order (and would be culled normally).
#5009783 Direct Input
Posted by BitMaster
on 12 December 2012 - 05:09 AM
If a practice has several disadvantages AND is discouraged as not recommended by the API designer, then the question you should be asking is "Is there any really compelling reason to still do it?" instead of "Why should that stop me from using it?".
Honestly, I do not see any point of DirectInput for these cases. You need to handle Windows messages anyway, and you even have functions like GetKeyboardState to query the current state.
#5009734 Can you create a Vector of structs in C++? I need help with a unknown error p...
Posted by BitMaster
on 12 December 2012 - 01:39 AM
vector <int*> names; works, so then wouldn't you have a vector of structs or classes if the int* referred to the addresses in memory of different data structs?
For the reasons above having raw pointers to Rectanglee in the vector is generally not a good idea unless you have the experience to know what you are really doing (and if the OP is confused by a private copy constructor then he is definitely not there). Dropping all type safetype by forcing a cast from int* to Rectanglee* is much, much worse for absolutely no benefit. You lose all type safety and gain exactly nothing over the Rectanglee* implementation. You also have the option of walking well off into undefined behavior if you do not understand the casts between the involved pointers very well and depending on how your inheritance hierarchy looks. And you still have to allocate storage for the Rectanglee somewhere somehow for the pointers to point to.
Even setting those things aside, why would you store int* instead of Rectanglee*? If something like that has to be done (and I cannot imagine any reason out of the top of my head that is not done better by other methods), why not use at least void*?
That said, the obvious candidate to solve the issues is boost::shared_ptr. In C++11 either std::shared_ptr or std::unique_ptr would do the job. Of course if we had C++11 I would rather make the involved type movable and just stick them into containers normally (if possible).
#5009445 freeglut Linking error
Posted by BitMaster
on 11 December 2012 - 10:14 AM
int main(); int main(int, char**);See the standard (or Wikipedia if a standard is not at hand) for a complete list of what is allowed here, although MSVC allows a few non-standard extensions.
For /SUBSYSTEM:Windows the entry function must be
int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int);Although it is possible to change the name of the entry function in MSVC, the signature still must be as expected.
#5009361 freeglut Linking error
Posted by BitMaster
on 11 December 2012 - 01:40 AM
#5007728 java.lang.OutOfMemoryError with Audio Clip
Posted by BitMaster
on 06 December 2012 - 05:52 AM
Assuming your resources all reside in the Level instances, a quick fix would be to set level1 to null when you move over to level2, and so on. Of course a much cleaner solution would be a data-driven design where only one instance of Level is active and a new one is filled with data for the new level as needed.
#5006631 Endian independent binary files?
Posted by BitMaster
on 03 December 2012 - 09:28 AM
(source)Every TIFF begins with a 2-byte indicator of byte order: "II" for little-endian (aka "intel byte ordering", circa 1980) and "MM" for big-endian (aka "motorola byte ordering", circa 1980) byte ordering. The third byte represents the number 42 which happens to be the ASCII character "*", also represented by hexidecimal 2A, selected because this is the binary pattern 101010 and "for its deep philosophical significance". The 4th byte is represented by a 0, an ASCII "NULL". All words, double words, etc., in the TIFF file are assumed to be in the indicated byte order. The TIFF 6.0 specification says that compliant TIFF readers must support both byte orders (II and MM); writers may use either.
#5006624 Questions regarding images downloaded from google image search and used ingame
Posted by BitMaster
on 03 December 2012 - 09:18 AM
#5006595 New is SLOW!
Posted by BitMaster
on 03 December 2012 - 07:48 AM
#5006586 Questions regarding images downloaded from google image search and used ingame
Posted by BitMaster
on 03 December 2012 - 07:22 AM
If it is some commercial endeavor from which you try to steal images then it is pretty safe to assume they will find out unless it never leaves your local hard disk. Any free samples you see will probably contain an invisible watermark which will not be easy to get rid off and some webcrawler somewhere will detect it.
#5006585 New is SLOW!
Posted by BitMaster
on 03 December 2012 - 07:13 AM
- stack allocation requires incrementing a pointer by sizeof(WhatIWant)
- heap allocation requires synchronizing over all threads and walking some kind of list until a suitable chunk of memory is found, modifying the list accordingly, and returning the pointer.
Note that this applies to C++ only. On modern Java implementations for example, new is silly cheap. Also note that the Debug runtime of MSVC for example does a lot of extra work (like initializing the allocated memory with a special value and padding the allocated memory with another special value).
Also note that an optimizing compiler will probably be able to completely eliminate your passing function since it can detect that nothing in there has a side effect. I would not trust the benchmark as written. Either the compiler is not optimizing (in which case it's probably the default Debug configuration in case of MSVC and as such completely useless for any benchmark) or the function and containing loop was probably completely removed.
- Home
- » Viewing Profile: Reputation: BitMaster

Find content