PDA

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



John Jenkins
12-06-2002, 10:33 AM
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.

John Jenkins
12-06-2002, 11:16 AM
a

John Jenkins
12-06-2002, 12:14 PM
b

zeckensack
12-06-2002, 12:42 PM
1)Stop that
2)glPushMatrix();
glLoadIdentity();
draw_whatever_you_want_without_rotations();
glPopMatrix();

now that was hard ...

Coriolis
12-06-2002, 12:45 PM
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.

Nakoruru
12-07-2002, 11:26 AM
'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.

DFrey
12-07-2002, 11:35 AM
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.

RCMaster
12-07-2002, 11:45 AM
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,...);

http://www.opengl.org/discussion_boards/ubb/biggrin.gif http://www.opengl.org/discussion_boards/ubb/biggrin.gif http://www.opengl.org/discussion_boards/ubb/biggrin.gif

RCMaster

zeckensack
12-07-2002, 12:04 PM
OMFG http://www.opengl.org/discussion_boards/ubb/redface.gif

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,p arams,
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 ...

DFrey
12-07-2002, 12:21 PM
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.

zeckensack
12-07-2002, 12:26 PM
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.

DFrey
12-07-2002, 12:39 PM
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.

John Jenkins
12-09-2002, 06:20 AM
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.

Coconut
12-09-2002, 08:21 AM
Originally posted by John Jenkins:
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.

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.

John Jenkins
12-09-2002, 09:04 AM
Yes push identity pop worked thanks for your help guys.

d

rgpc
12-09-2002, 03:27 PM
Here's one

f

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

Ysaneya
12-09-2002, 11:16 PM
You people look like children in primary school trying to learn alphabet :)

Sorry, couldn't resist..

Y.

rgpc
12-10-2002, 12:07 AM
Originally posted by Ysaneya:
You people look like children in primary school trying to learn alphabet http://www.opengl.org/discussion_boards/ubb/smile.gif

Sorry, couldn't resist..

Y.

Y doesn't come after F! http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Ysaneya
12-10-2002, 12:27 AM
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 :)

Y.

nomad82
12-10-2002, 05:12 AM
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).]

John Jenkins
12-12-2002, 04:51 AM
It seemed advanced enough to me. You guys should lighten up a little. Some of you guys really like slamming people who just want to learn how to program. And now this guy tells me I am too stupid to even know where to post my question. Maybe there should be a retard forum just for my questions.


Originally posted by rgpc:
Here's one

f

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

*Aaron*
12-12-2002, 05:47 AM
He didn't say you were stupid. He politely asked you to post beginners' questions, which this certainly is, in the Beginners' Forum. These forums are unmoderated, therefore, it is up to the members to tell someone when they break the rules.

Also, bumping your post every hour is not acceptable on any board I have ever seen. It's just plain rude. Imagine if everyone did that. You'd have to start bumping the post every half hour, then every 15 minutes, then constantly just to keep it from going off the first page.

prashantgp
12-13-2002, 03:13 AM
yeah,
great guys,
i usually post my querries in begineers forum,today out of curosity i just entered ur forum.
what rubbish u people are all talking abt.
do remember that knowledge shared is knowledge doubled.

regards to u all great guys
prashant

prashantgp
12-18-2002, 08:38 PM
hey Big Gurus,
why r u not replying to my post??

prashantgp
12-19-2002, 11:51 PM
Originally posted by prashantgp:
hey Big Gurus,
why r u not replying to my post??

do that buddys????

Mezz
12-20-2002, 02:13 AM
What post?

rgpc
12-20-2002, 02:20 AM
Originally posted by prashantgp:
yeah,
great guys,
i usually post my querries in begineers forum,today out of curosity i just entered ur forum.
what rubbish u people are all talking abt.
do remember that knowledge shared is knowledge doubled.

regards to u all great guys
prashant



Grow up and get off twit.

gunsboy
12-20-2002, 06:29 AM
hahahahaa, this was the funniest topic I have ever seen in this board history ..

eventhough, it is useless but it made me laugh .. thanx all