Jump to content
  • Advertisement

Archived

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

Jarred Capellman

OpenGL OpenGL Questions

This topic is 6702 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

Q1 How could I implement a frames per second counter onto the screen, I have the glPrintf function from NeHe''s tutorials. Q2 How could I dump the GL_VERSION, GL_VENDOR, GL_RENDERER to a file? I got the file i/o to work but I keep getting errors when using fputs to write to the file. Q3 Does anyone have realistic fog? When using NeHe''s fog with my program it doesn''t look very realistic like the fog Quake3.

Share this post


Link to post
Share on other sites
Advertisement
Q1:

Don''t know about NeHe''s glPrintf, but calculating FPS involves measuring the time it took one frame to render. Then 1/time (in seconds) should yield you the FPS.

Q2:

FILE *f = fopen("logfile.log", "wb");

fprintf(f,"GL_VERSION: ''%s''\n", glGetString(GL_VERSION));
fprintf(f,"GL_VENDOR: ''%s''\n", glGetString(GL_VENDOR));
fprintf(f,"GL_RENDERER: ''%s''\n", glGetString(GL_RENDERER));

fclose(f);

I think the above is easier ... with fputs, this would be:

char buffer[1024];
memset(buffer,0,1024);

FILE *f = fopen("logfile.log", "wb");

sprintf(buffer,"GL_VERSION: ''%s''\n", glGetString(GL_VERSION));
fputs(buffer, f);
sprintf(buffer,"GL_VENDOR: ''%s''\n", glGetString(GL_VENDOR));
fputs(buffer, f);
sprintf(buffer,"GL_RENDERER: ''%s''\n", glGetString(GL_RENDERER));
fputs(buffer, f);

fclose(f);

Q3:

Quake3 uses volumentric fog. This means that you render your scene, then (for every triangle vertex you have rendered), you take a ray from the camera point to that vertex. You calculate the distance the ray travels through a fog volume. Based on this value, you draw transparent triangles over the rendered scene. It''s kinda hard to explain.

MK42

Share this post


Link to post
Share on other sites
check the source here from one of my programs most have a fps counter in
http://members.xoom.com/myBollux/home.html

ive got a demo of volumetric fog that i wrote a while ago sitting around one of these days i get around to writing a explaination for it. i use another method as well as the quake one . it just alters the colour of the vertices depending on the distance thgrough the fog

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!