# StiNKy

Member

63

144 Neutral

• Rank
Member

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. ## OpenGL MSDN seems to give glTexCoordPointer 5 parms

Woops, didn't notice that. Obviously I just looked at the declaration.
11. ## OpenGL MSDN seems to give glTexCoordPointer 5 parms

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. ## OpenGL OpenGL and matrices

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.