Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

i_pee_freely

dials

This topic is 5599 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I hope this is the right place to ask this question. I posted this a long time ago and din''t get a satisfactory answer and i left the subject for awhile. Now i''m after getting back around to it and i could do with a hint or two. I''m doing a simple implementation of a flight sim and i need help doing the panel of the aeroplane. I figured i could use a static background and then for the "needles", have another image which i could rotate as i wish. My question is, how do i rotate the image and also how would i get the image to appear in the correct position????? Thanks in advance for any help

Share this post


Link to post
Share on other sites
Advertisement
Use those 2 functions:


void Enter2DMode()
{
glPushAttrib(GL_LIGHTING_BIT|GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);

//glEnable(GL_BLEND);
//glBlendFunc(GL_DST_ALPHA,GL_SRC_ALPHA);

glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, (GLdouble)window_width, (GLdouble)window_height, 0.0, -250.0, 250.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}

void Leave2DMode()
{
//glDisable(GL_BLEND);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopAttrib();
}


Then draw the instruments, push the modelview matrix, rotate, etc. your needles, then pop the matrix

Height Map Editor | Eternal lands

Share this post


Link to post
Share on other sites
Thanks for your post but it doesn't answer my question exactly, i need to know how to rotate the image and get it in the right place. Thanx anyway

I think they could be some confusion over my problem. I mean to create a texture from the needle image, bind it to a quad which will be made transparent so that it don't obsecure the background. It is THE QUAD i mean to rotate. I think you thought that i was trying to rotate the image in some way???? Sorry for the confusion.
So my question is:
1. How do i rotate the image in accordance with the speed for example?
2. How do i get it in the right place on the screen?

And also, is this a good or bad or rubbish way of doing a guage? How are guages implemented in simulators or games?? Mayb i can do a simplfied version of it??

[edited by - I_Pee_Freely on January 23, 2003 10:35:44 AM]

Share this post


Link to post
Share on other sites
No, he was correct. Push model view matrix, rotate/translate your need into postion, then pop the model view matrix, and repeat until all needles are done.

Share this post


Link to post
Share on other sites
try this...
1. Load a texture with the needle. the background should be transparent. (ie. black background, yellow needle)

2.use Raduprv''s code to enter ortho mode, then...

3.use glBlendFunc(GL_SRC_ALPHA, GL_ONE) & enable (GL_BLEND)

4.go into texture matrix, push matrix
glMatrixMode(GL_TEXTURE);
glPushMatrix();

5. rotate the needle (glRotated(20,0,0) or whatever)

6. DRAW it as a quad, or whatever.

7. pop the matrix

8. leave ortho mode.



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!