Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ritwik_d_
Beginner
140 Views

rtcCommit not working

Below is the code that I am using, my code gets stuck at rtcCommit(). I am not sure why this is happening...any clue would be great help.

Thanks

geomID = rtcNewTriangleMesh(Scene, RTC_GEOMETRY_STATIC, nTriangles, embVertices.size(), 1);
    EmbVertex* vertices = (EmbVertex*) rtcMapBuffer(Scene, geomID, RTC_VERTEX_BUFFER);
    for(unsigned int i = 0; i < embVertices.size(); i++)
    {
        vertices.x = embVertices.x;
        vertices.y = embVertices.y;
        vertices.z = embVertices.z;
    }
    rtcUnmapBuffer(Scene, geomID, RTC_VERTEX_BUFFER);
    cout<<"\nCompleted mapping vertices.\n";

    EmbTriangle* triangles = (EmbTriangle*) rtcMapBuffer(Scene, geomID, RTC_INDEX_BUFFER);
    int t = 0;
    for(unsigned int i = 0; i < Triangles.size(); i++)
    {
        if(valid)
        {
            triangles.v0 = Triangles.v0;
            triangles.v1 = Triangles.v1;
            triangles.v2 = Triangles.v2;
            embTriangles.push_back(Triangles);
            t++;
        }
    }
    rtcUnmapBuffer(Scene, geomID, RTC_INDEX_BUFFER);
    cout<<"\nCompleted mapping triangles.\n";
    rtcCommit(Scene);

0 Kudos
8 Replies
ritwik_d_
Beginner
140 Views

This is the message I get from Embree:

Embree Ray Tracing Kernels 2.3 (Jun 11 2014)
  Compiler : Visual C++ Compiler 17.00.6103.0
  Platform : Windows (32bit)
  CPU      : SSE SSE2 SSE3 SSSE3 SSE41 SSE42 POPCNT AVX F16C RDRAND AVX2 FMA3 LZ
CNT BMI1 BMI2
  Features : intersection_filter bufferstride
  WARNING: enabled 'intersection filter' support will reduce hybrid traversal pe
rformance
Embree: Unknown error, (cannot create thread)

I do not understand why it cannot create the threads

SvenW_Intel
Moderator
140 Views

Do the tutorials run? e.g. ./tutorial00 -rtcore verbose=2

 

ritwik_d_
Beginner
140 Views

yes tutorials are running fine.

SvenW_Intel
Moderator
140 Views

Sorry but I have no idea why the CreateThreads function fails. Look at the CreateThreads call in file embree/common/sys/thread.cpp, maybe you can find the problem there. Also, try to figure out what you do different than the tutorials. 

ritwik_d_
Beginner
140 Views

What is a good place to do rtcInit()?

Is it possible to do this inside a constructor of a class and then call rtcExit() inside the destructor?

SvenW_Intel
Moderator
140 Views

You can call rtcInit and rtcExit in a constructor and destructor of a class. However, you should not call rtcInit from the constructor of a global variable, thus please create the class either with new or on the stack.

ritwik_d_
Beginner
140 Views

I am actually creating the class object with new but this is a global variable, the reason for that is I am using OpenGL to display the scene geometry and so the callback functions can access the class object. What is the reason for rtcInit() to not work on global variables?

Ondra_K_
Beginner
140 Views

Because that way the rcInit could be called before initialization of global variables inside embree library

Reply