glRotate/Translate within glBegin/End

This is something I tried to do recently, and when I discovered it was not possible, I couldn’t think why.

Being able to modify the modelview(?) matrix in between glVertex() calls wouldn’t be dificult to add, would it?

possibly. <mutters about pipeline stalls waiting for the transform engine to wind up in the middle of a vertex stream>

besides, I can’t think of why you’d want to suddenly put transform calls in your stream, or why not having them is an issue (because, it isn’t)

cheers,
John

OK - imagine you have a ribbon that you want to render (as a quad strip) like it was being twisted. Currently you have to figure out the vertex positions before you call glVertex3f, using custom, awkward routines.

If this feature was implemented, you could just rotate around the axis you were twising it around before you call glVertex each time.

I implemented my own routines just now, which work great. But it just seemed strange at first why I couldn’t do it using OpenGL only.

y-e-s… okay… what’s wrong with doing custom routines?

the transform matrix is there primarily (I think, or, at least, would argue) so you can specify geometry with a local coordinate system but move it around. hmm. that isn’t a very convincing argument, but then, neither is not wanting to implement your own custom geometry engine to figure out what you want to do.

on one hand, I conceed that it mihgt be useful to use the geometry engine sitting on the graphics chip, but on the other hand, you’re interupting a vertex stream to send down a matrix and change the opengl state. <thinks> 'cause it is entirely possible that the … oh, never mind

cheers,
John

Perhaps a vertex shader could remedy the situation?

State changes simply are not allowed inside a Begin/End, and will never be allowed inside a Begin/End. OpenGL broke this rule by allowing Material to be changed inside a Begin/End, and it was a disastrous API mistake.

  • Matt