PDA

View Full Version : matrix storage and Window reset problems



06-11-2002, 11:46 PM
Hi,
I have 2 problems

1. I want to store the current matrix in a variable or array. I can't figureout what might be the order of the matrix and I don't know the "store function"

2.I have only one window. I have 2 rooms as models. room 1&2 are seperate models connected by a door. When I walk out of the door of room 1 I have to enter room 2. This means I have to clear & reset the window and load the room 2. How to do this?

do I have to write 2 cpp files for room 1&2? in that case how & where to link these to load the model to the window?

thanks guys
Angelo

p.s: I'm a student

Gavin
06-12-2002, 12:34 AM
GLfloat GLtransform[16];

glGetFloatv(GL_MODELVIEW_MATRIX, GLtransform);

Can't remember which way it goes, it is in the red book though. Or search this list

myDraw()
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(room1)
{
DrawRoom1();
}
else if(room2)
{
DrawRoom2();
}
else
{
MyError(NO_ROOM);
}
SwapBuffers();
}

06-12-2002, 03:34 AM
thanks gavin

I wrote the program as you said. but I have a problem.

It loads the first model and when i come out of the model(using z condition) It's not displaying the 2nd model. do i have to reset the window or anything like that?

Please guys help me

here is the layout of the prog


initialisation

main()..
....

initGL()
...

window_display()
{
glLookat...
init_scene();
glutSwapBuffers();
}

init_scene()
{
if z<=2
{
draw model1
}
else
{
draw model2
}

move()
{
if s=1
increment z
else
decrement z
}

keyboard()
{
check for "up" arrow then s=1;
check for "down"arrow then s=0;
}

windowreshape()
...