# Atash

Member

94

138 Neutral

• Rank
Member
1. ## Python and C++

A quick word... If you wish to change from python to C++ later on, I'm guessing that going from weakly-typed Python to strongly (occasionally annoyingly strong) typed C++ might make you go a little insane. Just a thought. (I personally started C++ and went to python, and found the weakly-type-ness-thinger of it to be a pure annoyance, so I'm only guessing at the reverse being more or less the same). G'luck with Python! A helpful link (not sure this was said yet, but w/e): http://www.vex.net/parnassus/
2. ## How to 'guess' best ?

If the purpose of this is simply to take a whole bunch of integers and squish them down in size, and performance doesn't mean anything, and you really really really want to save the extra hundred bytes (don't see why)... Then you could take those averaged values and have a seperate vector with values representing the absolute value of the difference between one of the averaged values and the average itself. Basically, for every unsigned int pair: unsigned int src: 2, 6 unsigned int avg: 4 ...unsigned char difference: 2 | 6 - 2 | == | 2 - 4 | == 2. That way you're saving a weeeee bit of storage space (could be more if you have a couple of hundred thousand ints, however...) Then again, if everything is a value between 0 and 255, everything fits in a byte anyways which makes my entire explanation of my idea before entirely, uh, nullified. Err. Useless. What's the purpose for this anyways?
3. ## Getting the Angle between 2 Normals(SOLVED)

Because the link is broken (at least for me), I'm going to play it safe and just spit out the answer. If you have the two vectors for the normals, you can find the angle between those two vectors by taking their dot product, dividing that by both of their magnitudes multiplied by each other, and then taking the arccosin of the whole enchilada. A and B are Vector3s. <A, B> denotes the dot product of A and B arccos( <A,B> / ( |A||B| ) ) The dot product is basically the cosin, but it gets bigger in length because of the magnitude of A and B being multiplied in during the dot product, so you have to divide by the magnitudes. Please correct me if I'm wrong.
4. ## C++'s pshpack & poppack & array padding

Aye. Thank you!
5. ## C++'s pshpack & poppack & array padding

Ah. Okay :) Thanks.
6. ## C++'s pshpack & poppack & array padding

Well, it isn't part of the language, yes, but I'm wondering if including pshpack.h and poppack.h would stop automatic byte-alignment...
7. ## C++'s pshpack & poppack & array padding

I've read around and found that C may or may not pad an array of structs to take advantage of the word length on a particular machine. I've also read that pshpack and poppack can overload the automatic type padding, and I'm wondering if this would be the correct usage of the terms to avoid type padding: [source lang=cpp] #include <pshpack1.h> template<typename T, unsigned int N> class Array { protected: T elems[N]; public: // member access operator const T* () const /*----*/ { return elems; } operator T* () /*----------------*/ { return elems; } T operator[] (int i) const /*----*/ { return elems; } T& operator[] (int i) /*---------*/ { return elems; } }; #include <poppack.h>
8. ## GCC 3.4.2 lacking stream headers + probs in general w/ GCC

#include <ofstream> int main(int argc, const char* argv[]) { //START DEBUG TEST std::ofstream debug = std::ofstream("debug.txt"); That's really the only offending part. I believe I ought to be including something else, from what you said, but I'm just slightly confused as to how a string can be considered a stream and thus incite the copy constructor? EDIT: Heh, forgot something... I'm using VC++ 2005 Express as my IDE (to compile it without problems), and whatever version of VC++ that came with that.
9. ## GCC 3.4.2 lacking stream headers + probs in general w/ GCC

Okay, technically, I'm not a newbie, because I'm already using VC++, however, I have an issue with GCC and getting it to work. I used to use Code::Blocks Rc1.0 which came with mingw installed, and had no problems with using ifstreams and ofstreams and the such. However, the standard library for the MinGW that I have just doesn't seem to work. I looked in the folders, and there was no ofstream file. Also, when I used fstream, the compiler came up with errors revolving around ios_base having a protected constructor and something about std::endl not existing. Is there any place I can download a more complete standard c++ library? Or, even better, am I doing something wrong and can I fix this without having to jump around the net? I've used google already but keep getting libstdc++, which comes directly with the GNU GCC and I can't exactly figure out how to make it all work out from source...

As far as I know, if you have two header files including each other, even with inclusion protection, they would go down in a sort of an infinite loop including each other because each one depends on the other existing. If you think of the inclusions not as simply the act of asking for a header file, but actually taking that header file and sticking it in the file including that header file, things make more sense: A.h: #include "B.h" B.h: #include "A.h" This results in A.h including B.h... including A.h including B.h... Etc. If A.h is compiled first and #include inserts code as I think the precompiler does (It's all just string manipulation, the precompiler I mean)... Then: A.h: <B.h> //From A.h's #include B.h <A.h> //From B.h's #include A.h <B.h> //From A.h's #include B.h <A.h> //You can probably guess this one etc. Where the '<>' symbols represent insertion of the specified header file. Just wanted to sort of clarify... And to make sure I get it as well, so correct me if I'm wrong, please.
11. ## retaining pointer settings after disabling vertex arrays?

To Phantom: I forgot to mention I'm only typing up code to compile later once I re-set up my mingw32 compiler (which I keep putting off <_<)... which basically means that I'm just editing code at the moment. To Eric: Thank you.
12. ## OpenGL retaining pointer settings after disabling vertex arrays?

In OpenGL, you can set arrays after enabling them, right? So then, what if you set the pointer for the vertex array before enabling? Would the pointer information still be retained by OGL? Also, does the same go for disabling the state and then enabling the state again?
13. ## OpenGL missing ogl files from VC++ Compiler

I have a VC++ compiler, but it is missing gl.h, glu.h, glut.h, opengl32.lib, glu32.lib, glut32.lib, and opengl32.dll... And I can't find a single place to download it. Everywhere I look it says that they are supplied with the compiler, which I know is true, and yet I lack them. Could someone tell me where to get the windows files? plzthx in advance :-)
14. ## Lighting with camera class

No, wait... by loading the identity matrix, aren't you automatically sticking the light relative to exactly where you are and not the origin? Anyways... The only way I think that could happen is if you were somehow positioning the light relative to the camera, which would mean that you're missing a transformation call before setting the light each frame. Also, I'm not so sure about this, but, if you're only setting the light's position once, and it's being multiplied into the current matrix, then, if you don't constantly reset the light's position, wouldn't you end up having the light in the exact same position relative to your camera every time? Or am I just misguided at the moment?
15. ## ASE Scene Importer

Just make a file that has animation in it, and then open up that file with a text editor. You'll find the keywords CONTROL_POS_TRACK and CONTROL_ROT_TRACK in the GEOMOBJECT blocks that have object specific animation. Both are blocks. The pos track is a series of an integer and 3 floats (the integer being the number of ticks for that keyframe from the start of animation), which is the new position, not accounting for the original offset specified in TM_POS (under the node info block). The rot track is basically the same except with 4 floats, and doesn't account for the original offset specified in TM_ROTAXIS or TM_ROTANGLE (yet again in the node info block). The rotation is in axis-angle with the format of axis first and then angle in radians. Also, vertex morph information is specified in multiple seperate meshes with integers in them specifying the ticks since the start of animation. The rest of the information can be read out as a regular old MESH. That's really about all I know. My loader can't handle vertex morph animation yet... I hope I've been of some help to you.