Published : 004 – OpenGL Primitives and how to draw from Arrays

I just published a new Episode in my OpenGL & Vulkan Podcast:

004 – OpenGL Primitives and how to draw from Arrays.
In This Episode we introduce the OpenGL Primitives and how you structure your Arrays to draw from them.

http://opengl-trainer.de/podscats/folgen/004_OpenGL_Primitives_and_how_to_draw_from_Arrays.mp3


OpenGL Primitives :

 

gl-primitives

Simple drawing:

    ….
glBegin(GL_TRIANGLES);

glVertex3f(100.0f, 100.0f, 0.0f);
glVertex3f(150.0f, 100.0f, 0.0f);
glVertex3f(125.0f, 50.0f, 0.0f);

glEnd();
….
glBegin(GL_LINES);

glVertex3f(100.0f, 100.0f, 0.0f); // origin of the FIRST line
glVertex3f(200.0f, 140.0f, 5.0f); // ending point of the FIRST line
glVertex3f(120.0f, 170.0f, 10.0f); // origin of the SECOND line
glVertex3f(240.0f, 120.0f, 5.0f); // ending point of the SECOND line

glEnd( );

 

Drawing from a Array:


GLfloat vertices[] = {…}; // 36 of vertex coords

glEnableClientState( GL_VERTEX_ARRAY );
glVertexPointer( 3, GL_FLOAT, 0, vertices );

glDrawArrays( GL_TRIANGLES , 0 , 3 );

glDisableClientState( GL_VERTEX_ARRAY );


Find it on iTunes:

https://itunes.apple.com/de/podcast/opengl-vulkan-podcast/id1047136194?l=en

Use RSS Podcast link:
http://opengl-trainer.de/podscats/OpenGL_Vulkan_Podcast.xml