Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

316 Neutral

About Doublefris

  • Rank
  1. you could try loading a precompiled shader to verify if it's indeed the compilers fault. that should also answer your question.
  2. Doublefris

    OpenGL and texture units

    I'm not an expert but that's what I do.   TUs from 0 to 7 are for textures. 8 and on are for FBO attachments. This can be changed rather easily (defined in two places, one for shaders, other for the program, I'll have it defined in a single place someday). Limit is in the amount of textures bound per stage, not the texture unit number you use (although you can't use any TU number you want).   I don't claim its the best way to handle things though. You can come up with a system that dynamically binds whatever a shader program needs on the fly. I'm just saying I prefer convention over configuration, just to keep things simple.What do you mean by 'per stage'? Lets say I am using 8 units for texture samplers like you, this means I can have for instance 2 samplers in my vertex shader and 6 samplers in my fragment shader?
  3. When using multiple textures in my application, for framebuffers but also just samplers, should I bind them to different texture units? Like, a new texture could check which texture units are available and bind itself to one that is available, or is this unnecessary? Or maybe, since we are only allowed to have one texture target per texture unit, it's better to reserve certain textures for FBO uses and other for sampling? Please tell me how do you handle this, and does it make a difference efficiency wise or organizing your engine.
  4. Perhaps it would be obtain the maxiumum of the acceleration curve by differentation, call it T and divide the curve by (maxAcceleration / T), so that the maximum acceleration will match the object's.   Now I'm not sure, but because integrals are linear you could then simply stretch out the t parameter like you said by the inverse (T/maxAcceleration).
  5. Doublefris

    Matrix "sign"

      Corrected. Also did not know we could use latex in here.
  6. Doublefris

    Matrix "sign"

    These matrices ( A & B ) both qualify as being orthogonal.   \[ \left [ \begin{matrix} 1 &0 &0 \\ 0 &1 &0 \\ 0 &0 &1 \end{matrix} \right ] \] \[ \left [ \begin{matrix} -1 &0 &0 \\ 0 &1 &0 \\ 0 &0 &1 \end{matrix} \right ] \]   Furthermore, my code says their quaternion representation is actually the same ( both the identity quaternion). glm gives me { 1/sqrt(2), 0, 0, 0 } for B curiously.   Also I know that det(A) = 1 and det(B) = -1   So I guess that orthogonal matrices have some sort of "sign" property to them, that gives the handedness of the basis? And how this work with quaternions? I suspect it might have some relation to the famous 'double cover' property of quaternions that people always mention. Basically the fact that Q and -Q correspond to the same rotation. I also wonder if this works for complex numbers as well as they're the 2d equivalent of quaternions.   Are there any other properties involving this 'sign'? I have a vague feeling it had something to do with the diagonal as well.   Maybe someone here has some deeper insights or facts to share about this
  7. I have been doing some gfx programming in opengl, and have some questions about it.   What is the relation between a vertex array (vao) and vertex buffer object (vbo)? When I call glBindBuffer(), I am getting that the first argument is like a global 'state' that is bound to the second argument? Like  glBindBuffer(GL_UNIFORM_BUFFER, uniformBufferHandle) will bind uniformbufferHandle to the uniform buffer object? If 2 is what I thought, then why do I need to use glBindFramebuffer() or glBindVertexArray(), rather than calling glBindBuffer(GL_FRAMEBUFFER, fbo) or whatever? What is the relation between glVertexAttribPointer(), glEnableVertexAttribArray(), and glEnableClientState()? Also, i'd like to know if there is some particular design philosophy that SGS chose or thing I should keep in mind. Like why they chose to go with this kind of buffer/handle design. Or some tips if you have any. I don't like calling all these opengl functions without knowing how exactly they should be used etc.
  8. Doublefris

    Quaternion Basics

    Whether the dot product is an additional structure or not is debatable. As you point out, q * conjugate(q) is an important quantity (the square of the norm). This is a positive-definite quadratic form in the R-vector space of quaternions, and it naturally defines an inner product by writing norm_squared(q + w) = norm_squared(q) + norm_squared(w) + 2 * inner_product(q, w) The inner product defined that way is the same as the dot product of q and w as elements of R^4. So I wouldn't say it's an additional structure.   how would you derive this quaternion inner product using only quaternion arithmetic though?
  9. Doublefris

    Computing a real power of a quaternion

    Managed to figure it out, also thanks to boost for their exp function // Raise a quaternion to a real power template <typename S> inline quaternion<S> pow(const quaternion<S> &q, const S ex) { return exp(ex * log(q) ); } // Raise a unit quaternion to a real power template <typename S> inline quaternion<S> unit_pow(const quaternion<S> &q, const S ex) { static const S C = S(1) - std::numeric_limits<S>::epsilon(); // Check for the case of an identity quaternion. // This will protect against divide by zero if ( std::abs(real(q)) > C ) return q; S a = acos( real(q) ); S u = a*ex; return quaternion<S>(std::cos(u), imag(q) * (std::sin(u) / std::sin(a))); } // logarithm of a quaternion. // when q is unit this gives { 0 + acos(r) * v/|v| } template <typename S> inline quaternion<S> log ( const quaternion<S> &q ) { S N = std::sqrt(norm(q)); return quaternion<S>( std::log(N), std::acos(real(q) / N) * normalize(imag(q)) ); } // exponential of a quaternion template <typename S> inline quaternion<S> exp( const quaternion<S> &q ) { S z = length(imag(q)); S w = std::sin(z) / z; return std::exp(real(q)) * quaternion<S>(std::cos(z), w * imag(q)); }
  10. An alternative formulation of the popular slerp function is:   (http://en.wikipedia.org/wiki/Slerp#Quaternion_Slerp)     my question is how is this actually computed in practice? Is it done by first finding the polar form and then multiplying the cosine and sine? I believe this is somewhat similar to how you would do it for complex numbers.
  11. Doublefris

    Outline "glow" effect

    Thanks, I was just making sure.   And thanks everybody for the input. appreciated.
  12. Doublefris

    Outline "glow" effect

    Not sure if there was some kind of misunderstanding here. What the two posters above me described is a "bloom" effect, right? I'm talking about the green glow around the dragon that happens when you hover a unit in dota2. I think left for dead 2 has it too.  A bloom effect is not what I want, but the outline of the rendered mesh around it.
  13. Hey there, it might have been asked before, but does anybody have an idea of how to implement an effect like this: (dota 2)   my idea was to render the backfaces of the mesh slightly scaled up first, but I think this wouldnt always work, since the scaling shouldnt always happen from the "center" of the mesh. Maybe the mesh itself is rendered and the resulting image is scaled up? I also don't know how to achieve a "glow". Any ideas?
  14. So I cant use the search function on my cellphone. Would be cool if i could. That's all ^^
  15. Doublefris

    Support Vector

    I think you mean the support vertex, which is the max dot product of a particular direction vector with the vertices of a (convex) polygon A.    Look at Dirk Gregorius 2013 slides, he explains it well. https://code.google.com/p/box2d/downloads/list
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!