Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

286 Neutral

About Gviau

  • Rank
  1. The matrix you use to transform the normals is wrong. You're only using the model matrix when you should use the inverse of the transpose of the model view matrix, that is the model matrix multiplied with the camera's matrix.   If your model view matrix is orthogonal, you won't even need to use the inverse transpose (as it shall be the same).   Anyway, the gWorld matrix should be cameraRotate * cameraTranslate * Model
  2. Gviau

    All Jokes aside, what is 6/2(1+2)?

    Moreover, division is just multiplying the multiplicand with the inverse of the multiplier, which reinforce the fact that division has the same priority as multiplication.   Therefore, you have to read the equation from left to right when there are equal priorities.
  3. You are multiplying your matrices in the inverse order. The line: mvp = transform * projection; Should be: mvp = projection * transform; This is because you are setting the third parameter of your glUniformMatrix4fv call to GL_FALSE. If you set it to GL_TRUE, then your matrix multiplication order would be correct. However, you would have to stick to this order everywhere in your code, even in you shader, which would mean that your multiplication would be: gl_Position = vec4(position, 1.0) * mvp; The thing is that OpenGL assumes that your matrices are in column-major order, which the glm library takes care of. Recall that the transpose of a matrix is the operation where the columns become rows, o if you want row-major ordering, just set the third parameter to GL_TRUE.   In the end, it does not really matter what you choose as ordering as long as you stick with it from beginning to end. Check out this stackoverflow question for more details: http://stackoverflow.com/questions/17717600/confusion-between-c-and-opengl-matrix-order-row-major-vs-column-major
  4. Gviau

    Best comment ever

    Saw this from a friend at University the other day: def heuristic(self, node): #360 no comment return sum((lambda m, l :map(lambda s: m-s, l))(*(lambda l : (max(l), l))( list(map(sum, map(lambda l: map(lambda e: e[1], l), map(lambda l: filter(lambda e: e[0], l), map(lambda l: zip(*l), zip(node, self.lists))))))))) #sorry He said that his eyes bled but he felt a strange satisfaction.
  5. Gviau

    Animation timer?

    The C++ standard (assuming you are using C++ as a programming language) offers functionality to query the current time: http://www.cplusplus.com/reference/ctime/ and http://www.cplusplus.com/reference/chrono/ (C++11 only). Those links contain information about functions (and classes, for the C++11 link), along with examples, that may help you.   As dpadam450 suggested with its code snippet, you can encapsulate your main loop with two query of times and calculate the difference between the two. This gives you the time that your loop took to do all that it had to do. This time is usually called the delta time.   You can then verify if 800 ms has passed by summing all those delta times and checking whether or not it is above 800 ms.   The only difference with dpadam450 is that the code snippet that he provided will work only on Windows, whether using the standard library will allow you to use the code on different platforms.   Also, another solution when using animations is to multiply the factor used for the animation with the delta time. For example, if you want to move an object 100 units per second, you would do something like: pos += 100 * dt; where pos is your current position and dt is the delta time of the last frame. The same can be applied for an animation.   Hope that helped a bit!
  6. Looking at your code, it might be that you are referencing the faces of your mesh using the index i instead of e, thus loading only a few faces.
  • 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!