Hacker News new | ask | show | jobs
by raytopia 946 days ago
Well if you use glBegin it's pretty easy.

glBegin(GL_TRIANGLES);

  glVertex3f( 0.0f, 1.0f, 0.0f);              
  glVertex3f(-1.0f,-1.0f, 0.0f);              
  glVertex3f( 1.0f,-1.0f, 0.0f);  
           
glEnd();

And there you go you got a triangle.

It's great for beginners because they can see the results very fast and once they want to start having crazy graphical effects or need more performance you can move to shaders.

2 comments

The hardware was designed to display triangles, not to do 'Hello world'.

So it's not all that surprising that the one is easier than the other, in a way it is surprising that the other can be done at all. But as CPUs and GPUs converge it's quite possible that NV or another manufacturer eventually slips enough general purpose capacity onto their cards that they function as completely separate systems. And then 'Hello world' will be trivial.

Erm yes. A triangle is quite easy .. but here they tried a simple tutorial to actually print "Hello World" .. and surprise, it wasn't easy and in the end just stops.
It's not as easy as drawing triangles but glut which was a part of old school opengl had the function glutBitmapString which made it pretty easy to draw text in a few lines.