Jump to content

  • Log In with Google      Sign In   
  • Create Account

Laval B

Member Since 30 Jul 2010
Offline Last Active Today, 06:17 AM

#5289064 Vulkan Resources

Posted by on 28 April 2016 - 04:05 AM

https://software.intel.com/en-us/articles/api-without-secrets-introduction-to-vulkan-preface

https://software.intel.com/en-us/api-without-secrets-introduction-to-vulkan-part-1

https://software.intel.com/en-us/api-without-secrets-introduction-to-vulkan-part-2

https://software.intel.com/en-us/api-without-secrets-introduction-to-vulkan-part-3

 

I found these tutorials, they are nice to start with Vulkan. There is a pdf version with detailed explanations and sample code.




#5248057 Terrain LOD

Posted by on 21 August 2015 - 09:05 AM

I have made one or two posts on the subject on this forum a few years ago, I'll see if I can dig them out

 

Thank you, i am very interested by the approach.

 

 

Culling is done via the quad-tree.

With proper memory management, you can jump directly to adjacent cells, as well as up and down LOD levels.
When beginning the search through the quad-tree, perform a standard parent-child iteration over the tree, but select child nodes in order of closest-to-camera first.
This allows you to find the chunk closest to the camera and its appropriate LOD level.

From here, change your search method so that it branches out and away from that chunk, and for each node you pass a minimum and maximum search depth. For each neighboring node, you may only go up or down one level in the tree.

As for proper memory management, this method becomes possible if you lay out all nodes sequentially in RAM and hold an array of pointers to the start of each level. To go from Node [X, Y] to its parent, simply go up one level (use the array of pointers to the starts of each level) and index into that array of nodes [X>>1, Y>>1]. Nodes on a level will be organized like a bitmap, so you can also easily go left, right, up, and down from any given node on the same level, allowing to traverse from any node directly to any other node.

You would organize your quad-tree this way for best cache usage anyway.


L. Spiro

 

 

Thank you very much for the detailed explanation.




#5247403 Terrain LOD

Posted by on 18 August 2015 - 09:50 AM

If you're using DirectX 11-grade graphics cards, doing the LOD tessellation in the Hull/Domain shader stages is fairly neat, and avoids some of the difficulties of having to patch up T-junctions between LOD levels.  I've played around with it both this way, and more the way you are describing:

Not the greatest screenshot, but this is from my hardware-tessellated version.  I'm sure that I'm not doing things in the most optimal way, but on the hardware I was using(GTX560), the hardware-tessellated version was considerably faster.

 

 

Yes, hardware tessellation is something i need to investigate more. I have toyed a bit with a terrain tessellation demo that was published in GPU Pro 4 and it looked very neat indeed. The performace were very good on my development machine (GTX 780 Ti x2). When i tried it on a smaller card (Quadro 600) which has DX11 feature level but much less cores, it was running fine but very close to the minimum frame time with only the terrain.

 

I'm thinking tessellation might be good for smaller tasks like morphing in character animation when the character is close to the camera. 

 

Tessellation is indeed interesting for very dynamic surfaces like character's faces and water simulation. Like i told you, i need to get a good grip of it and the associated cost.

 

I may also have to support DX10 level hardware so i will need a falback.

 

Tank you for your post, i will read your references when i get back home.




#5247348 Terrain LOD

Posted by on 18 August 2015 - 04:01 AM

Yeah... some of these ideas are not very good. You only load the terrain once, and that's at level initialization time. 

 

The terrain can be very large and will not necessarily be entirely loaded at once. With a structure like this, the index buffers of the leaves can be reused because chunks are loaded in leaves.

 

The same applies to vertex normals. There's no reason why you can't just get this info at load time and store it in a custom vertex object for each terrain vertex. In fact, if you're going to be creating a height map texture for your terrain, you can also create a normal map texture for your terrain.

 

With modern hardware, which is the target platform, it is faster to do a bit more calculations then to transfer larger amount of data. This is especially true when loading out of core data in the background.

 

 

You're making 3D terrain. You don't use quad trees for 3D environments, you use octrees.

 

The quadtree is the data structure used for culling and lod selection. Each node will contain the maximum and minimum height of the terrain for the area covered by the node. 




#5199766 Codebase with multiple back-ends

Posted by 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.




#5112774 Qt and OpenGL

Posted by on 28 November 2013 - 09:33 AM


You are rendering in the update thread. At least when using QtQuick the thread that is doing all the rendering (and is the only one allowed to) is always a different thread from the normal update thread.

 

The only place i'm calling opengl functions are in initializeGL, paintGL and resizeGL as recomended in the documentation.

 

 

 


You are polluting the GL state. At least QtQuick is a bit picky about anyone changing the GL state. Make sure any buffers bound (especially vertex and index buffer) are restored to their orginal value when you are done rendering. Also, the cull mode (whether or not it is enabled and the cull face) need to be preserved. Saving these states allowed me to integrate the rather monolithic renderer I have to work with with Qt.

 

I'm not sure when i need to save and restore these states. Everything is flickering when i'm resizing something, even the scrollbars of the docking windows. The problem is related to the OpenGL Widget though since it doesn't happen if i replace it with a standard widget like QTextEditor.




#5112744 Qt and OpenGL

Posted by on 28 November 2013 - 08:11 AM

Have you tried using qglClearColor? Or calling glClearColor before clearing? Qt probably calls glClearColor by itself before going in the paintGL method.

 

qglClearColor doesn't change anything. According to the documentation the only functions that are called by the framework are makeCurrent and swapBuffers. I have also tried calling makeCurrent in renderGL, initializeGL and resizeGL to make sure the right context was used and it didn't change anything. According to the documentation, you only need to call makeCurrent if you call gl functions outside of those functions (the overriden ones).

 

 

Check exactly which Qt version you have downloaded. The 5.x generation of Qt is so far available in two versions: one using real OpenGL and one using OpenGL ES via a DirectX emulator. If you are using the emulated OpenGL you need to make sure all your OpenGL is including the emulator headers (somewhere in Qt 3rdparty folder) and you cannot just link to the usual OpenGL libraries.

 

I'm using Qt 5.1.1 for Windows 64 bits VS2012. There is a version of Qt 5.1.1 for Windows 64 bits VS2012 OpenGL which is not the one i'm using. Is that what you are referring to ?

 

An emulated framework limited to OpenGL ES is definitely not what i need. The engine uses core profile 3.3 and above. 




#5102175 Behavior of assignment with user data in Lua

Posted by on 17 October 2013 - 10:56 AM

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




#5101561 lightuser data in Lua

Posted by on 15 October 2013 - 09:38 AM

 


Is there a way to do this with lightuser data ?
Pretty sure, no. I ended up using the syntax that apatriarca suggests. Here's another example of the same syntax being used due to the choice to use light userdata:

http://bitsquid.blogspot.com.au/2011/06/lightweight-lua-bindings.html

 

 

Thank you, i was pretty sure it wasn't possible, i asked just in case. The method suggested by apatriarca is what we are using, the functions are exposed via a call to luaL_newlib and lua_setglobal so they appear in a "namespace" or library.




#5101522 lightuser data in Lua

Posted by 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.")

end

instead of 

function f(user, logger)

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

   logger:output("User is set.")

end

Is there a way to do this with lightuser data ?




#5075319 Uniform blocks and Uniform buffer objects

Posted by 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 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 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))
        {
            do
            {
                CString str(pe32.szExeFile);

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

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

 

 

Hope this helps.




#5033815 C/C++ JSON library

Posted by 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 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.




PARTNERS