{"id":2911,"date":"2022-08-16T10:21:56","date_gmt":"2022-08-16T05:21:56","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=2911"},"modified":"2022-08-16T10:21:59","modified_gmt":"2022-08-16T05:21:59","slug":"build-ping-pong-game-using-opengl-and-c-programming-code","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/","title":{"rendered":"Build Ping Pong Game Using OpenGL and C Programming Code"},"content":{"rendered":"\n<p>This tutorial will teach you how to create a multiplayer <strong>Ping Pong Game<\/strong> using <strong>C programming language<\/strong>, <strong>OpenGL<\/strong> library, and <strong>GLUT (The OpenGL Utility Toolkit)<\/strong>.<\/p>\n\n\n\n<p>Create a file named <code>pingpong.c<\/code> on your computer and add the following code in it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">pingpong.c<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#include &lt;GL\/gl.h&gt;\n#include &lt;GL\/glu.h&gt;\n#include &lt;GL\/glut.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;time.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n\/* A simple ping pong game using opengl library and glut\n   The game starts on left mouse click, and stops on middle mouse click\n   Player 1 can control the game using the keys q and a\n   Player 2 can control the game using the keys o and l\n*\/\n\n\/\/ global variables\nstatic GLint windowSizeX = 800, windowSizeY = 1200;\nstatic GLint orthoSizeX = 600, orthoSizeY = 400;\n\n\/\/ game variables\nstatic char score_1[20], score_2[20];\nstatic GLint player1_score = 0, player2_score = 0;\nstatic GLint player1_life = 3, player2_life = 3;\nstatic GLint paddle_boundary = 350, paddle_height = 100, paddile_velocity = 8.0;\nstatic GLint player1_paddile_y = 0, player2_paddile_y = 0, paddle_x = 595;\nstatic GLfloat ball_velocity_x = 0, ball_velocity_y = 0, speed_increment = 0.5;\nstatic GLint ball_pos_x = 0, ball_pos_y = 0, ball_radius = 20;\n\nvoid init(void) {\n    \/\/ initalise display with black colors\n    glClearColor (0.0, 0.0, 0.0, 0.0);\n    glShadeModel (GL_FLAT);\n\n    srand(time(NULL));   \/\/ should only be called once\n}\n\n\/\/ draw text on screen\nvoid drawStrokeText(char*string, int x, int y, int z)\n{\n    char *c;\n    glPushMatrix();\n    glTranslatef(x, y+8,z);\n    \/\/ glScalef(0.09f,-0.08f,z);\n    for (c=string; *c != '\\0'; c++)\n    {\n        glutStrokeCharacter(GLUT_STROKE_ROMAN , *c);\n    }\n    glPopMatrix();\n}\n\n\/\/ draw the center lines spaces 20 pixels apart and with a width of 4 px\nvoid drawCenterLines() {\n    \/\/ center lines start\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -410);\n    glVertex2f(2 , -410);\n    glVertex2f(2 , -390);\n    glVertex2f(-2 , -390);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -370);\n    glVertex2f(2 , -370);\n    glVertex2f(2 , -350);\n    glVertex2f(-2 , -350);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -330);\n    glVertex2f(2 , -330);\n    glVertex2f(2 , -310);\n    glVertex2f(-2 , -310);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -290);\n    glVertex2f(2 , -290);\n    glVertex2f(2 , -270);\n    glVertex2f(-2 , -270);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -250);\n    glVertex2f(2 , -250);\n    glVertex2f(2 , -230);\n    glVertex2f(-2 , -230);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -210);\n    glVertex2f(2 , -210);\n    glVertex2f(2 , -190);\n    glVertex2f(-2 , -190);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -170);\n    glVertex2f(2 , -170);\n    glVertex2f(2 , -150);\n    glVertex2f(-2 , -150);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -130);\n    glVertex2f(2 , -130);\n    glVertex2f(2 , -110);\n    glVertex2f(-2 , -110);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -90);\n    glVertex2f(2 , -90);\n    glVertex2f(2 , -70);\n    glVertex2f(-2 , -70);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -50);\n    glVertex2f(2 , -50);\n    glVertex2f(2 , -30);\n    glVertex2f(-2 , -30);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , -10);\n    glVertex2f(2 , -10);\n    glVertex2f(2 , 10);\n    glVertex2f(-2 , 10);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 30);\n    glVertex2f(2 , 30);\n    glVertex2f(2 , 50);\n    glVertex2f(-2 , 50);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 70);\n    glVertex2f(2 , 70);\n    glVertex2f(2 , 90);\n    glVertex2f(-2 , 90);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 110);\n    glVertex2f(2 , 110);\n    glVertex2f(2 , 130);\n    glVertex2f(-2 , 130);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 150);\n    glVertex2f(2 , 150);\n    glVertex2f(2 , 170);\n    glVertex2f(-2 , 170);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 190);\n    glVertex2f(2 , 190);\n    glVertex2f(2 , 210);\n    glVertex2f(-2 , 210);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 230);\n    glVertex2f(2 , 230);\n    glVertex2f(2 , 250);\n    glVertex2f(-2 , 250);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 270);\n    glVertex2f(2 , 270);\n    glVertex2f(2 , 290);\n    glVertex2f(-2 , 290);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 310);\n    glVertex2f(2 , 310);\n    glVertex2f(2 , 330);\n    glVertex2f(-2 , 330);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 350);\n    glVertex2f(2 , 350);\n    glVertex2f(2 , 370);\n    glVertex2f(-2 , 370);\n    glEnd();\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    glVertex2f(-2 , 390);\n    glVertex2f(2 , 390);\n    glVertex2f(2 , 410);\n    glVertex2f(-2 , 410);\n    glEnd();\n    \/\/ center lines end\n}\n\n\/\/ x, y is the top left corodinate of the paddle\nvoid drawPaddle(int x, int y) {\n    glPushMatrix();\n\n    glTranslatef(x, y, 0);\n\n    glBegin(GL_QUADS);\n    glColor3f(1.0, 1.0, 1.0);\n    int height = paddle_height \/ 2;\n    glVertex2f(-5 , height);\n    glVertex2f(5 , height);\n    glVertex2f(5 , -height);\n    glVertex2f(-5, -height);\n    glEnd();\n\n    glPopMatrix();\n}\n\nvoid drawBall(int x, int y) {\n    glPushMatrix();\n\n    glTranslatef(x, y, 0);\n    glColor3f(1.0, 1.0, 1.0);\n    glutSolidSphere (ball_radius, 20, 16);\n\n    glPopMatrix();\n}\n\n\/\/ main display functions\nvoid display(void) {\n    glClear(GL_COLOR_BUFFER_BIT);\n\n    \/\/ create center lines\n    drawCenterLines();\n\n    \/\/ draw left paddle at (-paddle_x, player1_paddile_y)\n    drawPaddle(-paddle_x, player1_paddile_y);\n    \/\/ draw right paddle at (paddle_x, player2_paddile_y)\n    drawPaddle(paddle_x, player2_paddile_y);\n\n    \/\/ draw the ball (ball_pos_x, ball_pos_y) - varies in each frame\n    drawBall(ball_pos_x, ball_pos_y);\n\n    \/\/ draw the score on the left for player 1\n    snprintf (score_1, sizeof(score_1), &quot;%d&quot;, player1_score);\n    drawStrokeText(score_1, -300, 200, 0);\n\n    \/\/ draw the score on the left for player 1\n    snprintf (score_2, sizeof(score_2), &quot;%d&quot;, player2_score);\n    drawStrokeText(score_2, 200, 200, 0);\n\n    \/\/ swap the current frame with the drawn frame\n    glutSwapBuffers();\n    glFlush();\n}\n\nvoid startGame(void) {\n\n    \/\/ move the ball\n    ball_pos_x += ball_velocity_x;\n    ball_pos_y += ball_velocity_y;\n\n    \/\/ ball hits the top or bottom\n    if (ball_pos_y + ball_radius &gt; orthoSizeY || ball_pos_y - ball_radius &lt; -orthoSizeY)\n        ball_velocity_y = -ball_velocity_y;\n\n    \/\/ ball hits the left paddle\n    if (ball_pos_x - ball_radius - 5 &lt; -paddle_x &amp;&amp; ball_pos_x - ball_radius &lt; -paddle_x)\n        if (ball_pos_y &lt; player1_paddile_y + paddle_height &amp;&amp; ball_pos_y &gt; player1_paddile_y - paddle_height) {\n            ball_velocity_x = -ball_velocity_x;\n            ball_velocity_x += speed_increment;\n            paddile_velocity += speed_increment;\n        }\n\n\n    \/\/ ball hits the right paddle\n    if (ball_pos_x + ball_radius + 5 &gt; paddle_x &amp;&amp; ball_pos_x + ball_radius &lt; paddle_x)\n        if (ball_pos_y &lt; player2_paddile_y + paddle_height &amp;&amp; ball_pos_y &gt; player2_paddile_y - paddle_height)\n            ball_velocity_x = -ball_velocity_x;\n\n    \/\/ player 1 scores\n    if (ball_pos_x + ball_radius &gt; orthoSizeX) {\n        player1_score++;\n        printf(&quot;Player 1 = %d \\n&quot;, player1_score);\n        ball_velocity_x = -ball_velocity_x;\n    }\n\n    \/\/ player 2 scores\n    if (ball_pos_x - ball_radius &lt; -orthoSizeX) {\n        player2_score++;\n        printf(&quot;Player 2 = %d \\n&quot;, player2_score);\n        ball_velocity_x = -ball_velocity_x;\n    }\n\n    glutPostRedisplay();\n}\n\n\/\/ reshape the display\nvoid reshape(int w, int h) {\n    glViewport (0, 0, (GLsizei) w, (GLsizei) h);\n    glMatrixMode(GL_PROJECTION);\n    glLoadIdentity();\n    glOrtho(-orthoSizeX, orthoSizeX, -orthoSizeY, orthoSizeY, -100, 100);\n    glMatrixMode(GL_MODELVIEW);\n    glLoadIdentity();\n}\n\n\/\/ on mouse button click\nvoid mouse(int button, int state, int x, int y) {\n    switch (button) {\n        \/\/ left button - initialize random velocity between (ran(5) - rand(3))\n        case GLUT_LEFT_BUTTON:\n            if (state == GLUT_DOWN)\n            ball_velocity_x = (rand() % 5) -  (rand() % 3);\n            ball_velocity_y = (rand() % 5) -  (rand() % 3);\n\n            \/\/ keep on calling the callback to move the ball and check boundary conditions\n            glutIdleFunc(startGame);\n            break;\n        \/\/ middle button to reset the ball, paddle and score\n        case GLUT_MIDDLE_BUTTON:\n            \/\/ reset ball, paddle and player scores\n            ball_pos_x = ball_pos_y = 0;\n            player1_paddile_y = player2_paddile_y = 0;\n            player1_score = player2_score = 0;\n            if (state == GLUT_DOWN)\n                \/\/ remove the call back so that game stops\n                glutIdleFunc(NULL);\n            break;\n        default:\n        break;\n    }\n}\n\n\nvoid keyboard (unsigned char key, int x, int y) {\n    switch (key) {\n        \/\/ move player 1 paddile up\n        case 'q':\n            if (player1_paddile_y &lt; paddle_boundary)\n                player1_paddile_y += paddile_velocity;\n            glutPostRedisplay();\n            break;\n        \/\/ move player 1 paddile down\n        case 'a':\n            if (player1_paddile_y &gt; -paddle_boundary)\n                player1_paddile_y -= paddile_velocity;\n            glutPostRedisplay();\n            break;\n        \/\/ move player 2 paddile up\n        case 'o':\n            if (player2_paddile_y &lt; paddle_boundary)\n                player2_paddile_y += paddile_velocity;\n            glutPostRedisplay();\n            break;\n        \/\/ move player 2 paddile down\n        case 'l':\n            if (player2_paddile_y &gt; -paddle_boundary)\n                player2_paddile_y -= paddile_velocity;\n            glutPostRedisplay();\n            break;\n        \/\/ exit on esc\n        case 27:\n            exit(0);\n            break;\n        default:\n            break;\n    }\n}\n\n\/*\n* Request double buffer display mode.\n* Register mouse input callback functions\n*\/\nint main(int argc, char** argv) {\n    glutInit(&amp;argc, argv);\n    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);\n    glutInitWindowSize (1200, 800);\n    glutInitWindowPosition (10, 10);\n    glutCreateWindow (argv[0]);\n    init ();\n\n    \/\/ call back functions for rendering, reshape\n    glutDisplayFunc(display);\n    glutReshapeFunc(reshape);\n\n    \/\/ callback on mouse click and keyboard input\n    glutMouseFunc(mouse);\n    glutKeyboardFunc(keyboard);\n    glutMainLoop();\n    return 0;\n}<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Run the Program<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">$ gcc pingpong.c  -lm -lglut -lGL -lGLU<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How to Play this Ping Pong Game?<\/h2>\n\n\n\n<p>To start playing the game you have to click the left mouse button whereas press the middle mouse button to stop it.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How to Control Player 1?<\/h2>\n\n\n\n<p>Move Up: Q<\/p>\n\n\n\n<p>Move Down: A<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How to Control Player 2?<\/h2>\n\n\n\n<p>Move Up: O<\/p>\n\n\n\n<p>Move Down: L<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How to Restart Ping Pong Game?<\/h2>\n\n\n\n<p>Press the middle mouse button to reset the ball, paddle and score.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will teach you how to create a multiplayer Ping Pong Game using C programming language, OpenGL library, and GLUT (The OpenGL Utility Toolkit). Create a file named pingpong.c on your computer and add the following code in it. pingpong.c Run the Program How to Play this Ping Pong Game? To start playing the &#8230; <a title=\"Build Ping Pong Game Using OpenGL and C Programming Code\" class=\"read-more\" href=\"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/\" aria-label=\"Read more about Build Ping Pong Game Using OpenGL and C Programming Code\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":2915,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-2911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Build Ping Pong Game Using OpenGL and C Programming Code<\/title>\n<meta name=\"description\" content=\"This tutorial will teach you how to create a multiplayer Ping Pong Game using C programming language, OpenGL library, and GLUT (The OpenGL Utility\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build Ping Pong Game Using OpenGL and C Programming Code\" \/>\n<meta property=\"og:description\" content=\"This tutorial will teach you how to create a multiplayer Ping Pong Game using C programming language, OpenGL library, and GLUT (The OpenGL Utility\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-16T05:21:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-16T05:21:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/08\/ping_pong_c_opengl.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"880\" \/>\n\t<meta property=\"og:image:height\" content=\"495\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Build Ping Pong Game Using OpenGL and C Programming Code","description":"This tutorial will teach you how to create a multiplayer Ping Pong Game using C programming language, OpenGL library, and GLUT (The OpenGL Utility","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/","og_locale":"en_US","og_type":"article","og_title":"Build Ping Pong Game Using OpenGL and C Programming Code","og_description":"This tutorial will teach you how to create a multiplayer Ping Pong Game using C programming language, OpenGL library, and GLUT (The OpenGL Utility","og_url":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-08-16T05:21:56+00:00","article_modified_time":"2022-08-16T05:21:59+00:00","og_image":[{"width":880,"height":495,"url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/08\/ping_pong_c_opengl.jpg","type":"image\/jpeg"}],"author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"Build Ping Pong Game Using OpenGL and C Programming Code","datePublished":"2022-08-16T05:21:56+00:00","dateModified":"2022-08-16T05:21:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/"},"wordCount":121,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/08\/ping_pong_c_opengl.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/","url":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/","name":"Build Ping Pong Game Using OpenGL and C Programming Code","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/08\/ping_pong_c_opengl.jpg","datePublished":"2022-08-16T05:21:56+00:00","dateModified":"2022-08-16T05:21:59+00:00","description":"This tutorial will teach you how to create a multiplayer Ping Pong Game using C programming language, OpenGL library, and GLUT (The OpenGL Utility","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/08\/ping_pong_c_opengl.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/08\/ping_pong_c_opengl.jpg","width":880,"height":495,"caption":"Build Ping Pong Game Using OpenGL and C Programming Code"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/build-ping-pong-game-using-opengl-and-c-programming-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Build Ping Pong Game Using OpenGL and C Programming Code"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/2911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=2911"}],"version-history":[{"count":0,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/2911\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/2915"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=2911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=2911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=2911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}