Jump to content
  • Advertisement
Sign in to follow this  
Trojan

itoa (_itoa_s) analog for float ?

This topic is 4720 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'm getting current color in my app by code: GLfloat arr[3] = {0,0,0}; glGetFloatv(GL_CURRENT_COLOR,arr); now I need to display it throught such routine: drawString(-1.9f, 1.9f, GLUT_BITMAP_HELVETICA_18, somestring); where drawSrting is void drawString(float x, float y,void *font, char *string) { char *c; glRasterPos2f(x, y); for (c=string; *c != '\0'; c++) glutBitmapCharacter(font, *c); } So how to convert my GLfloat array to char* string - to pass it to my func?

Share this post


Link to post
Share on other sites
Advertisement
Erm, if I understand correctly, which I might not:


GLfloat arr[3] = {0,0,0};
glGetFloatv(GL_CURRENT_COLOR,arr);

char nString[128];
sprintf(nString, "%f,%f,%f", arr[0],arr[1],arr[2]);

//***or***

CString nString;
nString.Format("%f,%f,%f", arr[0],arr[1],arr[2]);

//Then pass nString.GetString() into your text drawing function...


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.

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

Sign me up!