• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

144 Neutral

About StiNKy

  • Rank
  1. Quaternions and Vectors

    Thanks haegarr and someusername, very helpful!
  2. Quaternions and Vectors

    Hi all. I'm having a bit of a problem figuring this out. Given that I have unit vector A, how can I find Quaternion Q which will rotate that vector to the direction of unit vector B? I tried making a Quaternion version of vector A by copying in the xyz components and setting the scalar to 0, and the same with vector B. And depending on the dot product between vector A and B I did one of the following: Quaternion Q = Conjugate(Quaternion A) * Quaternion B or Quaternion Q = Quaternion B * Conjugate(Quaternion A) I'm not too sure if this is the best, or even correct approach? Can anyone give me some advice? Thanks in advance.
  3. GLSL issue

    Yay I've figured it out. After going through the OpenGL GLSL manual, I noticed this definition: syntax: float length (genType x) description: Returns the length of vector, i.e., sqrt(x[0]*x[0] + x[1]*x[1] + ...) Naturally, gl_Vertex is a 4D vector, so normalizing it requires the length, which would return: sqrt(x*x + y*y + z*z + w*w) How very irritating that is...
  4. help with textures

    Actually, not declaring texture co-ordinates still has the cube textured, just the texture co-ordinate 0,0 (I think it's 0,0) is mapped to every vertex. So if you see strange discolouration, it's because of that ;)
  5. GLSL issue

    Radius :P But technically it shouldn't matter since normalize() would be doing it's job... What's even MORE strange is if I put a sphere with radius 50.0 in, the results are fine!
  6. GLSL issue

    That's exactly my point. The length already is = 1, so normalize() technically shouldn't be doing a thing, but for some reason it is. I don't quite understand you when you say "all the colour values summed up are going to equal 1.0f"? Do you mean for the fragment? Oh and no I don't have alpha blending enabled :P
  7. GLSL issue

    Hi. I've just recently dived head first into Cg and GLSL, and a small issue has popped up for me. I'm putting a unit sphere through the vertex shader, here's the shader: void main() { gl_Position = ftransform(); gl_FrontColor = normalize(gl_Vertex); } Now the output (tested in RenderMonkey and my own engine) is rather odd. You'd THINK you'd see a sphere with bright colours at the axis-extremeties, but instead I see dimly lit sphere. If I remove the "normalize(..)" and just have "gl_Vertex" I get what I'm supposed to see. My question is this: why on earth is normalize() cutting the vertices from the unit sphere so dramatically, it *should* have no effect on the vertices. Thanks in advance.
  8. Camera Rotations

    Well, show us your code :)
  9. OpenGL Alpha Blending issues

    I think you've got some things a little mixed up here. Alpha testing is a way of drawing parts of a texture that are over (or under) a certain limit, specified by you the developer. You set it with: glAlphaFunc(<Testing function>, <reference value>); And enable it with: glEnable(GL_ALPHA_TEST); Blending is a totally different issue. You may want to look at glBlendFunc(). As for the code examples, where on earth did you get glEnable(GL_GREATER, 0) from?
  10. Woops, didn't notice that. Obviously I just looked at the declaration.
  11. The link provided shows 4 parameters. All gl*Pointer commands USED to have five parameters, glTexCoordPointer used to be: void glTexCoordPointer( GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer ); They removed the count parameter.
  12. OpenGL OpenGL and matrices

    Ah ok. Thank you both!
  13. Hi all. Quick question: Giving that OpenGL lets you choose between float and double when specifying functions like glRotate/glTranslate/glLoadMatrix, which precision do you think it actually stores the projection/model matrix with? Thanks in advance.
  14. 3DS File Loading

    Ah, thanks for that, although I have a few follow up questions: I downloaded quite a few "free 3ds models" and they all pretty much had multiple objects out of alignment, it became so frequent it's obviously caused this thread! I actually don't have access to any version of 3d studio max, so is there any chance you can describe "3d studio axis alignment"? I've been toying with it for quite a while now, and have found that if I scrapped most of the vectors except the last one, the translation vector, and if I inverse it, I get some pretty interesting results: 1.0f 0.0f 0.0f -[ 9] 0.0f 1.0f 0.0f -[10] 0.0f 0.0f 1.0f -[11] 0.0f 0.0f 0.0f 1.0f It tends to fix quite a lot of the issues I have with some 3ds models, but definatly not all of them. But I still don't have a clue what to do with the first three vectors...
  15. I've been having some small problems writing my own 3DS file loader. I have all the basics down, vertices, faces, texture co-ordinates. But my problem arises when I have multiple objects. Basically it seems like most of the objects are out of alignment with each other. See screenshot here: http://img476.imageshack.us/img476/6531/3dsshot6vb.jpg (Please ignore the dodgy texturing, the model came from a "free 3ds models" site) What I think the correct fix is the 0x4160 chunk, the local axis chunk: 4 x 3D float vectors. Of which I have absolutely no idea how to properly parse to the renderer. I've tried mapping it to a matrix like so (OpenGL btw): [ 0] [ 3] [ 6] [ 9] [ 1] [ 4] [ 7] [10] [ 2] [ 5] [ 8] [11] 0.0f 0.0f 0.0f 1.0f But obviously with little success. So my question is this: Is it indeed the 0x4160 chunk which can fix this? Or am I totally of course? Or am I just parsing the 0x4160 chunk incorrectly? Thanks in advance.
  • Advertisement