Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualL. Spiro

Posted 03 June 2014 - 08:30 PM

If all the points are around the origin if the object and you are drawing something like Asteroids, rotate first, then translate. Once.

 
	void showLine(){
		glLoadIdentity();
		glRotatef(0.0f,0.0f,rot);				// glRotatef() has 3 parameters.  Rotate around Z.
		glTranslatef(SCREEN_WIDTH/2,SCREEN_WIDTH/2,0.0f);	// Then move to the center of the screen.

		// Or move to the position of the object relative to the center of the screen.
		//glTranslatef(SCREEN_WIDTH/2+objPos.x,SCREEN_WIDTH/2+objPos.x,0.0f);

		glBegin(GL_LINES);
			glColor3f(1.0f,0.5f,0.3f);
			glVertex2f(start.x,start.y);
			glVertex2f(end.x,end.y);
			
		glEnd();
	
	}//this is only one line segment
 

I have looked on line and that's what appears to be the common method.

It was common perhaps 20 years ago. It’s outdated and deprecated, meaning no longer supported and not the common way anymore.


L. Spiro

#2L. Spiro

Posted 03 June 2014 - 08:29 PM

If all the points are around the origin if the object and you are drawing something like Asteroids, rotate first, then translate. Once.

 
	void showLine(){
		glLoadIdentity();
		glRotatef(0.0f,0.0f,rot);				// glRotatef() has 3 parameters.  Rotate around Z.
		glTranslatef(SCREEN_WIDTH/2,SCREEN_WIDTH/2,0.0f);	// Then move to the center of the screen.

		// Or move to the position of the object relative to the center of the screen.
		//glTranslatef(SCREEN_WIDTH/2+objPos.x,SCREEN_WIDTH/2+objPos.x,0.0f);

		glBegin(GL_LINES);
			glColor3f(1.0f,0.5f,0.3f);
			glVertex2f(start.x,start.y);
			glVertex2f(end.x,end.y);
			
		glEnd();
	
	}//this is only one line segment
 

L. Spiro

#1L. Spiro

Posted 03 June 2014 - 08:26 PM

If all the points are around the origin if the object and you are drawing something like Asteroids, rotate first, then translate. Once.


	void showLine(){
		glLoadIdentity();
		glRotatef(rot,0.0f,0.0f,1.0f);
		glTranslatef(SCREEN_WIDTH/2,SCREEN_WIDTH/2,0.0f);

		glBegin(GL_LINES);
			glColor3f(1.0f,0.5f,0.3f);
			glVertex2f(start.x,start.y);
			glVertex2f(end.x,end.y);
			
		glEnd();
	
	}//this is only one line segment
 

L. Spiro

PARTNERS