Archive for the ‘C++’ Category

And the lightbulb lit up…

March 7th, 2008

In my last post I mentioned I was having issue with remembering the order to draw vertices for quads. Ha… the light came on tonight while I was working on the various tutorials I’ve come across. The bottom and back faces of a cube I am actually drawing the quad from the perspective of viewing the back face. Apparently when drawing a quad (or triangle for that matter) you draw the vertices in counter-clockwise order to draw the FRONT face as the side facing the observer, or you draw the vertices clockwise to draw the BACK face as the side facing the observer. Boy, once I got that, it sure seemed a lot easier!

As an example of drawing a basic cube, colored all pretty and green.

OpenGL Blocks Screenie

  1. glBegin(GL_QUADS);
  2.  
  3. // Front face
  4. glNormal3f(0.0f, 0.0f, 1.0f);
  5. glColor3f(0.0f, 1.0f, 0.0f);
  6. glVertex3f(-1.2f, -0.5f, 0.5f);
  7. glVertex3f(1.2f, -0.5f, 0.5f);
  8. glVertex3f(1.2f, 0.5f, 0.5f);
  9. glVertex3f(-1.2f, 0.5f, 0.5f);
  10.  
  11. // Back face
  12. glNormal3f(0.0f, 0.0f, -1.0f);
  13. glColor3f(0.0f, 1.0f, 0.0f);
  14. glVertex3f(-1.2f, -0.5f, -0.5f);
  15. glVertex3f(-1.2f, 0.5f, -0.5f);
  16. glVertex3f(1.2f, 0.5f, -0.5f);
  17. glVertex3f(1.2f, -0.5f, -0.5f);
  18.  
  19. // Top face
  20. glNormal3f(0.0f, 1.0f, 0.0f);
  21. glColor3f(0.0f, 1.0f, 0.0f);
  22. glVertex3f(-1.2f, 0.5f, -0.5f);
  23. glVertex3f(-1.2f, 0.5f, 0.5f);
  24. glVertex3f(1.2f, 0.5f, 0.5f);
  25. glVertex3f(1.2f, 0.5f, -0.5f);
  26.  
  27. // Bottom face
  28. glNormal3f(0.0f, -1.0f, 0.0f);
  29. glColor3f(0.0f, 1.0f, 0.0f);
  30. glVertex3f(-1.2f, -0.5f, -0.5f);
  31. glVertex3f(1.2f, -0.5f, -0.5f);
  32. glVertex3f(1.2f, -0.5f, 0.5f);
  33. glVertex3f(-1.2f, -0.5f, 0.5f);
  34.  
  35. // Right face
  36. glNormal3f(1.0f, 0.0f, 0.0f);
  37. glColor3f(0.0f, 1.0f, 0.0f);
  38. glVertex3f(1.2f, -0.5f, -0.5f);
  39. glVertex3f(1.2f, -0.5f, 0.5f);
  40. glVertex3f(1.2f, 0.5f, 0.5f);
  41. glVertex3f(1.2f, 0.5f, -0.5f);
  42.  
  43. // Left face
  44. glNormal3f(-1.0f, 0.0f, 0.0f);
  45. glColor3f(0.0f, 1.0f, 0.0f);
  46. glVertex3f(-1.2f, -0.5f, -0.5f);
  47. glVertex3f(-1.2f, -0.5f, 0.5f);
  48. glVertex3f(-1.2f, 0.5f, 0.5f);
  49. glVertex3f(-1.2f, 0.5f, -0.5f);
  50.  
  51. glEnd();

Tags: , ,
Posted in C++, OpenGL | Comments (0)

Learning OpenGL

March 6th, 2008

In the last two days I have blown the dust film off of the old C++ compiler and jumped back into the world of graphic programming in OpenGL. I have maintained a fantasy for many years now of getting into game programming. Being such a fascinating and challenging area of development, as well as the fact that I enjoy video games, has prompted me to start looking into higher education on the matter.

I am not a college graduate and I have worked hard to get into the software development arena, but now I find that I must seek higher education to get into the arena of game development. I have looked into a couple of schools, mainly SMU’s GuildHall and UAT’s Bachelor of Science: Game Programming degree programs. There are a couple of others I’ve seen, so I haven’t made a choice yet, as I still need to investigate further, not to mention calling all these people. Meanwhile, to get started, I am refreshing my C++ skills, and jumping onto every OpenGL tutorial I can find.

Read the rest of this entry »

Tags: , ,
Posted in C++, OpenGL | Comments (1)