Posted September 19, 20187 yr I'm trying to render a .obj model onto the screen, I've already gotten it to load. How do I do the rendering portion? The official YouTuber Spaceboy Ross
September 19, 20187 yr Depends on how you got it to load. If it is a block/item model then you can use RenderItem#renderItemAndEffectIntoGUI. If it is a custom model with a custom loader it is up to you to upload each and every vertex to the BufferBuilder. It also depends on where you want to do that from. If it is your own GUI then there are no problems. However if you just want it rendered somewhere on the screen at all time you will need to use an event. RenderGameOverlayEvent will do fine.
September 19, 20187 yr Author It's a custom model with the OBJLoader. And I don't know how to upload every vertex to the BufferBuilder, could you please show an example? The official YouTuber Spaceboy Ross
September 19, 20187 yr As far as I know OBJLoader is a custom model loader provided by forge designed to create block/item models from a wavefront file. If you are using OBJLoader then you must render your thing as an item. You could in theory bake the IModel you get from the loader yourself and later render it similar to how RenerItem#renderItemModelIntoGUI does it. That would be your example. But you would need to use ModelBakeEvent to bake your model first. And then you would need to fully mimic the code of RenerItem#renderItemModelIntoGUI(which expects an ItemStack btw so you would need to fix that too). It might be easier to use either a custom dummy item(don't show it in the creative menu and it will be completely hidden in the game) or a custom model loader, wavefront isn't too complicated - for example here is mine simple .obj loader and vertex uploader.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.