Sign in to follow this  

opengl work

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this