Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7004157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:09:46+00:00 2026-05-27T21:09:46+00:00

Solution: strtod instead of atof solved it. Thanks! TODO: make this an answer for

  • 0

Solution:

strtod instead of atof solved it.
Thanks!

TODO: make this an answer for acceptance


I’m loading a value from an XML file that tells how much the texture should be rotated.

It looks like this:

string rotv = ItemElem->FirstChild("Rotation")->FirstChild()->Value();
rotation = -(atof(rotv.c_str()))*57.2957795;

In my level editor the textures are rotated properly; pi equals 180 degrees and so on.
But in the engine; they are not, it seems like the decimals are ignored. So for example, a texture that should be rotated 3.14 radians is only rotated 3 radians and so on.
I’ve tried many different approaches to make sure the decimals are included, but I can’t get it to work.

I rotate the textures like this:

glBindTexture(GL_TEXTURE_2D, texture->GetImage());
glMatrixMode(GL_TEXTURE);

glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glRotatef(rotation, 0, 0, 1);
glTranslatef(-0.5, -0.5, 0);

glMatrixMode(GL_PROJECTION);

The value in the xml file uses a dot instead of coma and I convert it like this, I also store the decimals separately just for debugging.

 for (int x = 0; x < rotv.size(); x++)
     {
          if (afterComa)
          {
                  int temp = (int) rotv[x] - '0';
              if (temp <10 && temp >= 0)
              {
                  decimals[decimalPos] = temp;
                  decimalPos++;
              }
              else
              {
                  break;
              }

          }
         if (rotv[x] == '.')
         {
             rotv[x] = ',';
             afterComa = true;
          }
      }

float decimalValue = decimals[0]/10 + decimals[1]/100 + decimals[2]/1000 + decimals[3]/10000 + decimals[4]/100000 + decimals[5]/1000000;

The decimals are stored properly and I add them to the rotation value but it still doesn’t help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:09:47+00:00Added an answer on May 27, 2026 at 9:09 pm

    You can use strtod instead of atof. It has better localization so you don’t have to change the “.” to “,”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Solution As reported by @limulus in the answer I accepted, this was a bug
Solution: thanks to the suggestion from @Guarav I was inspired and FINALLY came up
SOLUTION Thanks to casperOne's answer , here is my resulting function: Shared Function FormatDate(ByVal
Solution: $query = $this->db->query( SELECT *, SUM(views.times) AS sum FROM channel RIGHT JOIN video
Solution: remove --cached from git rm -r --cached submodule/name . Scripted for reference. I'm
Solution: I've misinterpreted the example from SQL Books Online. Yes, that below the section
Solution: if you have the same problem, addElement() instead of addChild() is what did
Solution: Yay, using this.setName() worked! Problem: 1) Didn't know how to properly title this
SOLUTION FOUND: (thanks to Zsolt Botykai and Mike Ryan) The exact translation of the
SOLUTION Refer to my answer below: issues with form/iframe based file upload in Opera

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.