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 5010 times)
objLoader 014 : now with VBO!
Jul 12th, 2008, 10:26am
 
I'm happy to announce the first pass of release 014 of the objloader. The major feature in this release is the addition of a fast draw mode in opengl. It uses vertex buffer objects to speed everything up quite a bit. (and yes it's about time)

You can find the first pass release here http://code.google.com/p/saitoobjloader/source/browse/trunk/OBJ_Loader/library_014_beta/

I'll be updating the google code site in the next few days to reflect the new updates. But to begin, here is how to use the new functions.

Quote:

import saito.objloader.*;
import processing.opengl.*;

OBJModel model;

void setup()
{
 size(600, 600, OPENGL);

 model = new OBJModel(this, "my_wacky_filename.obj");

 model.drawMode(TRIANGLES);

 model.setupOPENGL();

 noStroke();
}

void draw()
{
 background(32);
 lights();

 model.drawOPENGL();  

}


Please go forth and break it. No doubt I've missed something. If so please drop me a line and I'll get it sorted.

Also I really want to express my thanks to JohnG, ac, the nehe tutorials and Dan from work. I wouldn't have been able to get this done without the amazing work that they have already done. I am in your debt.

MattD
Re: objLoader 014 : now with VBO!
Reply #1 - Jul 12th, 2008, 10:34am
 
014 Beta is now up in the download section. (because navigating the trunk kinda sucks).

http://code.google.com/p/saitoobjloader/downloads/list

mattD
Re: objLoader 014 : now with VBO!
Reply #2 - Jul 16th, 2008, 10:39pm
 
lots of errors
with this file
http://mj.pruts.nl/objloader/hop.obj

errors->
http://mj.pruts.nl/objloader/objerrors.rtf


..



oh and i'm kinda new to proceesing Smiley
Re: objLoader 014 : now with VBO!
Reply #3 - Jul 17th, 2008, 1:22am
 
Ahh the obj file has no normals. Bugger. My computer went on the fritz last night so I won't be able to get to this till friday night (my time). In the mean time you could try exporting with normals and see if that sorts it out
Re: objLoader 014 : now with VBO!
Reply #4 - Jul 17th, 2008, 4:14pm
 
ah...

i'm exporting from cinema4d but there is no options for extra normals
so i first imported it in wings3d and the exported it to obj again
then there are no errors but it gives me this result
http://mj.pruts.nl/objloader/hopobload.png
but it should be this
http://mj.pruts.nl/objloader/hopc4d.png

here is wingsconverted obj
http://mj.pruts.nl/objloader/hopwings.obj

maybe just add normal calculation in your library... Wink
Re: objLoader 014 : now with VBO!
Reply #5 - Jul 17th, 2008, 5:49pm
 
Did you change model.drawMode(TRIANGLES);  to model.drawMode(QUADS); ?
Re: objLoader 014 : now with VBO!
Reply #6 - Jul 18th, 2008, 1:17am
 
Yep. Changing the drawMode should fix that right up.
Re: objLoader 014 : now with VBO!
Reply #7 - Jul 24th, 2008, 2:39am
 
Nice work. I think I'll be stealing that lighting code. Wink
Re: objLoader 014 : now with VBO!
Reply #8 - Jul 25th, 2008, 11:23pm
 
Do either of these libraries support transparencies?
Re: objLoader 014 : now with VBO!
Reply #9 - Jul 25th, 2008, 11:39pm
 
The short answer is yes.  

long answer: an obj loader only loads geometry, texture data and normals. if you want to use "transparencies" you have to bind a texture with an alpha channel and turn on alpha blending.  if you want to try this out download my loader with the sample file, replace the .png file in the data directory with a file that contains an alpha channel. Then add the following lines of code to the draw() function

gl.glEnable( GL.GL_BLEND );
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA);

if you want the whole thing to be transparent, you don't have to replace the texture, just add the above code and change the color's alpha:

gl.glcolor4f(1,1,1,.3f);
Re: objLoader 014 : now with VBO!
Reply #10 - Jul 25th, 2008, 11:44pm
 
Short question: Will this work when the OBJ texture is using multiple image files?
Re: objLoader 014 : now with VBO!
Reply #11 - Jul 26th, 2008, 12:24am
 
Unless you're wanting to use bump maps, normal maps and other shader related stuff I'm not really sure how or even why you'de want to do that. i generally place my textures in whatever modeling program i'm using,  if i alter the texture or use multiple textures i save it as one texture. After i export the .obj it exports all the uv texture coordinates.  then i bind my .png to my .obj in processing and that's all i have to do, no multiple files needed.
Re: objLoader 014 : now with VBO!
Reply #12 - Jul 26th, 2008, 12:35am
 
As far as I know, the OBJ format itself only supports single-texturing.
Re: objLoader 014 : now with VBO!
Reply #13 - Jul 26th, 2008, 2:02am
 
I've exported OBJs with multiple textures and loaded into processing.
Re: objLoader 014 : now with VBO!
Reply #14 - Jul 26th, 2008, 2:54am
 
The Obj model is divided up into a series of model segments. Each model segment can reference it's own material information. The material information is stored in the .mtl file and can be thought of as a typical Phong material where various material properties are set and one texture is specified for the diffuse channel.

In the processing native draw mode the whole thing ends up a lot like this example

http://www.processing.org/reference/texture_.html

So I guess my point is if you are asking if a model can have multipal textures then yes. But you can only have one texture per polygon.

MattD
Pages: 1 2 3