Is there a command that I can use that tells the OpenGL to stop applying rotations?

In my current program which I nabbed off the net, I think it might be easier just to tell the program to stop applying rotation calculations while I am drawing a certain feature. Basically what I want is for part of the screen to stay stationary while the other part still rotates. I can do it with push pop matrix in my other program but this program that I nabbed might be easier if I just say don’t rotate here.

a

b

1)Stop that
2)glPushMatrix();
glLoadIdentity();
draw_whatever_you_want_without_rotations();
glPopMatrix();

now that was hard …

The a and b posts are kind of lame and annoying.

I think he knows that approach, and doesn’t want to. He wants something to tell opengl to ignore matrix changes or to ignore glRotate calls or something like that. You cannot do that in a non-hacky way.

‘Bumping’ posts is not very common here. The board is not that busy, so things ussually stay on the first page for at least a day.

You should be able to contruct a matrix which will undo any rotations in a matrix, but leave all other transformations intact (such as scaling).

I think that multiplying by the inverse transpose might do it, or it might be the inverse matrix with normalized basis vectors.

I really do not want to think about it too much right now, so maybe someone else can take it from here if my hinting has not inspired you to figure out what to do.

Depending upon the platforms you need to support this can be very easily done with a wrapper. Simply wrap the OpenGL library with your own and disable the glRotate calls for example. You would probably also need to kill the glLoadMatrix and glLoadIdentity functions too.

Hi there,

My feeling is that there is a very simple way to achieve this : at each glRotate…() call you wanna deactivate, simply add a flag to reset rotation angle to zero as needed. For example :

Define this :
int rotationIsEnabled;

Enable rotations :

rotationIsEnabled = 1;

(…)

glRotatef(rotationIsEnabled * angle,…);

Disable rotations :

rotationIsEnabled = 0;

(…)

glRotatef(rotationIsEnabled * angle,…);

RCMaster

OMFG

What’s going on here? Wrappers? Undoing rotations, flags, wtf!?

Let me drop a few comments in that code, I didn’t think it was that hard to understand …

glPushMatrix(); //save current matrix for later
glLoadIdentity(); //start with a clean slate

//we are the kings of the road, we can do what we want
glScaleAndTranslateButNotRotateTheHellOutOfIt(my,params,
which,dont,contain,any,rotation,i,promise);
draw_funky_stuff(); //look mom, without rotations

glPopMatrix(); //get old matrix back, as if all of this never happened

Sheesh …

zeckensack, you did see were he says he doesn’t want to use the method of pushing and popping matrices didn’t you? He wants a global method that will stop all rotations when so desired. I guess he doesn’t want to go through the source and add all the popping and pushing code.

There is no such thing. OpenGL vertices go through the matrix stacks, period.
Rotations are just a special case of glMultMatrix, there is no way without breaking everything apart.

All this wrapping up and intercepting GL calls business really makes the alarms go off here at my place.

If you can’t be bothered to push/pop, how can you be bothered to write an OpenGL->OpenGL wrapper?

That’s just gnaaah

Anyway, clean, working, practical approach delivered, proceed as you wish.

Most of the wrapper is already written and available for download as GLTrace. Would only take very few lines of additional code to create the kind of control he wants. And may I suggest you calm down and stop attacking other peoples suggestions simply because they are not your own. He can decide what he believes is a good suggestion for himself.

I suspect that the pushmatrix loadidentity popmatrix will do the trick. I don’t know how those a and b posts happened maybe my computer is broken

c

see there it happened again dang it.

Originally posted by John Jenkins:
[b]I suspect that the pushmatrix loadidentity popmatrix will do the trick. I don’t know how those a and b posts happened maybe my computer is broken

c

see there it happened again dang it.[/b]

You have an infamous evil computer. Please destroy and throw it away. Imagine what the whole world would be like if there are more computers like this. The evil computer also lies sometimes, it will deny it ever does things like this.

Yes push identity pop worked thanks for your help guys.

d

Here’s one

f

Please post your questions on the basic forum where they belong.

You people look like children in primary school trying to learn alphabet :slight_smile:

Sorry, couldn’t resist…

Y.

Originally posted by Ysaneya:
[b]You people look like children in primary school trying to learn alphabet

Sorry, couldn’t resist…

Y.[/b]

Y doesn’t come after F!

Lol, you got me now. Although i’d be you, i’d double check my previous post too… f just doesn’t come after d :slight_smile:

Y.

you guys should stop this alphabet thingy, it has nothing to do with the original question and over-all purpose of this forum…

E


PLUG: http://nomad.openglforums.com

[This message has been edited by nomad82 (edited 12-10-2002).]