Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Hello,

Here is some screenshot of UltimateOpenGL loading 3D model:

https://i.imgur.com/BxMIgiL.png

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 !
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bot library for discord, bombs example adapted.
Next Topic: BEMRosetta
Goto Forum:
  


Current Time: Tue Jun 17 06:59:49 CEST 2025

Total time taken to generate the page: 0.04131 seconds