Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

BornToCode

Member Since 17 Apr 2004
Offline Last Active Today, 12:15 AM
-----

#5063419 Mimic DirectX11 Binding System in OpenGL.

Posted by BornToCode on 21 May 2013 - 01:01 AM

I guess the topic says it all. I am working on a wrapper which looks very similar to DX11 but uses OpenGL in teh backend instead. I am trying to simulate the Binding system that directX11 uses in OpenGL. Currently the way i am doing it is that if you want to use the same resource for different stages in the pipeline i find myself duplicating the buffers for each Bind instead of reusing the same Index, and whenever one of the index change it updates all the other buffers to match the data in the one that change. I am just posting this to see if anyone might have a better idea on how to approach this, or if this will be even possible under opengl since each resource can only be mapped to an single object type.




#5060735 Detecting Billboards

Posted by BornToCode on 09 May 2013 - 07:54 PM

use the average position of all 4 vertices as your position




#5059882 Shadow map with multiple lights.

Posted by BornToCode on 06 May 2013 - 08:32 PM

This is a quick question i wanted to ask and see how other are handling this. In my engine on every update i scan for all the visible objects in the Octree and store them in array. Then i iterate over each object and for each object i check how many lights affects it. For each lights that affects the object i put it in his own depth map. Once i am done, i interate over all the lights and perform shadown mapping for each light. For some reason this does not sound too optimal to me, so i was wondering how other people are doing it. Is there a better way of doing this.

 

Thanks.




#5055795 opengl, row-major ortho projection problem

Posted by BornToCode on 22 April 2013 - 12:10 PM

OpenGL has no sense of column major or row major. All it cares  about is that your translation data is store in element 12,13,14. Row major or column major all depends on how you use the matrix. For example in my case i store the X Basic in the element 0,1,2. Y Basic in 4,5,6 and Z Basic in 8,9,10. Others might store their X Basic in element 0,4,8. At the end of the day as long when you perform your operation you multiply the matrix in the right order you should be fine. Another example let's say you use 0,1,2 as your X Basic, then when you multiply it with another matrix then you would multiply 0,1,2, with elements 0,4,8 of the second matrix. If you store your matrix in 0,4,8 then you would multiply it with element 0,1,2 of the second matrix. So as you can see it does not matter. Like i said OpenGL has no meaning of column or row, it is al up to you as long you make sure that element 12,13,14 are used as your translation. I hope i did not confuse you.




#5055245 Blending Render Targets

Posted by BornToCode on 20 April 2013 - 10:41 AM

You can used two render target and ping pong between them when you creating multiple layer. For example you write to one render target in the first pass. Then in the second to n passes you bind that target to a sampler. Then you can just do a simple additive blending of the layer which is bind with the incoming pixel of the current layer. At the end you will end up with a render target that has all the layers combined.


#5051305 Learnt C what next?

Posted by BornToCode on 08 April 2013 - 03:34 PM

You do not need to know objective C in order to do Development for Mac/IOS. I mean just basic Objective C should get you going. All the code cane be implemented in C or C++




#5047371 GLSL weirdness

Posted by BornToCode on 27 March 2013 - 02:31 PM

You know what, i just solved it. It was something stupid. Just in case someone wants to know how i fix it.

The problem was that i was using glGetActiveUniform as the location index. which i should have know better,but to use glGetUniformLocation because the prior one does not handle uniform locations. Dumb me.




#5046615 List of games based on complexity

Posted by BornToCode on 25 March 2013 - 01:45 PM

Any game can be complex. It all depends on the features and functionality you want to implement in the game.




#5036774 Problem rendering Quake 3 BSP files

Posted by BornToCode on 26 February 2013 - 11:45 AM

blueshogun96 thanks,  BornToCode an array starts at zero so 0,1,2.          mhagain ok, I will start reading Idtech 3's source code, I have read quake, and quake2's have a fairly good understanding of them 

That is what your index needs to say 3 index 0 1 and 2 are used. When you create an array with one element you do not say int Array[0] you say int Array[1] and you use only used index 0. So if you have x y and z then your Array needs to be defined as int Array[3] not int Array[2]. Look at your code in your bspface you have float vNormal[2]; 

vNormal supposed to have xyz which means vNormal needs to be [3] not [2]




#5036379 Camera/screen moving

Posted by BornToCode on 25 February 2013 - 11:38 AM

If this is for a 2d game, what you can do is attached the camera to the player. As long the player is not in the center of the screen and the level can scrool you move the player. Once you hit the center of the screen you still move the player but also move the camera, but subtracting the camera from the player position so in reality your player is not moving and will remain in the center of the screen while the camera increments. Then what you need to do is subtract from the position of every object by the camera that will simulate the level scrolling while keeping the player in the center. Once you get to the end of level where it can no longer scrool, then you stop incrementing the camera and keep moving the player which will simulate the player moving to the far edge of the screen which means you reach the end of the level.




#5036181 Best way to load a 3D object into memory from a file?

Posted by BornToCode on 24 February 2013 - 04:06 PM

The tool is my own custom tool. It extract all the information about the an Mesh such as Vertices/Normals/Tangents/Bones information and store into an .gameformat which is custom. One of the format i can consider to look into is the .fbx format. You can used Autodesk  fbx SDK to load .fbx models.

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=7478532




#5036136 Best way to load a 3D object into memory from a file?

Posted by BornToCode on 24 February 2013 - 11:55 AM

The way you are doing it is not a bad way of doing things. One of the advantage the way you are doing it, is that you can load different formats and dump it to an format that your dx app can load. I do something very similar in my engine where i have an external tool that loads .fbx,.obj and .ase to an format that my engine loads.




#5035983 glScissor - Coordinate confusion

Posted by BornToCode on 23 February 2013 - 08:50 PM

glScissor  cordinate 0,0 is the bottom left hand corner not the top left.




#5035978 make an object that is pointing in a direction rotate to point in another dir...

Posted by BornToCode on 23 February 2013 - 08:48 PM

I have attached some code that will help you do it. I could go into the detail of explaining it. But looking at the code would help you understand it as well. If you have any questions let me know. The code below is how i handle it in my engine

 

    Vector3 lookAtDir = direction;
    lookAtDir.Normalize();    
    float angle = Vector3::Angle(lookAtDir,Vector3::forward);
    if(Mathf::Approximately(angle,0.0f))
    {
      //We are already pointing to the direction.
      return;
    }
    //Compute sin angle
    Vector3 axisToRotate = Vector3::Cross(Vector3::forward,lookAtDir);
    float length = axisToRotate.magnitude();
    if(Mathf::Approximately(length,0.0f))
    {
      //Direction is parallel.
      //Recompute right vector based on new look at direction.
      Vector3 newright = Vector3::Cross(Vector3::up,lookAtDir);
      axisToRotate = Vector3::Cross(lookAtDir,newright);      
    }
    //Recompute final rotation.
    Quaternion to = Quaternion::AngleAxis(angle,axisToRotate);
    if(to!=localRotation)
    {
      localRotation=to;
      isDirty=true;
      Update();
    }




#5033078 How do you achieve resolution independence?

Posted by BornToCode on 16 February 2013 - 11:08 AM

Did you take a look at the solution i posted. That is the easist way to go about doing it without having to change any of your code. And it will work with any resolution






PARTNERS