Jump to content
  • Advertisement
Sign in to follow this  
iamspecial

opengl work

This topic is 3740 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 found a small piece of code which was being used to write something on opengl but i cant able to know is it working can someone explain it ? here goes the code GLvoid glPrint(const char *fmt, ...) { char text[256]; // Holds Our String va_list ap; // Pointer To List Of Arguments if (fmt == NULL) / If There's No Text return; // Do Nothing va_start(ap, fmt); // Parses The String For Variables vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers va_end(ap); // Results Are Stored In Text glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits glListBase(base - 32); // Sets The Base Character to 32 glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text glPopAttrib(); // Pops The Display List Bits } int DrawGLScene(const char* str,float x, float y) // Here's Where We Do All The Drawing { glLoadIdentity(); // Reset The Current Modelview M//atrix glTranslatef(0.0f,0.0f,-1.0f); // Move One Unit Into The Screen // Pulsing Colors Based On Text Position glColor3f(1.0f*float(cos(cnt1)),1.0f*float(sin(cnt2)),1.0f-0.5f*float(cos(cnt1+cnt2))); // Position The Text On The Screen glRasterPos2f(x,y); glPrint(str,0.4 ); // Print GL Text To The Screen return TRUE; } thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Well, the first part creates a string according to what was passed to the
function.
And then it renders a display list for each character.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!