Tuesday, March 12, 2013

almost donee

just need to implement the collision object and frustum and I am done. If I'm not lazy, I will implement the spline path and triangle strip. I can imagine how spline path will look like. But for triangle strip, I thing I am lazy to make such an object to test it. I don't know if I have to arrange the triangle to make triangle strip pattern or from the object created by artist and slam it into triangle strip

Friday, March 8, 2013

dirty programming

My hand is very dirty now. I bruted force everything as long as the code works. I created non relevant method anywhere. I don't know if cleaning up will be frustrating.

For this assignment, I have to create and structure scene graph from scratch. The data structure for the scene graph is using PCSTree. The application will run a Scene. When the program is loading, I called SceneLoad(). SceneLoad() will construct the game objects into tree.

The first thing is the root. Right now, I created an object root special for root. Each time the program loads, I have to attach nodeRoot into the tree manually. Then I can attach the rest of the objects.

I made graphics object class inherit from PCSNode. It can be attached and attaching with another graphics object. It also has speciality. The model matrix of the child always inherit from the parent. So whenever the child matrix has transformation, it will follow the parent's transformation then run the child's transformation.

The same thing with shader. The texture will act as a shader. So if the child doesn't have any shader, then it will use parent's shader. If both do not have shader, then both will use default shader.

The other problem is the stock shader from GLTools. The method UseStockShader from GLTools seems like the root of everything to render. If I want to use different shader, I need to use the stock shader and pass appropriate parameter. The stockshader is using GLSL shader because its structure has vertex shader and fragment shader.

Tuesday, February 19, 2013

IntelliSense: PCH warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated

From my experience, when I cleaned my project and built, there was no error or even warning on the output window. However, after I checked on the ErrorList window, there is error "IntelliSense: PCH warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated". It is because it is looking for the pre-compiledheader. The solution is under project property->C/C++ -> Precompiled Headers and make the precompiled Header becomes "Not using precompiled header". If you're sure that you have already set to not using precompiled header and still got that error, the suspect is the library you're using. For example, I use the library gltools.lib. In the gltools project, it is still not set to "not using precompiled header". So it got that error

Tuesday, February 5, 2013

da da done

da da done for milestone 1. Ready for milestone 2. After knowing the memory system works and know how to debug the memory, life gets easier.

Thursday, January 31, 2013

prefer pass by reference to const to pass by value

pass by reference is faster than pass by value.

Take a look at this example:

void Foo(const nameclass A) and void Fee(const nameclass &A);

when I call Foo, I invoke a call to A copy constructor. If the class is big enough and it is derived from something something something, it invokes the constructor of all of its parents.

 If I use reference, when I pass through  parameter, it doesnt invoke constructor call and doesnt reserve new memory. It just take A address.

So pass by reference is much faster and don't forget to set it to const

Wednesday, January 30, 2013

union

combine the memory using union. very cool.
union
{
   int a;
   int b;
};

address a and b will be the same. It needs to be careful in using them

file engine

For assignment 3, the task I had to do was creating file engine and wrap it using file win32. I tried to implement the file buffer because when I do WriteFile using win32 function, it doesn't send to buffer instead of writing it to file. I tried to compare them and the difference is steep.