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 & HelpOther Libraries › MRI3DS and OpenGL state
Page Index Toggle Pages: 1
MRI3DS and OpenGL state (Read 1489 times)
MRI3DS and OpenGL state
Apr 23rd, 2010, 11:52pm
 
Hi all, i have gotten my .3ds model into my application using mri3ds.  However i notice that some OpenGL state is set by the mri3ds scene/scene render and all normal processing calls are affected by that.  For instance if you draw a simple filled rectangle then it renders way darker than it would if i comment out the render of the 3ds scene.  I guess somehow i can push&pop the opengl/processing state around the vscene.draw() call.  

I guess i could just make sure the lights in my 3ds scene are set to pure white as that would work best for me anyhow..however i have a feeling that one would like to keep all opengl state within a scene as local to that scene rather than it become "accidentally" global.

any thoughts?

Oh and some simple code like this shows the issue.

vscene.draw();
noLights();
fill(255,0,0);
rect(0,0,height/2,width);

Re: MRI3DS and OpenGL state
Reply #1 - Apr 24th, 2010, 9:31am
 
the only things the draw method does is set texture or color material.
after calling draw() try to disable color_material and see if that fixes your problem.

// disable color material
_gl.glDisable( GL.GL_COLOR_MATERIAL );
// disable texturing
_gl.glBindTexture( GL.GL_TEXTURE_2D, 0 );
_gl.glDisable( GL.GL_TEXTURE_2D );
Re: MRI3DS and OpenGL state
Reply #2 - Apr 25th, 2010, 5:39pm
 
Many thanks Victor that fixed it..it seems that either of these two calls fix the problem.
_gl.glBindTexture( GL.GL_TEXTURE_2D, 0 );
_gl.glDisable( GL.GL_TEXTURE_2D );

And this

_gl.glDisable( GL.GL_COLOR_MATERIAL );

doesn't make a difference in this case.

thanks

nik

Re: MRI3DS and OpenGL state
Reply #3 - Apr 25th, 2010, 5:59pm
 
ok the first two ones unbind the texture and disable texture mapping.
the second is for material colors.

next release i'll fix this within the draw methods
Page Index Toggle Pages: 1