Tagged: documentation Toggle Comment Threads | Keyboard Shortcuts

  • frankiezafe 14:11 on 2017-10-11 Permalink | Reply
    Tags: documentation, , ,   

    Ogre3d really deserves some attention to deliver its full potential. A good example is the management of different version of shaders in a single program. In the image here above, the graphical cards are very different: the laptop has a low-end integrated intel chipset, the workstation is working with a GTX 980. The supported opengl version: glsl120 max for the laptop, vp40 for the gtx.

    This information is dumped in terminal when the application starts, search for something like this:

    Supported Shader Profiles: arbfp1 arbvp1 fp20 fp30 fp40 glsl glsl100 glsl110 glsl120 gp4fp gp4gp gp4vp gpu_fp gpu_gp gpu_vp nvgp4 vp30 vp40

    Once identified, we can now prepare a program script to select shaders automatically.

    In the .material:

    material shader_tester
    {
      technique{
        pass
        {
          fragment_program_ref tester_pix
          {
          }
        }
      }
    }

    In the .program:

    fragment_program tester_pix_glsl glsl
    {
      source tester_pix_120.glsl
    }

    fragment_program tester_pix_glsl_330 glsl
    {
      source tester_pix_330.glsl
      syntax fp40
    }

    fragment_program tester_pix unified
    {
      delegate tester_pix_glsl
      delegate tester_pix_glsl_330
    }

    The crucial instruction here is the syntax definition in fragment_program tester_pix_glsl_330. The available flags are listed here: Declaring Vertex/Geometry/Fragment Programs. The fragment_program tester_pix_glsl has no syntax flag, it will be used as the default one.

    Shaders are stupidly simple in this case.

    tester_pix_120.glsl

    void main() {
      gl_FragColor = vec4( 0,1,0,1 );
    }

    tester_pix_330.glsl

    #version 330
    void main() {
      gl_FragColor = vec4( 1,0,0,1 );
    }

    And that’s it for the automatic selection of shaders in ogre.

     
  • frankiezafe 22:59 on 2017-09-20 Permalink | Reply
    Tags: , documentation   

    About constraints in bullet:

     
  • frankiezafe 22:41 on 2017-09-15 Permalink | Reply
    Tags: , documentation,   

    Camera rig example in engine 

    A new example showing how to use the class PCamRig object is available in the engine’s samples.

    PCamRig is using PRange objects to describe all rotations (pitch, yaw & roll), enabling a simple control of the angles.

    In the example, roll is going from 0° to 90° and yaw from -45° to 45°, the mouse is only controlling the percentage of each range applied on the camera. There is a subtlety about axis of rotation explained in the code.

    It comes with a simple way to interpolate value with an “elastic” effect. Explanation about the interpolation can be found here: Notes:Interpolation, speed/current

     
  • frankiezafe 21:20 on 2017-07-30 Permalink | Reply
    Tags: documentation, ,   

    Very interesting article about OpenGL Multi-Context (using the same textures, meshes, etc.) in multiple viewport, typically for multiple projections.
    OpenGL Multi-Context ‘Fact’ Sheet

     
  • frankiezafe 14:31 on 2017-04-07 Permalink | Reply
    Tags: documentation, , wiki,   

    Documentation about the XML format used to describe projects in the engine is available in the wiki. Please note that it might change in the upcoming month…

    Link in he wiki: https://bitbucket.org/polymorphteam/pe.2.0/wiki/xml-specifications

     
  • frankiezafe 19:18 on 2017-04-04 Permalink | Reply
    Tags: , documentation,   

    Today, certainly one of the less sexy thing i’ve ever posted…

    How to create a unique key out of two pointers in C++?

    After some investigation and a poor attempt to use boost uint128_t, i found my way using a char array.

    Here is the code:

    SomeClass* a = new SomeClass();
    SomeClass* b = new SomeClass();
    
    unique = new unsigned char[ 16 ]; // room for 64bits pointers
    uintptr_t ta = reinterpret_cast<uintptr_t>(a);
    uintptr_t tb = reinterpret_cast<uintptr_t>(b);
    
    for ( int i = 0; i < 8; ++i ) {
        unique[ i + 8 ] = ta;
        unique[ i ] = tb;
        ta = ta >> 8;
        tb = tb >> 8;
    }
    
    cout << "chars: ";
    for ( int i = 0; i < 16; ++i ) {
        cout << uint16_t( unique[i] ) << " | ";
    }
    cout << endl;
    
    uintptr_t newa = 
            unique[15] << 56 | 
            unique[14] << 48 | 
            unique[13] << 40 |
            unique[12] << 32 |
            unique[11] << 24 |
            unique[10] << 16 |
            unique[9] << 8 |
            unique[8];
    
    uintptr_t newb = 
            unique[7] << 56 | 
            unique[6] << 48 | 
            unique[5] << 40 |
            unique[4] << 32 |
            unique[3] << 24 |
            unique[2] << 16 |
            unique[1] << 8 |
            unique[0];
    
    cout << reinterpret_cast<uintptr_t>(a) << " <> " << newa << endl;
    cout << reinterpret_cast<uintptr_t>(b) << " <> " << newb << endl;
    cout << reinterpret_cast<RoadDot*>(newa) << " <> " << a << endl;
    cout << reinterpret_cast<RoadDot*>(newb) << " <> " << b << endl;
    

    And… done! The pointers are casted into the very useful uintptr_t as a unsigned int, stored in the array in 8 bits chunks. On 64 bits systems, pointers use 64bits… Therefore, the char array needs to have 16 slots ( 128 / 8 = 16 ).

    At the end of the code, the pointers are recreated from the characters and compared to the original values. In my terminal, here is what i saw:

    chars: 96 | 168 | 98 | 1 | 0 | 0 | 0 | 0 | 224 | 130 | 98 | 1 | 0 | 0 | 0 | 0 | 
    23233248 <> 23233248
    23242848 <> 23242848
    0x16282e0 <> 0x16282e0
    0x162a860 <> 0x162a860
    

    I’ll optimise this a bit, mainly by creating the char array based on the size of the uintptr_t * 2.

     
  • frankiezafe 13:38 on 2017-02-17 Permalink | Reply
    Tags: , documentation, ,   

    new class in package: PMaterial.

    This class is an helper that simplify the access to the multiple layers of Ogre’s materials.
    There are 3 levels in a material:

    • technique
    • pass
    • texture units

    The usual Ogre way to access to modify a pass diffuse is looking like this:

    Ogre::MaterialPtr ptr =  Ogre::MaterialManager::getSingleton( ).load( "mat", "group" );
    ptr.getTechnique(0)->getPass(0)->setDiffuse( 1,0,0 );
    

    Using PMaterial, it looks like this:

    polymorph::PMaterial ptr;
    ptr.load( "mat", "group" );
    ptr.diffuse( 1,0,0 );
    

    Selection of technique and pass is optional. The image above shows the fog configuration:

    pmat.fogMode( Ogre::FOG_EXP );
    pmat.fogDensity( 0.1 );
    pmat.fogDistance( 10, 30 );
    pmat.fogColor( 0.4, 0.4, 0.4 );
    

    All methods are not yet there, do not worry, they will come soon.

     
  • frankiezafe 13:24 on 2017-01-09 Permalink | Reply
    Tags: documentation, , repository   

    selection_748

    Big revision of the repository structure this morning.

    • assets: contains blender project & python scripts, ogre 2.0 materials, puredata & processing patches;
    • custom: Ogre classes overload or common configuration files, to deplou in SDK folder;
    • empty.0.1: an empty project to start with;
    • package: the polymorph engine, containing source code;
    • samples: a folder containing examples to be used as tutorials;
    • scripts: bash scripts to install polymorph and its examples.

    A lot of doc to be written!

     
  • frankiezafe 18:14 on 2017-01-04 Permalink | Reply
    Tags: , , documentation   

    install-party

    Planning an install party (next tuesday 10/01/2016 TO BE CONFIRMED) at the WTC with @xuv & @ptr_h to test the installation guide of the polymorph engine. If you want to be part of it, no probl’, everybody is welcome, just let me know!

    Note: the installation guide will be completed this week for linux. A guide for windows will follow.

     
  • frankiezafe 12:54 on 2017-01-04 Permalink | Reply
    Tags: , documentation, ,   

    012-new-project_734

    Updates the engine wiki done:

    • guide for project setup with cmake
    • guide for project import in netbeans

    I realise that the installation procedure is not complete yet, and it must be done before fosdem. It’s becoming urgent!

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel