Home » Extra libraries, Code snippets, applications etc. » Applications created with U++ » UltimateOpenGL [BETA] 3D engine (A 3D engine to make game)
Re: UltimateOpenGL [BETA] 3D engine [message #52815 is a reply to message #52752] |
Tue, 03 December 2019 23:42   |
 |
Xemuth
Messages: 387 Registered: August 2018 Location: France
|
Senior Member |
|
|
Hello,
Here is some screenshot of UltimateOpenGL loading 3D model:

You can also find a gif of the model rotating here : https://i.imgur.com/QYLhb2J.mp4
(The framerate of the gif is not the same as reality)
How to do it :
//***All basic code to set Up glwf is coming before see my exemple or Readme of my GITHUB**///
context.AddTexture("sand",TransformFilePath("/Textures/sand.jpg")); //Load sand texture
Scene& myScene = context.AddScene("main");
myScene.AddCamera("main");
myScene.SetBackGroundColor(context.TransformRGBToFloatColor(40,180,200));
Mesh m; //Use to simulate the flat floot under the model
m.GetVertices().Add().SetPosition(glm::vec3(-20.0f, 0.0f, -20.0f)).SetTexCoords(glm::vec2(0.0f, 20.0f));
m.GetVertices().Add().SetPosition(glm::vec3(20.0f, 0.0f, -20.0f)).SetTexCoords(glm::vec2(20.0f, 20.0f));
m.GetVertices().Add().SetPosition(glm::vec3(20.0f, 0.0f, 20.0f)).SetTexCoords(glm::vec2(20.0f, 0.0f));
m.GetVertices().Add().SetPosition(glm::vec3(20.0f, 0.0f, 20.0f)).SetTexCoords(glm::vec2(20.0f, 0.0f));
m.GetVertices().Add().SetPosition(glm::vec3(-20.0f, 0.0f, 20.0f)).SetTexCoords(glm::vec2(0.0f, 0.0));
m.GetVertices().Add().SetPosition(glm::vec3(-20.0f, -0.0f, -20.0f)).SetTexCoords(glm::vec2(0.0f, 20.0f));
Object3D& floor = myScene.CreateGameObject<Object3D>("floor",m); //Lets create floor
floor.BindTexture("sand");
Object3D& modele = myScene.CreateGameObject<Object3D>("modele");
modele.LoadModel("C:\\Upp\\myapps\\ExempleUltimateOpenGL_V3\\obj upp\\upp.obj"); //Loading of model
modele.GetTransform().SetNewPosition(glm::vec3(0,4,0)); //Set new position
modele.GetTransform().ScaleNewValue(glm::vec3(0.05f,0.05f,0.05f)); //Scale the model
modele.SetOnDrawFunction([](GameObject& gm){ //Bind event on draw
double rotation = glm::cos(context.GetEllapsedTime())/100;
gm.GetTransform().RotateFromEulerAngles(context.GetDeltaTime() * 2,glm::vec3(0,1,0) );
});
myScene.Load();
while(!glfwWindowShouldClose(window)) {
processInput(window);
glfwSetWindowTitle(window, "UltimateOpenGL V3 - " +AsString(context.GetFPS()) +" FPS");
try{
context.Draw(); //Draw the context
}catch(UGLException& e){
LOG(e.what());
}
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
As you can see it's very simple !
Next step before digging the physic is to impletement animation and FBX support.
If you are interesting in 3D model of UPP Symbol, ask me !
|
|
|
 |
|
UltimateOpenGL [BETA] 3D engine
By: Xemuth on Mon, 18 November 2019 15:45
|
 |
|
Re: UltimateOpenGL [BETA] 3D motor
By: koldo on Mon, 18 November 2019 19:53
|
 |
|
Re: UltimateOpenGL [BETA] 3D Engine
By: Xemuth on Mon, 18 November 2019 20:06
|
 |
|
Re: UltimateOpenGL [BETA] 3D motor
By: Klugier on Mon, 18 November 2019 22:42
|
 |
|
Re: UltimateOpenGL [BETA] 3D motor
By: koldo on Tue, 19 November 2019 08:10
|
 |
|
Re: UltimateOpenGL [BETA] 3D motor
By: koldo on Tue, 19 November 2019 09:06
|
 |
|
Re: UltimateOpenGL [BETA] 3D Engine
By: Xemuth on Tue, 19 November 2019 21:44
|
 |
|
Re: UltimateOpenGL [BETA] 3D Engine
By: Xemuth on Tue, 19 November 2019 21:43
|
 |
|
Re: UltimateOpenGL [BETA] 3D Engine
By: Xemuth on Tue, 19 November 2019 21:32
|
 |
|
Re: UltimateOpenGL [BETA] 3D Engine
By: Xemuth on Fri, 22 November 2019 21:41
|
 |
|
Re: UltimateOpenGL [BETA] 3D engine
By: Xemuth on Mon, 02 December 2019 14:56
|
 |
|
Re: UltimateOpenGL [BETA] 3D engine
By: Xemuth on Tue, 03 December 2019 23:42
|
 |
|
Re: UltimateOpenGL [BETA] 3D engine
By: koldo on Thu, 02 January 2020 18:16
|
 |
|
Re: UltimateOpenGL [BETA] 3D engine
By: Xemuth on Thu, 02 January 2020 18:22
|
Goto Forum:
Current Time: Tue Jun 17 06:59:49 CEST 2025
Total time taken to generate the page: 0.04131 seconds
|