Jump to content
  • Advertisement

Archived

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

EbonySeraph

glScalef() is ignoring my calls...

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

So here I am trying to get one cirlce to rotate around one in the center. I want one to represent the Sun and be larger and yellow, and the smaller one to represent Earth and be smaller and blue. So far everything is fine but one thing, the Earth is the same size of the Sun. Here is my code:
  

//Called every frame to render the GL scene

void GLRender()
{
	//Clear surface, and depth buffer

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//Select modelview matrix and reset it

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glPushMatrix();
		//Move back 10 units

		glTranslatef(0.0f, 0.0f, -10.0f);

		glColor3f(1.0f, 1.0f, 0.0f);		//Change color to yellow

		DrawCircle(0.0f, 0.0f, 2.0f);		//Draw sun at origin, scaled 2 times normal


		glPushMatrix();
			glTranslatef( 2.0f * cosf(TO_RADIAN(step)),
						 2.0f * sinf(TO_RADIAN(step)),
						 0.0f);
			glColor3f(0.0f, 0.0f, 1.0f);
			//glScalef(0.0f, 0.0f, 0.5f);

			DrawCircle(0.0f, 0.0f, 0.5f);

		glPopMatrix();

	glPopMatrix();

	glFlush();

	step++;

	if(!SwapBuffers(hdc))
		OutputDebugString("Did not render scene!!!");
}

//Called to Draw circle

void DrawCircle(float x, float y, float scale)
{
	glBegin(GL_LINE_LOOP);
		glPushMatrix();
			glTranslatef(x, y, 0.0f);
			glScalef(scale, scale, scale);
	
			for(int i = 0; i < sides; i++)
			{
				glVertex3fv(circle[i]);
			}
		glPopMatrix();
	glEnd();

}

  
Thanks for any help in advance.

Share this post


Link to post
Share on other sites
Advertisement

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