Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualD.V.D

Posted 12 March 2013 - 10:42 AM

Well I encountered a similar problem like this before when I was making a physics simulator for collisions in 2 space and the way I solved it was by putting the class that didn't work into the same header that was using it, in this case id put mesh class into the main function but that makes the code clunky and unorganized.

 

I don't think its actually the default constructor but Ill give it a test. The reason for that is because the Create Mesh function gets called and creates the mesh after the default constructor was called so it should override it. The value does get assigned because the model variable does get the proper values of VBO being equal to 1 and having the vertices equal to the actual number of vertices not 0.

 

I could post the whole program but I did a lot of changing with the GLUT interface. It now all runs in a Application class which also has a list of all the models in my application. I then add a new model and all models get rendered in a for loop in the RenderScene function. The variables all still get called the way they did previously so the emsh stuff still runs the same, just under a more dynamic interface.

 

EDIT: After setting the values of create mesh, the mesh being rendered does indeed get the changed values generated by create mesh which are the ones I want. But once render function gets called it all gets set to 0 and Im really lost as to why because the only thing happening is that another function is being called in another header but that function doesn't actually change any of those values, they just become modified O.o


Btw I did change the BufferData to &vertices[0].pos.x but what difference does it make if it has the .pos.x or if it doesn't? Won't it work properly either way?


#2D.V.D

Posted 12 March 2013 - 10:39 AM

Well I encountered a similar problem like this before when I was making a physics simulator for collisions in 2 space and the way I solved it was by putting the class that didn't work into the same header that was using it, in this case id put mesh class into the main function but that makes the code clunky and unorganized.

 

I don't think its actually the default constructor but Ill give it a test. The reason for that is because the Create Mesh function gets called and creates the mesh after the default constructor was called so it should override it. The value does get assigned because the model variable does get the proper values of VBO being equal to 1 and having the vertices equal to the actual number of vertices not 0.

 

I could post the whole program but I did a lot of changing with the GLUT interface. It now all runs in a Application class which also has a list of all the models in my application. I then add a new model and all models get rendered in a for loop in the RenderScene function. The variables all still get called the way they did previously so the emsh stuff still runs the same, just under a more dynamic interface.

 

EDIT: After setting the values of create mesh, the mesh being rendered does indeed get the changed values generated by create mesh which are the ones I want. But once render function gets called it all gets set to 0 and Im really lost as to why because the only thing happening is that another function is being called in another header but that function doesn't actually change any of those values, they just become modified O.o


#1D.V.D

Posted 12 March 2013 - 10:34 AM

Well I encountered a similar problem like this before when I was making a physics simulator for collisions in 2 space and the way I solved it was by putting the class that didn't work into the same header that was using it, in this case id put mesh class into the main function but that makes the code clunky and unorganized.

 

I don't think its actually the default constructor but Ill give it a test. The reason for that is because the Create Mesh function gets called and creates the mesh after the default constructor was called so it should override it. The value does get assigned because the model variable does get the proper values of VBO being equal to 1 and having the vertices equal to the actual number of vertices not 0.

 

I could post the whole program but I did a lot of changing with the GLUT interface. It now all runs in a Application class which also has a list of all the models in my application. I then add a new model and all models get rendered in a for loop in the RenderScene function. The variables all still get called the way they did previously so the emsh stuff still runs the same, just under a more dynamic interface.


PARTNERS