Jump to content

  • Log In with Google      Sign In   
  • Create Account

Issue learning OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 shanept   Members   -  Reputation: 103

Like
0Likes
Like

Posted 26 May 2012 - 12:20 PM

Hi guys,

Recently I came across a site (a sub-domain of this) which contains some (rather old-ish) tutorials on OpenGL.
I am doing this tutorial: http://nehe.gamedev...._polygon/13002/
which is an extension upon the last. I had no issues with the last. However I get to tutorial 2 and it does not draw.

Here is what I believe is the relevant code:


int DrawGLScene(GLvoid) { // Here's where we do all the drawing
	 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the screen and the depth buffer
	 glMatrixMode(GL_PROJECTION);		  // I found some pages said I should do this?
	 glLoadIdentity(); // Reset the current Modelview Matrix

	 glTranslatef(1.5, 0.0, 6.0); // Move left 1.5 and back 6.0

	 glBegin(GL_TRIANGLES); // Draw using triangles
		  glVertex3f( 0.0f,  1.0f,  0.0f); // Top
		  glVertex3f(-1.0f, -1.0f,  0.0f); // Bottom left
		  glVertex3f( 1.0f, -1.0f,  0.0f); // Bottom right
	 glEnd(); // Finished the triangle

	 glBegin(GL_QUADS); // Draw using squares
		  glVertex3f(-1.0f,  1.0f, 0.0f); // Top left
		  glVertex3f( 1.0f,  1.0f, 0.0f); // Top right
		  glVertex3f( 1.0f, -1.0f, 0.0f); // Bottom right
		  glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom left
	 glEnd(); // Finished the square

	 return true; // Everything went OK.
}

It simply appears to do nothing. I have been googling around, however there does not seem to be that much information on it, or I am looking in the wrong place. I can confirm this function is being run - I placed a breakpoint in the function and it breaks fine.

However all I am presented with is a blank screen.
Any tips?

Thanks,
shanept

EDIT
I have gone through my code again and have found my errors. They were simply a few positive numbers where they should have been negative, and a missing translate between the two objects.

Edited by shanept, 26 May 2012 - 01:07 PM.


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS