We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › objLoader 014 : now with VBO!
Pages: 1 2 3 
objLoader 014 : now with VBO! (Read 5012 times)
Re: objLoader 014 : now with VBO!
Reply #30 - Sep 11th, 2008, 12:26pm
 
i assume by elements you mean groups, which is something both loaders do not support.
i wrote one that does it but it was a quick hack. you can try it. and then just load all your textures manually and for each object (group) bind the correct texture.

warning. i dont support VBO. it just renders plain straight, but you can see that in the draw() call it goes thru all the meshes and draws them all

you could copy that draw call and for each object just bind its texture.
Re: objLoader 014 : now with VBO!
Reply #31 - Sep 11th, 2008, 1:01pm
 
yes, groups..
i think i will try your code a little bit, but i need the vbo thing as my scenery is pretty complex.. and i'm thirsty for framerate Smiley i might see how you take care of the texturing and grouping etc. and try to do it myself then.
Re: objLoader 014 : now with VBO!
Reply #32 - Sep 11th, 2008, 3:06pm
 
I'm getting a little confused with this thread. To answer the questions since my last post

starfeuri :
The jar file should be installed in a folder called library in a folder with the same name as the jar and this should be placed under the libraries folder in processing (like any other processing library). OR you could put the jar in folder called code under your sketch. This is a good habit to get into BTW.

blue_veek :
The V axis has always been flipped in processing. Processing uses top left as 0,0 instead of the bottom left as 3D editing software does. I flip the UV's in the loader to make them look right. I just ran a check with version 014 on processing 148 and they look ok in the SAITO loader. Also if you are looking for several materials in the one obj file then this is also supported in our loader.

In an obj file you'll see a line that starts with "usemt" and ends with the name of an entry in the mtl file. This line tells the loader that all the faces that follow will use this material. If there are many entries in the mtl then the obj should be pointing to the correct one.

I hope this clears up some confusion. One day we will live in a world of ample free time and up to date documentation.  

To any of my students reading, extra credit to who ever volunteers to finish documenting the obj loader for me Wink
Re: objLoader 014 : now with VBO!
Reply #33 - Sep 11th, 2008, 3:32pm
 
polymonkey, your objloader works great, i wasn't talking about it.. i was just a little confused about sgsrules's loader (which i use because is a little/lot faster).. and really, in 148 textures were flipped! and in 135 not Smiley thank you for the additional info anyway Smiley
Re: objLoader 014 : now with VBO!
Reply #34 - Sep 16th, 2008, 5:27pm
 
PolyMonkey:

Thank you for your reply.  I will try putting it in a codes folder.  When I put it in libraries, it couldn't be found for some reason.

Now:

I am creating a Fish Anatomy Viewing System with processing.  So, I am using an obj loader (either PolyMonkey's or sgsrules's -- right now I am using sgsrule's because I couldn't get polymonkey's to work) to display the models of the fish and the anatomical/biological systems.  And I am creating a UI to view the different systems and information etc.

I use texture(PImage tex) to textre the quads that make the UI.  This messes with the texture binding on the model.  I don't know why.  If I comment out texture() (and the UV coords on the vertices making the quad shape), the texture on the obj file appears again.

I'm supposing it has something to do with ordering?  I don't know.

I am going to try to use PolyMonkey's loader now, since it takes mtl files and may not have this problem.

Does anyone have any ideas?  Is there a way to disable texture() and re-enable it so I can make sure it is only operating on the desired quad?
Re: objLoader 014 : now with VBO!
Reply #35 - Sep 16th, 2008, 7:03pm
 
I don't know what my problem is.

I have in my sketch folder

codes\saito\objloader\ (all the java files)

and when I

import saito.objloader.*;

it says the package saito does not exist.

I also put the saito folder in the processing libraries directory.

-_-  Nub Face.  Fail.
Re: objLoader 014 : now with VBO!
Reply #36 - Sep 16th, 2008, 11:43pm
 
If you are using the code folder option it should look like this.

Code:

my_sketch <- sketch folder
|- my_sketch.pde <- pde file
|- code <- code folder
|- objloader.jar <- the jar file

This structure is automatic if you drop a jar file onto the sketch.

As for the texture problem. This cropped up a while ago and I thought I resolved it in the latest 014 version of the loader. But the issue involves the textureMode() function. (read about it here http://processing.org/reference/textureMode_.html )

In all 3D software, UV co-ordinates are normalized (between 0 and 1). This is how the UV's are stored in the obj file. The objloader sets the textureMode to NORMALIZED before it draws the mesh and sets it back to IMAGE at the end of the draw. So you should make sure you set the textureMode you are using before drawing anything with texture.

Thinking about it now. I don't think what I've done is the best idea. I should be getting and storing the current texureMode and then setting it back to whatever it was when I'm done with it. I'll add that to the list.
Re: objLoader 014 : now with VBO!
Reply #37 - Sep 16th, 2008, 11:50pm
 
Maybe it's because I am on a mac that putting the .jar file there does not work?

Also, I don't know if I am having the same trouble with your loader, as I can't get it to work :\

But sgsrule's is having this texture conflict.
Re: objLoader 014 : now with VBO!
Reply #38 - Sep 17th, 2008, 12:00am
 
Never mind. I fixed it.  (the fact that I can't use your loader)

Now I can try yours and see if my materials work right.

happy face.
Re: objLoader 014 : now with VBO!
Reply #39 - Sep 17th, 2008, 2:05am
 
Let me know how it goes. I work on a mac, it's fantastic. Smiley

MattD
Re: objLoader 014 : now with VBO!
Reply #40 - Sep 18th, 2008, 2:47pm
 
I have gotten polymonkey's obj loader to work.  It's nice.  Smiley

I had already started doing a lot of work using sgsrule's though, so I guess I will stick with it for now.  People think that it runs faster, which may be important for me, as I will have more than one model.

I'd really like to write my own obj loader when I'm finished with the project.  It's a matter of integrity more than anything else.  I feel like I am stealing (I'm crediting both of you of course, but...)

I'm really not a programmer though.  I'm an artist with an engineering degree and a lot of luck.  Tongue
Pages: 1 2 3