small ofx3DUtils improvements

Is this where we should post addon bugfixes?

anyway, I’ve been using the ofx3DUtils addon and it has been very useful.

A few requests…

A version of ofLine() in 3 dimensions would be nice…either in the core or in the addon…
This is useful for debugging stuff in 3d and drawing axes etc.

A lerpEye function would be useful to…I found I was lerping the position but also the viewpoint as well…

I also initially found the term Eye a little confusing…being familiar with gluLookAt()…as here the position is the gluLookAt “eye”, and the eye is the gluLookAt “center”. Maybe you could name this more along glu lines, or maybe give it another name to avoid confusion…or not! :slight_smile:

I found the ofxCamera::place function used
glScalef(1, -1, 1);
glTranslatef(0, -h, 0);
to keep in line with the OF coordinate system. While I understand the reasons for this, having to add an offset to all my vector calculations was annoying and confusing…also having the y axis inverted was really counter intuitive. So I did this:

camera.place();

/* undo the OF camera translations */
glTranslatef(0, AppHeight, 0);
glScalef(1, -1, 1);

Maybe it would be nice to wrap this in an overloaded version of the ofxCamera::place() functions…or make place(OF_ORIGIN) and place(ZERO_ORIGIN) functions.

The nearClip plane is very different in 2D OF compared with 3D addon…but I guess this is not so important. I had a problem where my geometry was drawing over my 2D graphics when very close to the camera, but I solved this by switching depth testing on and off at the right places.

All for now!
thanks

Found a request for ofxLight as well:

Setting the global ambient level, i.e. wrapping this stuff.

float global_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient);

Also the default global ambient light intensity is R=0.2, G=0.2, B=0.2, Alpha=1.0.

really great request. especially an option to place the camera of_style or opengl_style would be great!

Hi,

i only noticed this post a couple days ago, and it dates from may… :stuck_out_tongue:

i dont understand your alternatives to the ofxCamera::place function.
do you recomend using a more opengl.ish aproach to coordinates? i.e having 0,0,0 at the center of the screen ?

there is an ofxLine for 3d lines. :slight_smile:

cheers

Rui

ah ok, didn’t see the ofxLine…

Yes, my request is to have 0,0 in the centre of the screen…or at least the option. I do this in all my 3D code now, it’s much less of a headache.

[quote author=“grimus”]Is this where we should post addon bugfixes?

A few requests…

A version of ofLine() in 3 dimensions would be nice…either in the core or in the addon…
This is useful for debugging stuff in 3d and drawing axes etc.

A lerpEye function would be useful to…I found I was lerping the position but also the viewpoint as well…

[/quote]

Nice suggestion It would be great if they would consider these. What’s the update on this ?

I don’t think the changes have been updated…however here’s the lerpEye() function by the way, super simple:

  
void ofxCamera::lerpEye(float _targetX, float _targetY, float _targetZ, float _step){  
	eyeCoord.x += (_targetX - eyeCoord.x) * _step;  
	eyeCoord.y += (_targetY - eyeCoord.y) * _step;  
	eyeCoord.z += (_targetZ - eyeCoord.z) * _step;  
}  
  
void ofxCamera::lerpEye(ofxVec3f target, float step){  
	lerpEye(target.x, target.y, target.z, step);  
}  

I’ve got a new camera class that’s not quite finished based on this one:
http://www.dhpoware.com/demos/glCamera3.htm
It’s working but it’s not quite backwards compatible with the ofxCamera yet, plus I would like to give it the same functions as ofxEasyCam because it uses quaternions so doesn’t suffer from gimbal lock :slight_smile: It also has optional velocity and acceleration.

Thank your for mentioning the lerpEye() function. This really helps.

Just found this addon today and run the example code, have to say is a very cool addon, it will be nice to have the VertexArray option to draw the primitives and also make it more compatible with the iOS environment

Thanks a lot

  • rS

Just curious, what is not compatible with the IOS environment at the moment?

Most of the problems are with the primitive drawing methods in ofx3DGraphics which are not compatible with OpenGL ES, the camera and light classes needs minor tweaks.

There is some commented code in the ofx3DGraphics class at the bottom with OpenGL ES compatible code but I am not an expert so I rather leave that alone for the moment :wink:

Cheers

  • rS