Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

Laval B

Member Since 30 Jul 2010
Offline Last Active Today, 03:48 AM

#5199766 Codebase with multiple back-ends

Posted by Laval B on 23 December 2014 - 04:17 PM

I think a simple but somehow less manageable approach is just to use template and typedef:


In some way that's pretty much what i do ... I put the various implementations into different files (.h and .cpp) and i use include files that include the proper headers for the platform/configuration i want to compile. It's less messy that way because there isn't a bunch of conditional ifdef all over the place. It's not necessarily possible nor desirable to put all the code inline.


The real problem is not the code but the configurations and the project/make file that need to be setup on a per configuration and a per platform, basis. Remember that everything isn't just a matter of code, like linker setups and libraty paths.

#5102175 Behavior of assignment with user data in Lua

Posted by Laval B on 17 October 2013 - 10:56 AM

Nevermind, it's a stupid question. I'll just implement a clone method.

#5101522 lightuser data in Lua

Posted by Laval B on 15 October 2013 - 06:39 AM

Hello everyone.


An application we are working on needs some parts to be scripted. The scripts will only act as callbacks to controle some  part of the execution of some transactions. To do so, it must expose a few objects from the host application. The lifetime of these objects is well controled by the host and they will outlive the execution of the script. The logical choice seems to be the use of lightuser data.


We have exposed these objects using functions and lightuser data and it does work. However, lightuser data don't have their individual metatable. Instead, they all share the same so they all share the same metamethods. It would be great though if we could associate specific methods to each object exposed (like it can be done with full user data) so it would be possible to use object oriented programming notations on those objects from the script.


At the moment, we have to use a notation like this :

function f(user, logger)

   setName(user, "name")
   setGroup(user, "group")

   output(logger, "User is set.")


instead of 

function f(user, logger)


   logger:output("User is set.")


Is there a way to do this with lightuser data ?

#5075319 Uniform blocks and Uniform buffer objects

Posted by Laval B on 04 July 2013 - 03:10 PM

Ok, i think i figured it out. I can't use only one binding point, i need to have one for each uniform block. But i can use only one ubo and bind different part of the ubo to each uniform block using glBindBufferRange.


I still have one question though, must i call glGetUniformBlockIndex and glUniformBlockBinding after the program has been linked ?

#5068236 States managed by a VAO

Posted by Laval B on 08 June 2013 - 09:11 AM

Thank you for the clear answer smile.png


It makes sense indeed, i didn't pay attention when i read the glVertexAttribPointer/glEnableVertexAttribArray part and got confused when they say :


<array> is the vertex array object name. The resulting vertex array

object is a new state vector, comprising all the state values listed in
tables 6.6 (except for the CLIENT_ACTIVE_TEXTURE selector state), 6.7,
and 6.8 (except for the ARRAY_BUFFER_BINDING state).


Ref http://www.opengl.org/registry/specs/ARB/vertex_array_object.txt


I forgot that vertex attributes are not necessarily in the same vbo (over 95 % of my vbo are filled with interleaved data).


Now, index buffer will get bound when binding the VAO. I guess i can still bind the index buffer separately after binding the VAO (which will update the VAO state every time though). If i do this, i will have to make sure to bind index buffer 0 if I render a VAO with no index buffer. Would that be a problem ? You see, my code base pretty much separates the vertex (and the vertext attribute specification) from the index.

#5064790 Finding a process

Posted by Laval B on 25 May 2013 - 09:23 AM

The problem doesn't come from EnumProcesses but from OpenProcess. Try using the snapshot api.
If all you need to do is to determine if the given process is running or not, you could just write a function like the following :
bool IsProcessRunning3264(LPCTSTR pProcessName)
    bool bRetVal        = false;
    HANDLE hSnapshot    = NULL;
    PROCESSENTRY32 pe32 = {0};

    //    Take a snapshot of all processes in the system (including system processes).
    hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

    if(hSnapshot != INVALID_HANDLE_VALUE)
        pe32.dwSize = sizeof(PROCESSENTRY32);

        //    Retrieve the informations of the first process of the snapshot. 
        if(Process32First(hSnapshot, &pe32))
                CString str(pe32.szExeFile);

                if(str.CompareNoCase(pProcessName) == 0)
                    bRetVal = true;

            }while(Process32Next(hSnapshot, &pe32));
    return bRetVal;



Hope this helps.

#5033815 C/C++ JSON library

Posted by Laval B on 18 February 2013 - 11:21 AM

Hello everyone


We are switching some of our homemade communication protocol from XML to JSON. This means we need to be able to encode/decode JSON strings. The applications are written in C++ and some must be compiled on Windows as well as Solaris. I've check libraries listed here http://www.json.org/. Though there is a plethora of libs written in C/C++, lots of them aren't interesting for various reasons : many are only parser but we also need the encoder, some are just too big and have too many features we don't need (http clients, ftp client, etc), some are missing key features like good utf-8 support, others aren't thread-safe ...


So far, my choice would probably be json-c-0.9. There is a few things i need to check but this one seems to be a good trade-off. I was wondering what you guys are using (in C or C++ of course). I have no preference for C or C++ as long as the C++ libraries don't overuse exceptions.


Thanks for your answers.

#5003923 Problem with oci library

Posted by Laval B on 25 November 2012 - 05:28 AM

Does your installshield place the executable file in Program File (x86) ? If so, this is likely to be your problem. When OCI is loaded, it gets the current directory and composes all the paths to find other files it needs like <oracle_home>/network/admin where your tnsname.ora is. Unfortunatly, oci libraries before version 11 have a bug with string having parenthesis and can't compose their internal paths right in that case. The solution is either install your application in another directory or use version 11.2 of the library.

#4985693 Tab order with MFC tab control

Posted by Laval B on 01 October 2012 - 03:24 AM

You need to give your children dialogs the WS_EX_CONTROLPARENT style. This is easily done using the property page of the dialog in the resource editor. There is a property called Controle parent, make sure it is true for all your pages. Also, make sure the dialogs are children of the parent dialog and not the tab control.

#4961349 Hardware Occlusion Queries, why use them next frame?

Posted by Laval B on 20 July 2012 - 09:56 AM

As a side note, in GPU Pro 2, there is a good article describing the use of hierarchical z-buffer queries using a render target that looks very interesting.

#4960060 FPU mode

Posted by Laval B on 17 July 2012 - 10:59 AM

EDIT: The source is buried at the bottom, here is the direct link: http://www.christian.../fpmath/xpfpa.h

Very interesting and useful. It explains and clarifies alot of things.

danke schön

#4959938 FPU mode

Posted by Laval B on 17 July 2012 - 03:28 AM

Not entirely true... for example, the outputs of SSE2 instructions can be made to converge to (close to) FPU instructions with appropriate settings. This might be useful if, say, one wants a 64-bit app to generate similar results to a 32-bit app, within some tolerance.

Thank you, this is the case.

#4959390 FPU mode

Posted by Laval B on 15 July 2012 - 06:05 PM

Hello everyone.

I need to to make sure that the fpu mode, mostly the rounding mode and the floating point pricision, are set correctly. With Microsoft's compiler i can use the intrinsic _controlfp which is very handy.

With gcc though, i didn't find such an intrinsic. The only way i found was using inline assembler. Is there such an intrinsic for gcc ? I know with Microsoft compiler you can't use inline assembler, is that also true for gcc.

#4946144 Visual Studio .. multiple projects in solution

Posted by Laval B on 04 June 2012 - 09:57 AM

Laval B, you have solved it for me. I was right-clicking over project and selecting 'Dependencies' and 'Build Order', which was misleading me. But the solution properties section you pointed me to allowed me to tick 'Build' for all projects in the configuration node.

Yeah, i've been there too ;) Don't forget, like incertia above said that you need to setup your libraries and includes paths just like you would if you weren't compiling them with your project.

#4945853 Visual Studio .. multiple projects in solution

Posted by Laval B on 03 June 2012 - 11:32 AM

Yes, ive looked at that, and it seems to automatically detect dependencies, but it just doesn't work.

What is it that doesn't work ? Right-click on the solution in the file view and chose properties in the menu, this will display solution's properties page. There is a combobox from which you can chose a project. Once you have done that, you just have to check the various projects you want to set as dependencies for the one you have chosen in the combo. That way, you can set the dependencies for each project in your solution.