Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 06 Mar 2012
Offline Last Active Yesterday, 03:00 PM

#5192116 Good C (not C++) math library?

Posted by uglybdavis on 10 November 2014 - 01:39 PM

Seeing how the glm source is available, why not copy-pasta the features you need?

I've done this in the past and ended up with a small managable library of math code.

#5185375 noob question - dark basic

Posted by uglybdavis on 06 October 2014 - 02:37 PM

It sounds like you're kind of a beginner, so welcome to the wonderful world of code!


For you, i'm going to go ahead and say the merits of a language should be gauged by the amount of information available targeting it rather than the complexity of learning it.

Say you want to write some pathfinding code (Pretty important for an RTS game), i'm going to go out on a dime and say you can find more / better resources about pathfinding utilizing C# or Javascript than you could using any flavor of basic. Also keep in mind you are not interested in learning EVERY feature of C# or LUA, just the small subset that targets what you are trying to do.


Even simple projects are complicated to code, there is a lot of hidden complexity. I would suggest using a pre-made engine as you are not trying to showcase your code writing skills. There are a few good options for you, the two prominent ones are Unreal 4 (Blueprints), and Unity3D. I haven't used blueprints myself, but from what i gather so far it's super simple artist friendly visual coding. With Unity you will most likely have to learn C#, but there are a LOT of references online for this. Just take a look at the Packt Pub books. And the 2D unity tutorials / resources are just growing larger and larger.


Anyway, best of luck!

#5167639 Dissecting idTech4

Posted by uglybdavis on 18 July 2014 - 11:02 AM

Dissecting a production engine is never a fun learning experience. In production, things make it into code that shouldn't. That's just life.


How about starting with a more modern engine, that was made specifically to learn from: 



There is an older GDC video about it, but i lost the link.

#5160530 Visual Studio 2013 _tmain ?

Posted by uglybdavis on 14 June 2014 - 12:29 PM

Thank you! That is the exact info i needed!!

#5145709 I need help with matrices

Posted by uglybdavis on 09 April 2014 - 10:18 AM

I think the core question here is, how to directly modify a matrix, instead of storing an additional data for position, rotation, scale and then rebuilding the matrix


For this, i'll point you to what i guess is the canonical resource on matrices: http://www.cs.princeton.edu/~gewang/projects/darth/stuff/quat_faq.html

If you look at the breakdown of the matrix composition, M[3][0] M[3][1] M[3][2] holds the translation vector. So, a function to set the position would simply modify these three bits of the matrix.


I hope this addresses the question.

Good luck!

#5143733 Need help finding an open source game with GLSL 330 or newer

Posted by uglybdavis on 01 April 2014 - 11:12 AM


#5137952 Instruments and memory usage going up without any leaks

Posted by uglybdavis on 10 March 2014 - 04:43 PM

From: http://memo.tv/archive/memory_management_with_objective_c_cocoa_iphone


An autorelease pool is an instance of NSAutoreleasePool and defines a scope for temporary objects (objects which are to be autoreleased). Any objects which are to be autoreleased (e.g. objects you send the autorelease message to or created with convenience methods) are added to the current autorelease pool. When the autorelease pool is popped (released) all objects that were added to it are also automatically released. This is a simple way of managing automatic release for objects which are needed temporarily.

E.g. You want to create a bunch of objects for temporary calculations, and instead of keeping track of all the local variables you define and then calling release for all of them at the end of your function, you can create them all with autorelease (or convenience methods) safe in the knowledge that they are going to be released next time the autorelease pool is popped. Note: there is a downside to this which I'll discuss in the Convenience vs Explicit section.

Autorelease pools can be nested, in which case autorelease objects are added to the latest autorelease pool to be created (the pools are stacked in a Last In First Out type stack).


Do you have any auto release pools? If so they are probably in a context that doesn't get destroyed (such as main)

#5134156 C++ IDEs for Linux

Posted by uglybdavis on 24 February 2014 - 12:03 PM

I'm currently using mono-develop, it's pretty awesome (though minimalistic)!


sudo apt-get install software-properties-common

sudo add-apt-repository ppa:keks9n/monodevelop-latest
sudo apt-get update
sudo apt-get install monodevelop-latest

#5131652 [Assimp] Getting bind pose bone positions

Posted by uglybdavis on 15 February 2014 - 11:16 PM

To my knowledge, assimp does not store bind pose.


The skeleton you have is stored in whatever frame 1 is.


The offset matrix is what you need to multiply a vertex (taking the joint's weight into account) by in order to get it into the bone space of frame 1.


I love assimp, but i can't stand the datastructures / orgonization / matrix handedness they chose.

#5129073 Flattening some polygons into an arbitrary plane

Posted by uglybdavis on 05 February 2014 - 11:06 AM

struct Plane {

  vec3 normal;

  float distance;


  Plane(const vec3& point, const vec3& norm) {

      normal = normalize(norm);

      distance = -dot(normal, point);



  vec3 ProjectPoint(const vec3& point) {

      vec3 pointOnPlane = (-normal) * distance;

      float dist = dot(normal, point - pointOnPlane);

      return point - dist * normal;




The constructor takes any point on the plane, and a normal.

The ProjectPoint function takes any arbitrary 3D point and returns that point projected onto the plane.

#5128785 GLM rotation isn't working right?

Posted by uglybdavis on 04 February 2014 - 12:53 PM

Scale it, Rotate it, Translate it. Correct.


OpenGL's (and glm) matrix multiplication works in reverse.

This is because the matrix is column major.


Scale, Translate, Rotate = rotate * translate * scale


Model, View, Projection = projection * model * view

#5127332 Raw draw functions in Game Engine (C++)?

Posted by uglybdavis on 29 January 2014 - 05:58 PM

If you already have drawing functionality in place, you just need to load models. Almost every package can export to .obj files.

Easy to use parser: https://github.com/tamato/simple-obj-loader

#5089332 GDI+ DrawString Invalid Parameter

Posted by uglybdavis on 26 August 2013 - 06:41 PM

Set length to -1, instead of 1. The proper number to pass in for you would be 2, it expects the number of characters, not string length.




Integer that specifies the number of characters in the string array. The length parameter can be set to –1 if the string is null terminated.


#5076992 OpenGL Connundrum

Posted by uglybdavis on 11 July 2013 - 06:15 PM

Nothing is going to solve the problem of not having proper drivers. Nothing.


From the original post i gather that the game must work under OpenGL 1.1 emulated environment (Hence no ANGLE). There was no mention of it needing to be performant. 



It honestly sounds to me like the idea of the assignment is to implement multiple render paths, which is what the poster seems to want to avoid.


Could be wrong tough....

#5072935 how to I design my mesh class

Posted by uglybdavis on 25 June 2013 - 10:49 PM

You should look at a 3D format like collada. Maybe milkshape would be easier to start with.

It's a tad harder, but assimp is interesting to work with, definateley has good data layout.


You will save yourself a LOT of toruble by seperating a mesh into mesh data (vertex soup), submesh data (indices into the soup), skeleton data and animation data. Assuming at some point you want to animate these things.

struct MeshData {
    // Positions, normals, uv's basically one big mesh soup
    unsigned int m_nVertexBuffer;

struct SubmeshData {
    // Just indices into the mesh soup
    unsigned int m_nIndexBuffer;
    unsigned int m_nMaterialIndex; // Indexes into mesh classes materials

struct Mesh { // Tough, i'd call this 'struct Model'
    MeshData mesh;
    std::vector<SubmeshData> submeshes;
    SkeletonData skeleton;
    std::vector<ClipData> animations;
    std::vector<Material> materials; // All the materials submeshes may use
    // Materials are shaders with some way of setting uniform data.

Rendering would be something like:

void RenderMesh(Mesh& mesh) {
   for (int i = 0; i < mesh.submeshes; ++i) {
      Submesh& submesh = mesh.submeshes[i];

Keep in mind, there is no logic up there. It's all data! you would also need something to represent the current animation state. Also, vbo's are useful when animating on the gpu, you will need to hold on to vertex data for cpu animation.


Edit: Did not read your post about needing to traverse triangles from outside, sorry.