Manual Object; Ogre::InvalidParametersException

Problems building or running the engine, queries about how to use features etc.
Post Reply
drewpotter
Gnoblar
Posts: 6
Joined: Fri Aug 29, 2014 8:24 pm

Manual Object; Ogre::InvalidParametersException

Post by drewpotter »

Hello,

I am trying to made a dynamic manual object to render a water surface.

For some reason I am getting a crash when I run my code:

Code: Select all

manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
manual->end();
and

Code: Select all

manual->beginUpdate(0);
manual->end();
The beginUpdate function is crashing the program, it does not matter if I call it with beginUpdate(1) or beginUpdate(0)

Any help would be greatly appreciated.

Drew
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Manual Object; Ogre::InvalidParametersException

Post by spacegaier »

Can you see which exception exactly is triggered? There are at least two versions in beginUpdate():

Code: Select all

if (mCurrentSection)
{
	OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
		"You cannot call begin() again until after you call end()",
		"ManualObject::beginUpdate");
}
if (sectionIndex >= mSectionList.size())
{
	OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
		"Invalid section index - out of range.",
		"ManualObject::beginUpdate");
}
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
drewpotter
Gnoblar
Posts: 6
Joined: Fri Aug 29, 2014 8:24 pm

Re: Manual Object; Ogre::InvalidParametersException

Post by drewpotter »

Thanks for the speedy reply, I get the following error:
OGRE EXCEPTION(2:InvalidParametersException): Invalid section index - out of range. in ManualObject::beginUpdate
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Manual Object; Ogre::InvalidParametersException

Post by tod »

I think beginUpdate() works on an existing manual object. Did you put anything between begin and end the first time?
drewpotter
Gnoblar
Posts: 6
Joined: Fri Aug 29, 2014 8:24 pm

Re: Manual Object; Ogre::InvalidParametersException

Post by drewpotter »

Yes, I had the following in between:

Code: Select all

	// specify the material (by name) and rendering type
	manual->begin("BaseWhiteNoLighting", RenderOperation::OT_LINE_LIST);
	
	long i, j;
	
	for( i=0 ; i<N-1; i++ )
	{
		//glBegin( GL_TRIANGLE_STRIP );
		//{
			for( j=0 ; j<N; j++ )
			{
				//glArrayElement( Tri[i][j][0] );
				//glArrayElement( Tri[i][j][1] );
				manual->colour(0.5,0.7,0.8);
			  	manual->position(i*h - L/2, Tri[i][j][0]+10, j*h - L/2);
			  	manual->position(i*h - L/2, Tri[i][j][1]-10, j*h - L/2);
			
			}
		//}
		//glEnd();
	}
		
	// tell Ogre, your definition has finished
	manual->end();
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Manual Object; Ogre::InvalidParametersException

Post by tod »

And N is???? 1?
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Manual Object; Ogre::InvalidParametersException

Post by tod »

For each vertex, call position(), normal(), textureCoord(), colour() to define your vertex data. Note that each time you call position() you start a new vertex. Note that the first vertex defines the components of the vertex - you can't add more after that. For example if you didn't call normal() in the first vertex, you cannot call it in any others. You ought to call the same combination of methods per vertex.
From here

Basically you call position first, then add other data to it, like color, then take care to do the same for all other vertices.
drewpotter
Gnoblar
Posts: 6
Joined: Fri Aug 29, 2014 8:24 pm

Re: Manual Object; Ogre::InvalidParametersException

Post by drewpotter »

Thanks.

N= 128+1

It is for a water surface. I have looked at the water example included with OGRE and they appear to use Vertex Buffers instead so I think I will have to do that.

Regards.
Post Reply