Advertisement

Quick Question

Started by August 16, 2000 09:23 PM
4 comments, last by Mike00 24 years, 3 months ago
Right now, I''m making my text''s color change constantly by doing glColor3f(red, green, blue), and increasing or decreasing them in DrawGLScene. So basically, every time windows calls the DrawGLScene function, my text color changes. What I''m wondering, is which is a better function to put my variable+=0.1 in, since DrawGLScene is only called about once every second, so the colors change pretty slowly and it doesn''t look too good. Thanks!
you''r drawglscene should be called at least 30 times a second. maybe it''s going to fast for you to notice, not too slow. =) (kinda like the helicopter blades spinning slowly in reverse). that''s kinda wierd that it''s rendering only once a second. if it''s going that slow, then there might be something wrong with your code, or you may have a Sleep(msec); somewhere.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
Eh?!?

If DrawGLScene has all your rendering code in it (i am asuming it does) then you must call it more often, you can''t visably change your colour more frequently than your frame rate!

Andrew
SLARTIBARTFAST00 PLEASE SELECT WITTY .SIG: NoneWho is General Failure and why is he reading my disk?Microwave: Signal from a friendly micro...Multitasking: Screwing up several things at once...How do I set my laser printer on stun?Sarr! The spellchecker kinna take this abuse!
You must type faster than me, because when I started writing my reply, yours wasn''t there :/

Andrew
SLARTIBARTFAST00 PLEASE SELECT WITTY .SIG: NoneWho is General Failure and why is he reading my disk?Microwave: Signal from a friendly micro...Multitasking: Screwing up several things at once...How do I set my laser printer on stun?Sarr! The spellchecker kinna take this abuse!
This is what I have:

void DrawText(){
glLoadIdentity();
glTranslatef(4.0f,2.0f,-20.0f);
glColor3f(0.0f,0.0f,textblue);
glRotatef(textrot,1.0f,0.0f,0.0f);
glPrint("%d", score);
}

int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawText();
textblue+=0.1;
}

but the text only gets lighter about every second, that''s what I meant. I have no Sleep function anywhere, and no 3d objects either, so I don''t see why it''s going slow. Maybe the problem is that usually when I run my programs in fullscreen mode the 3dfx logo appears, but in this program it never does, so maybe it''s not using my 3d card (voodoo3)?

Thanks!
1)You should use a time-based animation so it goes fast as you want on every system...
Try to use timeGetTime() (remember to link winmm.lib)
The function returns the time elapsed in milliseconds from window session start...and by difference you can get the time elapsed from the previous frame and update the color.

2) You should see the 3dfx logo if you are in the ''real'' fullscreen: have you changed the display ?

See EnumDisplaySettings(...)
and ChangeDisplaySettings(...)

If you change display and setup OpenGL, windows should use 3dfx drivers automatically...

However if the scene is simple, fullscreen is slower than windowed mode because SwapBuffers() is syncronous with monitor v-sync (in fullscreen I get 60 fps max with my voodoo 3000)
IpSeDiXiT

This topic is closed to new replies.

Advertisement