title
OpenGL with PyOpenGL tutorial Python and PyGame p.1 - Making a rotating Cube Example

description
In this tutorial, we learn some basics of OpenGL using PyOpenGL, which is a Python module for working with OpenGL, along with using PyGame, which is a popular gaming module for Python. PyOpenGL works with many other Python modules as well. In this example, we work on how to program a 3D cube, and how we can move around and rotate the cube. PyOpenGL playlist: http://youtu.be/R4n4NyDG2hI?list=PLQVvvaa0QuDdfGpqjkEJSeWKGCP31__wD PyGame with Python 3 Playlist: http://www.youtube.com/playlist?list=PLQVvvaa0QuDdLkP8MrOXLe_rKuf6r80KO Python: Python.org PyOpenGL: Either use http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl or http://pyopengl.sourceforge.net/ PyGame: Either use http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame or http://pygame.org/download.shtml sample code: http://pythonprogramming.net/opengl-pyopengl-python-pygame-tutorial/ http://seaofbtc.com http://sentdex.com http://hkinsley.com https://twitter.com/sentdex Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6

detail
{'title': 'OpenGL with PyOpenGL tutorial Python and PyGame p.1 - Making a rotating Cube Example', 'heatmap': [{'end': 1405.989, 'start': 1371.479, 'weight': 0.759}, {'end': 1504.599, 'start': 1476.849, 'weight': 1}], 'summary': 'Tutorial covers python 3d graphics using pyopengl and pygame, encompassing topics such as graph theory, opengl vertices, visualizing variable changes, pygame display initialization, and event loop handling, providing an in-depth understanding of 3d graphics rendering and interactive manipulation with opengl and pygame.', 'chapters': [{'end': 244.265, 'segs': [{'end': 30.958, 'src': 'embed', 'start': 3.285, 'weight': 0, 'content': [{'end': 6.587, 'text': 'Hello everybody and welcome to another Python programming tutorial series.', 'start': 3.285, 'duration': 3.302}, {'end': 13.75, 'text': 'This series is going to be dedicated to the use of PyOpenGL for 3D graphics rendering and all of that fun stuff.', 'start': 6.627, 'duration': 7.123}, {'end': 21.634, 'text': 'We are also going to be using Pygame in order to show our PyOpenGL objects here.', 'start': 14.15, 'duration': 7.484}, {'end': 27.977, 'text': "So if you don't have Pygame already, you'll have to get that and you also have to get PyOpenGL.", 'start': 22.154, 'duration': 5.823}, {'end': 30.958, 'text': "I'm also assuming that you already have Python installed.", 'start': 28.777, 'duration': 2.181}], 'summary': 'Python tutorial series on pyopengl for 3d graphics rendering using pygame.', 'duration': 27.673, 'max_score': 3.285, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI3285.jpg'}, {'end': 91.428, 'src': 'embed', 'start': 49.626, 'weight': 2, 'content': [{'end': 56.169, 'text': 'This tutorial will be concerning Python 3.4, though you should be able to do everything shown here in 2.7 as well.', 'start': 49.626, 'duration': 6.543}, {'end': 59.832, 'text': "So you'll need PI OpenGL.", 'start': 58.05, 'duration': 1.782}, {'end': 67.078, 'text': "You can either get it from the website, but if you're on Windows, then I would just go to this website instead, get PI OpenGL.", 'start': 59.872, 'duration': 7.206}, {'end': 69.96, 'text': "Make sure you don't accidentally download Accelerate.", 'start': 67.438, 'duration': 2.522}, {'end': 72.382, 'text': 'You have to have PI OpenGL.', 'start': 70.921, 'duration': 1.461}, {'end': 79.388, 'text': 'You can also get Accelerate if you want, but make sure you get PI OpenGL for the correct version and make sure you match up your bit versions.', 'start': 72.422, 'duration': 6.966}, {'end': 85.064, 'text': 'If you get an error that says, is not a valid Win32 application, you done screwed up.', 'start': 80.5, 'duration': 4.564}, {'end': 87.225, 'text': 'You have to get the right bit version.', 'start': 85.484, 'duration': 1.741}, {'end': 88.686, 'text': 'Next, Pygame.', 'start': 87.646, 'duration': 1.04}, {'end': 91.428, 'text': 'Again, you can download Pygame from here.', 'start': 89.707, 'duration': 1.721}], 'summary': 'Tutorial on python 3.4 and pygame installation with emphasis on pi opengl and avoiding accelerate.', 'duration': 41.802, 'max_score': 49.626, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI49626.jpg'}], 'start': 3.285, 'title': 'Python 3d graphics with pyopengl and pygame', 'summary': 'Focuses on using pyopengl for 3d graphics rendering and incorporating pygame to display the pyopengl objects. it discusses the setup of pyopengl and pygame for creating a simple 3d game, including the necessary installations, imports, and basic code setup.', 'chapters': [{'end': 48.366, 'start': 3.285, 'title': 'Python 3d graphics with pyopengl and pygame', 'summary': 'Focuses on using pyopengl for 3d graphics rendering, while also incorporating pygame to display the pyopengl objects. viewers are advised to have python, pygame, and pyopengl installed to follow along with the tutorial series.', 'duration': 45.081, 'highlights': ['The tutorial series emphasizes the use of PyOpenGL for 3D graphics rendering and Pygame for displaying PyOpenGL objects.', 'Viewers are recommended to have Python, Pygame, and PyOpenGL installed to follow along with the series.', 'The tutorial assumes that viewers already have Python installed.', 'The importance of having Python installed is stressed as the very first requirement for the tutorial series.']}, {'end': 244.265, 'start': 49.626, 'title': 'Setting up pyopengl and pygame for 3d game', 'summary': 'Discusses the setup of pyopengl and pygame for creating a simple 3d game, including the necessary installations, imports, and basic code setup, emphasizing the significance of matching bit versions and addressing errors for smooth functionality.', 'duration': 194.639, 'highlights': ['You need to have PI OpenGL and Pygame installed for setting up PyOpenGL and Pygame for creating a 3D game.', 'Ensure matching bit versions for PI OpenGL and Pygame installations for smooth functionality.', 'Importing Pygame and PyOpenGL, and addressing errors for smooth functionality are crucial for setting up PyOpenGL and Pygame for creating a 3D game.', 'The tutorial will be concerning Python 3.4, though applicable to 2.7 as well, for setting up PyOpenGL and Pygame for creating a 3D game.']}], 'duration': 240.98, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI3285.jpg', 'highlights': ['The tutorial series emphasizes the use of PyOpenGL for 3D graphics rendering and Pygame for displaying PyOpenGL objects.', 'Viewers are recommended to have Python, Pygame, and PyOpenGL installed to follow along with the series.', 'You need to have PI OpenGL and Pygame installed for setting up PyOpenGL and Pygame for creating a 3D game.', 'Ensure matching bit versions for PI OpenGL and Pygame installations for smooth functionality.']}, {'end': 512.972, 'segs': [{'end': 319.267, 'src': 'embed', 'start': 270.385, 'weight': 0, 'content': [{'end': 276.468, 'text': 'So, if you think of it in terms of networking, each little point right that all these links are connected to is called a node.', 'start': 270.385, 'duration': 6.083}, {'end': 280.19, 'text': "So depending on who you're talking to, they might say those various things, but we've got that.", 'start': 276.848, 'duration': 3.342}, {'end': 290.695, 'text': "So how many of these nodes, vertices, or how many individual vertexes do we have? We've got one, two, three, four, five, six, seven, eight.", 'start': 280.23, 'duration': 10.465}, {'end': 294.437, 'text': 'So we have to define all eight of those.', 'start': 291.075, 'duration': 3.362}, {'end': 300.1, 'text': "Then what else do we have? Well, the next major element we have are these lines, right? We've got these connections.", 'start': 294.857, 'duration': 5.243}, {'end': 301.822, 'text': 'to the vertices.', 'start': 300.64, 'duration': 1.182}, {'end': 303.304, 'text': "Wow, that's really messy.", 'start': 302.383, 'duration': 0.921}, {'end': 312.98, 'text': "But we've got 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, And 12.", 'start': 304.486, 'duration': 8.494}, {'end': 314.442, 'text': "So we've got 12 connections right?", 'start': 312.98, 'duration': 1.462}, {'end': 319.267, 'text': 'And each of these connections are very specific connections right?', 'start': 315.383, 'duration': 3.884}], 'summary': 'The network consists of 8 nodes and 12 connections.', 'duration': 48.882, 'max_score': 270.385, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI270385.jpg'}, {'end': 370.299, 'src': 'embed', 'start': 344.758, 'weight': 1, 'content': [{'end': 349.862, 'text': "let's say the connection between 1 and 8 would cause this diagonal line through our cube.", 'start': 344.758, 'duration': 5.104}, {'end': 351.663, 'text': "That's not the connection that we want.", 'start': 350.162, 'duration': 1.501}, {'end': 356.487, 'text': "So it's really important that we understand what the actual connection is between.", 'start': 352.064, 'duration': 4.423}, {'end': 360.67, 'text': "These nodes, because that's what's going to create.", 'start': 358.628, 'duration': 2.042}, {'end': 362.972, 'text': 'our actual object is these connections.', 'start': 360.67, 'duration': 2.302}, {'end': 368.797, 'text': 'and then, finally, the last thing that we have, In our accordance to our object, are the faces.', 'start': 362.972, 'duration': 5.825}, {'end': 370.299, 'text': 'so we have one face.', 'start': 368.797, 'duration': 1.502}], 'summary': 'Understanding connections between nodes is crucial for creating the object. one face is present.', 'duration': 25.541, 'max_score': 344.758, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI344758.jpg'}, {'end': 425.551, 'src': 'embed', 'start': 382.347, 'weight': 2, 'content': [{'end': 392.972, 'text': "But to define, let's say, this orange face here, it's what's inside these nodes and the lines that connect those nodes.", 'start': 382.347, 'duration': 10.625}, {'end': 394.553, 'text': 'That makes the face.', 'start': 393.132, 'duration': 1.421}, {'end': 397.395, 'text': 'So you have to define all of these things for OpenGL.', 'start': 395.173, 'duration': 2.222}, {'end': 401.519, 'text': "okay. so now that we have that understanding, let's close out of this.", 'start': 398.155, 'duration': 3.364}, {'end': 405.303, 'text': "actually, we'll leave this here just in case i want to revisit it for some reason.", 'start': 401.519, 'duration': 3.784}, {'end': 406.985, 'text': "but now we know what we're getting into.", 'start': 405.303, 'duration': 1.682}, {'end': 409.888, 'text': 'so first we have to define what i was calling the vertices.', 'start': 406.985, 'duration': 2.903}, {'end': 417.095, 'text': 'each one is a vertex, or we can call them a node or nodes, but the prop, probably the best name to call it, is vertices.', 'start': 409.888, 'duration': 7.207}, {'end': 420.809, 'text': 'So the vertices, and this is going to be a list.', 'start': 418.348, 'duration': 2.461}, {'end': 422.97, 'text': "Well, it's actually a tuple of a bunch of tuples.", 'start': 420.929, 'duration': 2.041}, {'end': 425.551, 'text': "So we've got this big old thing.", 'start': 424.131, 'duration': 1.42}], 'summary': 'Defining vertices in opengl involves connecting nodes to create shapes. vertices are defined as a list of tuples.', 'duration': 43.204, 'max_score': 382.347, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI382347.jpg'}, {'end': 476.327, 'src': 'embed', 'start': 446.843, 'weight': 5, 'content': [{'end': 449.646, 'text': "Okay, so we've got 1, 2, 3 units.", 'start': 446.843, 'duration': 2.803}, {'end': 454.269, 'text': 'Okay, so the location of these nodes is going to be in units.', 'start': 449.786, 'duration': 4.483}, {'end': 459.453, 'text': "So let's say the first node we're going to make is 1, negative 1.", 'start': 454.389, 'duration': 5.064}, {'end': 461.235, 'text': 'and negative 1.', 'start': 459.453, 'duration': 1.782}, {'end': 468.361, 'text': "Now it's important that you keep all of these in the identical order as you're going to connect them later on.", 'start': 461.235, 'duration': 7.126}, {'end': 476.327, 'text': "So this would be node 1, and then we're going to keep going and then actually, according to OpenGL, this is in theory kind of like node 0,", 'start': 468.401, 'duration': 7.926}], 'summary': "Transcript: discussing 3 units' location for nodes in opengl.", 'duration': 29.484, 'max_score': 446.843, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI446843.jpg'}], 'start': 244.586, 'title': 'Graph theory and opengl vertices', 'summary': 'Covers graph theory basics with 8 vertices and 12 connections, stressing the significance of node connections. it also discusses defining vertices and faces for opengl, highlighting the importance of understanding node structures and faces within the framework. additionally, it explores creating 8 vertices for visualization, emphasizing the location of nodes in units and the significance of maintaining order for connections.', 'chapters': [{'end': 362.972, 'start': 244.586, 'title': 'Graph theory basics', 'summary': 'Introduces the concept of vertices and connections in graph theory, with a total of 8 vertices and 12 connections explained in detail, emphasizing the importance of understanding the specific connections between nodes in creating the actual object.', 'duration': 118.386, 'highlights': ['The chapter discusses the concept of vertices in graph theory, with a total of 8 vertices identified within the context of the example.', 'A total of 12 connections between the vertices are emphasized, highlighting the significance of understanding the specific connections between nodes in creating the actual object.']}, {'end': 425.551, 'start': 362.972, 'title': 'Defining vertices and faces for opengl', 'summary': 'Discusses the process of defining vertices and faces for opengl, emphasizing the importance of understanding nodes and lines and the structure of the vertices. it also mentions the concept of faces and their definition within the framework.', 'duration': 62.579, 'highlights': ['The vertices, also known as nodes, are crucial for defining the structure for OpenGL and are represented by a list of tuples.', 'Understanding the composition of faces involves comprehending the nodes and lines connecting them, essential for defining the faces in OpenGL.', 'The chapter emphasizes the significance of grasping the components that make up the faces and vertices for effectively working with OpenGL.']}, {'end': 512.972, 'start': 425.611, 'title': 'Creating vertices for visualization', 'summary': 'Explains the process of creating eight vertices for visualization, with the location of the nodes described in units and the importance of maintaining order for later connections.', 'duration': 87.361, 'highlights': ['The chapter discusses the process of creating eight vertices for visualization, emphasizing the importance of keeping them in the identical order for future connections.', 'The location of the nodes is described in units, and specific coordinates such as 1, -1 and 1, 1, -1 are mentioned.', 'The speaker advises those who may be feeling lost to wait for the visualization to better understand the spatial location of the nodes.']}], 'duration': 268.386, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI244586.jpg', 'highlights': ['The chapter discusses the concept of vertices in graph theory, with a total of 8 vertices identified within the context of the example.', 'A total of 12 connections between the vertices are emphasized, highlighting the significance of understanding the specific connections between nodes in creating the actual object.', 'The vertices, also known as nodes, are crucial for defining the structure for OpenGL and are represented by a list of tuples.', 'Understanding the composition of faces involves comprehending the nodes and lines connecting them, essential for defining the faces in OpenGL.', 'The chapter discusses the process of creating eight vertices for visualization, emphasizing the importance of keeping them in the identical order for future connections.', 'The location of the nodes is described in units, and specific coordinates such as 1, -1 and 1, 1, -1 are mentioned.']}, {'end': 953.028, 'segs': [{'end': 597.061, 'src': 'embed', 'start': 512.972, 'weight': 0, 'content': [{'end': 520.717, 'text': "this will be shown visually very soon and you'll be able to change these variables a little bit and then you'll see visually the difference it makes,", 'start': 512.972, 'duration': 7.745}, {'end': 521.558, 'text': 'and that might help you.', 'start': 520.717, 'duration': 0.841}, {'end': 522.139, 'text': 'uh.', 'start': 521.558, 'duration': 0.581}, {'end': 528.384, 'text': "quite a bit so anyways negative one one negative one then we've got the next one would be uh.", 'start': 522.139, 'duration': 6.245}, {'end': 536.15, 'text': "negative one negative one negative one if you'll notice as well we basically only change one thing each time uh.", 'start': 528.384, 'duration': 7.766}, {'end': 540.087, 'text': 'So keep that in mind as well.', 'start': 538.166, 'duration': 1.921}, {'end': 545.208, 'text': "So when you're writing this yourself, there should really be only one major change right from node to node.", 'start': 540.147, 'duration': 5.061}, {'end': 547.689, 'text': "Okay, so we've got negative one, negative one, negative one.", 'start': 545.748, 'duration': 1.941}, {'end': 555.971, 'text': 'Then we would have one, negative one, one, then one, one, one.', 'start': 548.749, 'duration': 7.222}, {'end': 561.533, 'text': "Then we're gonna have, and let me fix this negative here.", 'start': 555.991, 'duration': 5.542}, {'end': 562.833, 'text': "I don't want that space.", 'start': 561.653, 'duration': 1.18}, {'end': 564.094, 'text': "And then we'll have.", 'start': 562.993, 'duration': 1.101}, {'end': 570.37, 'text': 'Negative 1, negative 1, 1.', 'start': 567.449, 'duration': 2.921}, {'end': 574.114, 'text': 'And there we actually ended up having to change 2.', 'start': 570.371, 'duration': 3.743}, {'end': 576.395, 'text': 'And then finally, negative 1, 1, and 1.', 'start': 574.114, 'duration': 2.281}, {'end': 579.817, 'text': 'Okay? So those are our vertices.', 'start': 576.395, 'duration': 3.422}, {'end': 583.14, 'text': "Hopefully I did those right, but we'll find out really soon when we visualize this.", 'start': 579.857, 'duration': 3.283}, {'end': 587.634, 'text': 'So then when you have vertices, you also have to define edges.', 'start': 583.871, 'duration': 3.763}, {'end': 597.061, 'text': "So edges, and the edges are those lines, right? So this is an edge, right? This thing right here, that's an edge.", 'start': 588.294, 'duration': 8.767}], 'summary': 'Visualizing and changing variables in graph nodes, focusing on one major change at a time.', 'duration': 84.089, 'max_score': 512.972, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI512972.jpg'}, {'end': 787.367, 'src': 'embed', 'start': 760.701, 'weight': 5, 'content': [{'end': 769.344, 'text': "so next, once we've made these, um, these initial parameters, so to speak of what makes up a cube.", 'start': 760.701, 'duration': 8.643}, {'end': 773.87, 'text': "Well, first of all, what are we missing? We haven't defined faces yet.", 'start': 770.806, 'duration': 3.064}, {'end': 778.736, 'text': "We're not going to define faces in this video just because it just adds too much.", 'start': 773.93, 'duration': 4.806}, {'end': 780.939, 'text': "We're already kind of deep into a video.", 'start': 779.477, 'duration': 1.462}, {'end': 787.367, 'text': "So we'll define faces later, but we've got the vertices and we've got the connections.", 'start': 782.642, 'duration': 4.725}], 'summary': 'Initial parameters set for cube, vertices and connections defined', 'duration': 26.666, 'max_score': 760.701, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI760701.jpg'}, {'end': 907.144, 'src': 'embed', 'start': 874.589, 'weight': 4, 'content': [{'end': 878.252, 'text': 'And then what we pass through is vertices.', 'start': 874.589, 'duration': 3.663}, {'end': 894.155, 'text': "with the element vertex, right? So the vertices vertex and that's so this number and then that's corresponding to the number vertex in this list.", 'start': 883.308, 'duration': 10.847}, {'end': 897.437, 'text': "It's drawing them and it's going to connect them.", 'start': 894.696, 'duration': 2.741}, {'end': 898.938, 'text': "It's just going to connect the dots.", 'start': 897.678, 'duration': 1.26}, {'end': 907.144, 'text': 'Now, if you are uncomfortable with, say, for example, this function here GL vertex 3FV what does even that?', 'start': 899.059, 'duration': 8.085}], 'summary': 'Explanation of vertex connection in graphical drawing.', 'duration': 32.555, 'max_score': 874.589, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI874589.jpg'}], 'start': 512.972, 'title': 'Visualizing variable changes and defining opengl code', 'summary': 'Focuses on visually representing variable changes and making one major change per node, emphasizing impact understanding. it also covers defining vertices and edges for a cube, including the total number of edges and connections for each node, and introduces the syntax for writing opengl code to create lines connecting the vertices.', 'chapters': [{'end': 570.37, 'start': 512.972, 'title': 'Visual variable changes', 'summary': 'Discusses visually representing variable changes and emphasizes making only one major change right from node to node, which helps in understanding the impact of the changes.', 'duration': 57.398, 'highlights': ['The chapter emphasizes making only one major change right from node to node, aiding in better understanding the impact of the changes.', 'The visual representation helps in understanding the difference made by changing variables.', 'The ability to visually see the difference made by changing variables can be quite helpful.']}, {'end': 953.028, 'start': 570.371, 'title': 'Defining vertices, edges, and opengl code', 'summary': 'Explains the process of defining vertices and edges for a cube, including the total number of edges and connections for each node, and also introduces the syntax for writing opengl code to create lines connecting the vertices.', 'duration': 382.657, 'highlights': ['The chapter introduces the process of defining vertices and edges for a cube, along with the total number of edges and connections for each node. The chapter explains the process of defining vertices and edges for a cube, including the total number of edges and connections for each node.', 'The speaker explains the syntax for writing OpenGL code to create lines connecting the vertices and provides an example of using GL vertex 3FV function. The chapter introduces the syntax for writing OpenGL code to create lines connecting the vertices and provides an example of using the GL vertex 3FV function.', "The speaker mentions the need to define faces later, as it adds complexity, and introduces the function 'define faces' for the cube. The speaker mentions the need to define faces later and introduces the function 'define faces' for the cube."]}], 'duration': 440.056, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI512972.jpg', 'highlights': ['The visual representation helps in understanding the difference made by changing variables.', 'The chapter emphasizes making only one major change right from node to node, aiding in better understanding the impact of the changes.', 'The ability to visually see the difference made by changing variables can be quite helpful.', 'The chapter introduces the process of defining vertices and edges for a cube, along with the total number of edges and connections for each node.', 'The speaker explains the syntax for writing OpenGL code to create lines connecting the vertices and provides an example of using the GL vertex 3FV function.', "The speaker mentions the need to define faces later, as it adds complexity, and introduces the function 'define faces' for the cube."]}, {'end': 1225.254, 'segs': [{'end': 983.227, 'src': 'embed', 'start': 954.353, 'weight': 0, 'content': [{'end': 956.236, 'text': 'uh, show up okay.', 'start': 954.353, 'duration': 1.883}, {'end': 963.388, 'text': "so now we'll go ahead and define main and we're going to need to run pygame.init.", 'start': 956.236, 'duration': 7.152}, {'end': 965.531, 'text': 'that is the initialization function for pygame.', 'start': 963.388, 'duration': 2.143}, {'end': 969.036, 'text': "we have to always call that if we're going to be using pygame.", 'start': 965.531, 'duration': 3.505}, {'end': 975.621, 'text': "Then we're going to go ahead and set a constant for our display and that's going to be 800 by 600..", 'start': 969.557, 'duration': 6.064}, {'end': 978.884, 'text': "And then we're going to go ahead and set the display as we have to.", 'start': 975.621, 'duration': 3.263}, {'end': 983.227, 'text': 'So it would be pygame.display.set underscore mode.', 'start': 979.224, 'duration': 4.003}], 'summary': 'Setting up a pygame display at 800x600 resolution.', 'duration': 28.874, 'max_score': 954.353, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI954353.jpg'}, {'end': 1030.474, 'src': 'embed', 'start': 1001.818, 'weight': 2, 'content': [{'end': 1005.78, 'text': "And so this is obviously necessary if you're familiar with, say, Matplotlib.", 'start': 1001.818, 'duration': 3.962}, {'end': 1012.504, 'text': 'You have to notify Matplotlib before you start throwing 3D graphics at it, you know, before you start throwing a Z axis.', 'start': 1006.1, 'duration': 6.404}, {'end': 1014.725, 'text': 'You have to tell it, like, by the way, here, this is coming.', 'start': 1012.584, 'duration': 2.141}, {'end': 1016.166, 'text': "And so it's no different here.", 'start': 1015.225, 'duration': 0.941}, {'end': 1022.77, 'text': "So we'll have to, in all caps now, as this is where we specify a parameter, or I'm sorry, constants for OpenGL.", 'start': 1016.526, 'duration': 6.244}, {'end': 1030.474, 'text': "So we're gonna first specify a double buff, and then we're gonna use the pipe, and then we're gonna say OpenGL.", 'start': 1023.431, 'duration': 7.043}], 'summary': 'Notify matplotlib before using 3d graphics, specify parameters for opengl.', 'duration': 28.656, 'max_score': 1001.818, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1001818.jpg'}, {'end': 1072.153, 'src': 'embed', 'start': 1041.767, 'weight': 3, 'content': [{'end': 1046.772, 'text': "And this is to kind of work alongside your monitor's refresh rate.", 'start': 1041.767, 'duration': 5.005}, {'end': 1050.417, 'text': "And then finally, OpenGL, we're just specifying, hey, we're going to use OpenGL.", 'start': 1047.493, 'duration': 2.924}, {'end': 1058.167, 'text': 'So that is how to set the display for OpenGL.', 'start': 1051.764, 'duration': 6.403}, {'end': 1064.749, 'text': "And now we're going to set a little bit of some of our OpenGL functions here basically, or set some parameters.", 'start': 1058.587, 'duration': 6.162}, {'end': 1068.791, 'text': "So the first one we're gonna use is gluPerspective.", 'start': 1065.189, 'duration': 3.602}, {'end': 1072.153, 'text': 'And this is going to be a few things.', 'start': 1069.811, 'duration': 2.342}], 'summary': 'Configuring display for opengl with gluperspective function.', 'duration': 30.386, 'max_score': 1041.767, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1041767.jpg'}, {'end': 1178.273, 'src': 'embed', 'start': 1148.697, 'weight': 5, 'content': [{'end': 1150.718, 'text': "So for now we're going to set them pretty wide.", 'start': 1148.697, 'duration': 2.021}, {'end': 1153.519, 'text': "A lot of times you'll see people use like 0.1.", 'start': 1151.038, 'duration': 2.481}, {'end': 1157.361, 'text': "So it never goes away until you've like, in theory, passed it on the screen.", 'start': 1153.519, 'duration': 3.842}, {'end': 1160.763, 'text': "And then you'll see usually a pretty large number here.", 'start': 1157.881, 'duration': 2.882}, {'end': 1161.443, 'text': "We'll just put 50.0 for now.", 'start': 1160.843, 'duration': 0.6}, {'end': 1178.273, 'text': "Then you've got glTranslateF and this one is just x, y, z parameters and this is you kind of moving about the object, so to speak.", 'start': 1164.204, 'duration': 14.069}], 'summary': 'Setting wide parameters at 0.1 and 50.0 for gltranslatef in moving about the object.', 'duration': 29.576, 'max_score': 1148.697, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1148697.jpg'}, {'end': 1232.059, 'src': 'embed', 'start': 1204.161, 'weight': 6, 'content': [{'end': 1206.422, 'text': "um, the other ones we'll cover in a little bit.", 'start': 1204.161, 'duration': 2.261}, {'end': 1207.382, 'text': "so let's translate.", 'start': 1206.422, 'duration': 0.96}, {'end': 1210.123, 'text': 'and then you have another one which is gl.', 'start': 1207.382, 'duration': 2.741}, {'end': 1218.062, 'text': "uh, rotate f, And then this one, you've got degrees x, y and z.", 'start': 1210.123, 'duration': 7.939}, {'end': 1219.864, 'text': "And we'll just leave these all blank for now.", 'start': 1218.062, 'duration': 1.802}, {'end': 1221.305, 'text': "We'll just put 20 in there for now.", 'start': 1219.904, 'duration': 1.401}, {'end': 1222.666, 'text': "That won't really actually do anything.", 'start': 1221.345, 'duration': 1.321}, {'end': 1225.254, 'text': "We'll just put 0, 0, 0, 0.", 'start': 1222.686, 'duration': 2.568}, {'end': 1232.059, 'text': "So now we are going to call while true and then we'll do a simple event loop.", 'start': 1225.254, 'duration': 6.805}], 'summary': 'Transcript covers translation, rotation, and event loop implementation.', 'duration': 27.898, 'max_score': 1204.161, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1204161.jpg'}], 'start': 954.353, 'title': 'Pygame display initialization and opengl settings', 'summary': 'Covers initializing pygame display using pygame.init and setting display parameters to 800x600. it also explains setting the display for opengl, including double buffer and opengl, and setting parameters like field of view and aspect ratio, along with opengl functions gltranslatef and glrotatef.', 'chapters': [{'end': 1016.166, 'start': 954.353, 'title': 'Initializing pygame display and setting parameters', 'summary': 'Explains the process of initializing pygame display by calling pygame.init and setting the display parameters to 800 by 600 using pygame.display.set_mode, and notifying the display for opengl.', 'duration': 61.813, 'highlights': ['Initializing Pygame using pygame.init is necessary before using Pygame. pygame.init', 'Setting the display parameters to 800 by 600 using pygame.display.set_mode. Display parameters: 800 by 600', 'Notifying the display for OpenGL, similar to notifying Matplotlib for 3D graphics. Notification for OpenGL']}, {'end': 1225.254, 'start': 1016.526, 'title': 'Setting display for opengl and opengl functions', 'summary': 'Explains how to set the display for opengl, including specifying double buffer and opengl, and setting parameters such as field of view, aspect ratio, and clipping planes, alongside functions like gltranslatef and glrotatef.', 'duration': 208.728, 'highlights': ['Setting the display for OpenGL by specifying double buffer and OpenGL Explains the use of double buffer and specifying OpenGL for setting the display.', 'Setting parameters such as field of view, aspect ratio, and clipping planes Describes the parameters for gluPerspective, including field of view in degrees, aspect ratio, and near and far clipping planes.', 'Explanation of glTranslateF function for moving about the object Describes the parameters for glTranslateF, including x, y, z parameters for moving about the object.', 'Introduction to glRotateF function with degrees x, y, and z parameters Introduces the glRotateF function and its parameters for degrees x, y, and z for rotation.']}], 'duration': 270.901, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI954353.jpg', 'highlights': ['Initializing Pygame using pygame.init is necessary before using Pygame. pygame.init', 'Setting the display parameters to 800 by 600 using pygame.display.set_mode. Display parameters: 800 by 600', 'Notifying the display for OpenGL, similar to notifying Matplotlib for 3D graphics. Notification for OpenGL', 'Setting the display for OpenGL by specifying double buffer and OpenGL Explains the use of double buffer and specifying OpenGL for setting the display.', 'Setting parameters such as field of view, aspect ratio, and clipping planes Describes the parameters for gluPerspective, including field of view in degrees, aspect ratio, and near and far clipping planes.', 'Explanation of glTranslateF function for moving about the object Describes the parameters for glTranslateF, including x, y, z parameters for moving about the object.', 'Introduction to glRotateF function with degrees x, y, and z parameters Introduces the glRotateF function and its parameters for degrees x, y, and z for rotation.']}, {'end': 1631.377, 'segs': [{'end': 1251.332, 'src': 'embed', 'start': 1225.254, 'weight': 0, 'content': [{'end': 1232.059, 'text': "So now we are going to call while true and then we'll do a simple event loop.", 'start': 1225.254, 'duration': 6.805}, {'end': 1236.523, 'text': "So we'll say for event in pygame.event.get.", 'start': 1232.079, 'duration': 4.444}, {'end': 1245.71, 'text': "What do we want to do? We're going to say if event.type is a pygame.quit event, So this is a simple Pygame code.", 'start': 1237.043, 'duration': 8.667}, {'end': 1250.032, 'text': "If you want to know more about Pygame code, you'll have to check out the Pygame series.", 'start': 1245.75, 'duration': 4.282}, {'end': 1251.332, 'text': "I'll put a link to it in the description.", 'start': 1250.052, 'duration': 1.28}], 'summary': 'Using a simple event loop in pygame code.', 'duration': 26.078, 'max_score': 1225.254, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1225254.jpg'}, {'end': 1324.98, 'src': 'embed', 'start': 1293.898, 'weight': 2, 'content': [{'end': 1296.6, 'text': 'because Pygame is just showing you frames right? Between each frame.', 'start': 1293.898, 'duration': 2.702}, {'end': 1297.08, 'text': 'what do we do??', 'start': 1296.6, 'duration': 0.48}, {'end': 1301.443, 'text': 'We clear the frame with a fill, either fill white, whatever.', 'start': 1297.18, 'duration': 4.263}, {'end': 1304.884, 'text': 'Or your image, and then we draw on top of it.', 'start': 1302.263, 'duration': 2.621}, {'end': 1309.765, 'text': "Otherwise you'd get like this really long, like everything would stay there and it would be really heavy on your graphics.", 'start': 1304.884, 'duration': 4.881}, {'end': 1311.285, 'text': 'So we do a GL clear.', 'start': 1309.765, 'duration': 1.52}, {'end': 1319.547, 'text': "then in all caps We do GL underscore color, underscore buffer, underscore bit, and then we'll do a pipe and then we'll do GL underscore depth,", 'start': 1311.285, 'duration': 8.262}, {'end': 1324.98, 'text': 'underscore buffer, underscore bit, and These are two constants here.', 'start': 1319.547, 'duration': 5.433}], 'summary': 'In pygame, clearing frames is essential to prevent heavy graphics. gl clear and gl color buffer bit are used for this.', 'duration': 31.082, 'max_score': 1293.898, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1293898.jpg'}, {'end': 1363.856, 'src': 'embed', 'start': 1336.267, 'weight': 1, 'content': [{'end': 1339.67, 'text': "So we do cube with a capital C, because that's what we did.", 'start': 1336.267, 'duration': 3.403}, {'end': 1340.61, 'text': 'And then.', 'start': 1340.25, 'duration': 0.36}, {'end': 1349.433, 'text': "That brings up the code into OpenGL, and then we're going to go ahead and use pygame.display.flip.", 'start': 1342.071, 'duration': 7.362}, {'end': 1351.333, 'text': "In the past, we've always used update.", 'start': 1349.833, 'duration': 1.5}, {'end': 1354.674, 'text': "For whatever reason, when I use update, it doesn't quite work here.", 'start': 1351.433, 'duration': 3.241}, {'end': 1356.275, 'text': 'Flip is the only one that works.', 'start': 1355.034, 'duration': 1.241}, {'end': 1363.856, 'text': "I'm under the impression that the outcome is completely identical as long as there are no parameters in the parentheses.", 'start': 1356.835, 'duration': 7.021}], 'summary': 'Using pygame.display.flip instead of update in opengl code for cube. flip works better.', 'duration': 27.589, 'max_score': 1336.267, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1336267.jpg'}, {'end': 1405.989, 'src': 'heatmap', 'start': 1371.479, 'weight': 0.759, 'content': [{'end': 1378.922, 'text': "And then, since we haven't called any sort of frames per second here, we'll just use pygame.time.wait 10.", 'start': 1371.479, 'duration': 7.443}, {'end': 1380.723, 'text': "That's basically 10 milliseconds.", 'start': 1378.922, 'duration': 1.801}, {'end': 1382.724, 'text': "And that's it.", 'start': 1381.624, 'duration': 1.1}, {'end': 1384.825, 'text': "So now we've got our main function here.", 'start': 1382.784, 'duration': 2.041}, {'end': 1387.447, 'text': "So then we'll just call main.", 'start': 1385.306, 'duration': 2.141}, {'end': 1391.529, 'text': "We'll press F5, save it, yes, cool.", 'start': 1388.787, 'duration': 2.742}, {'end': 1395.342, 'text': 'And boom, there is our lovely cube.', 'start': 1392.66, 'duration': 2.682}, {'end': 1402.347, 'text': "Now, right now, it's just like some lines, right? It's like, well, shoot, we could have drawn that in Pygame in a 2D.", 'start': 1395.722, 'duration': 6.625}, {'end': 1405.989, 'text': "What's so special? What is so special is that it's real 3D.", 'start': 1402.807, 'duration': 3.182}], 'summary': 'Using pygame, a 3d cube is displayed after setting frames per second to 10 milliseconds.', 'duration': 34.51, 'max_score': 1371.479, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1371479.jpg'}, {'end': 1476.028, 'src': 'embed', 'start': 1429.634, 'weight': 3, 'content': [{'end': 1436.043, 'text': 'Whereas in pseudo 3D, or what is called sometimes 2.5D, you only have that one perspective.', 'start': 1429.634, 'duration': 6.409}, {'end': 1439.104, 'text': "It's like taking a picture with a camera.", 'start': 1436.063, 'duration': 3.041}, {'end': 1447.187, 'text': "That's a 2D picture because when you take that picture, you can't look at that picture and move the picture like this and see a different perspective.", 'start': 1439.404, 'duration': 7.783}, {'end': 1447.807, 'text': "You can't.", 'start': 1447.467, 'duration': 0.34}, {'end': 1450.648, 'text': "It's just a 2D representation of that exact perspective.", 'start': 1447.867, 'duration': 2.781}, {'end': 1452.648, 'text': "And that's no different than any other 2D.", 'start': 1451.028, 'duration': 1.62}, {'end': 1459.49, 'text': "Whereas with 3D, you can move around this representation that you've created.", 'start': 1452.688, 'duration': 6.802}, {'end': 1461.192, 'text': "So that's the major difference.", 'start': 1459.91, 'duration': 1.282}, {'end': 1463.094, 'text': 'So in here.', 'start': 1461.692, 'duration': 1.402}, {'end': 1467.018, 'text': 'the question is well, why do I care?', 'start': 1463.094, 'duration': 3.924}, {'end': 1471.383, 'text': "Why does it matter that this is in true 3D when I can't even move around it?", 'start': 1467.198, 'duration': 4.185}, {'end': 1474.126, 'text': 'Well, what we can do is really simple stuff.', 'start': 1471.423, 'duration': 2.703}, {'end': 1476.028, 'text': "So here we've got a rotate function.", 'start': 1474.466, 'duration': 1.562}], 'summary': 'Pseudo 3d has one perspective, unlike true 3d which allows movement and rotation.', 'duration': 46.394, 'max_score': 1429.634, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1429634.jpg'}, {'end': 1504.599, 'src': 'heatmap', 'start': 1476.849, 'weight': 1, 'content': [{'end': 1486.395, 'text': "We'll start it off with no rotate, but we can copy this, copy that rotate function, and then right around here, basically, we'll modify it.", 'start': 1476.849, 'duration': 9.546}, {'end': 1492.158, 'text': "So we'll say one degree here, and then we'll move x three, and then we'll add one and one here.", 'start': 1486.555, 'duration': 5.603}, {'end': 1495.24, 'text': "And now we'll run this.", 'start': 1494.419, 'duration': 0.821}, {'end': 1500.843, 'text': "And now you have a rotating cube, and it's in 3D.", 'start': 1498.001, 'duration': 2.842}, {'end': 1504.599, 'text': 'ok. so that is why 3d matters now.', 'start': 1501.758, 'duration': 2.841}], 'summary': 'Code creates a rotating 3d cube, demonstrating the significance of 3d.', 'duration': 27.75, 'max_score': 1476.849, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1476849.jpg'}, {'end': 1577.872, 'src': 'embed', 'start': 1546.223, 'weight': 5, 'content': [{'end': 1550.888, 'text': 'So this can be kind of problematic, especially as you learn more and more about OpenGL,', 'start': 1546.223, 'duration': 4.665}, {'end': 1555.713, 'text': "because you'll start wondering like Why do I need this such and such function?", 'start': 1550.888, 'duration': 4.825}, {'end': 1556.673, 'text': "that's in this example?", 'start': 1555.713, 'duration': 0.96}, {'end': 1560.677, 'text': "And you'll find out that you don't anymore, because that's part of old OpenGL.", 'start': 1556.733, 'duration': 3.944}, {'end': 1567.002, 'text': "And there's also like 15 different ways to do one thing, right? So just keep that in mind.", 'start': 1561.638, 'duration': 5.364}, {'end': 1569.445, 'text': 'Some of the code that I might show you guys will be legacy.', 'start': 1567.042, 'duration': 2.403}, {'end': 1577.872, 'text': "And it's fine, right? But just keep in mind that that's what's going to happen because you're using something that's fully backwards compatible.", 'start': 1569.625, 'duration': 8.247}], 'summary': 'Learning opengl may involve dealing with legacy code and multiple ways to do one thing.', 'duration': 31.649, 'max_score': 1546.223, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1546223.jpg'}], 'start': 1225.254, 'title': 'Pygame event loop and opengl in 3d graphics', 'summary': 'Covers the implementation of a pygame event loop for handling quit events and the use of opengl clearing functions, and explains the concept of real 3d graphics using opengl, highlighting the significance of true 3d for interactive manipulation and the challenges of learning and utilizing opengl.', 'chapters': [{'end': 1382.724, 'start': 1225.254, 'title': 'Pygame event loop and opengl clearing', 'summary': 'Covers the implementation of a pygame event loop for handling quit events and the use of opengl clearing functions to manage frame rendering, emphasizing the necessity of using pygame.display.flip over pygame.display.update for proper functionality.', 'duration': 157.47, 'highlights': ['The tutorial explains how to implement a Pygame event loop to handle the pygame.quit event, which uninitializes Pygame and quits the program.', 'It demonstrates the necessity of clearing the frame using GL clear and GL color buffer bit to manage frame rendering in Pygame, preventing heavy graphics and ensuring proper frame display.', 'The chapter emphasizes the use of pygame.display.flip over pygame.display.update for proper functionality, as update does not work in certain cases, highlighting the importance of choosing the correct method for frame updates.']}, {'end': 1631.377, 'start': 1382.784, 'title': 'Understanding 3d graphics with opengl', 'summary': 'Explains the concept of real 3d graphics using opengl, highlighting the difference between pseudo 3d and 3d, the significance of true 3d for interactive manipulation, and the challenges of learning and utilizing opengl.', 'duration': 248.593, 'highlights': ['The significance of true 3D for interactive manipulation is explained, with the ability to move around the object and observe it from different perspectives.', 'The difference between pseudo 3D and 3D is highlighted, emphasizing the limitations of pseudo 3D in providing only one perspective compared to the interactive nature of 3D graphics.', 'The challenge of learning and using OpenGL is discussed, including the complexity of understanding legacy OpenGL, multiple ways of performing tasks, and the obfuscated nature of examples found online.']}], 'duration': 406.123, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/R4n4NyDG2hI/pics/R4n4NyDG2hI1225254.jpg', 'highlights': ['The tutorial explains how to implement a Pygame event loop to handle the pygame.quit event, which uninitializes Pygame and quits the program.', 'The chapter emphasizes the use of pygame.display.flip over pygame.display.update for proper functionality, as update does not work in certain cases, highlighting the importance of choosing the correct method for frame updates.', 'It demonstrates the necessity of clearing the frame using GL clear and GL color buffer bit to manage frame rendering in Pygame, preventing heavy graphics and ensuring proper frame display.', 'The significance of true 3D for interactive manipulation is explained, with the ability to move around the object and observe it from different perspectives.', 'The difference between pseudo 3D and 3D is highlighted, emphasizing the limitations of pseudo 3D in providing only one perspective compared to the interactive nature of 3D graphics.', 'The challenge of learning and using OpenGL is discussed, including the complexity of understanding legacy OpenGL, multiple ways of performing tasks, and the obfuscated nature of examples found online.']}], 'highlights': ['The tutorial series emphasizes the use of PyOpenGL for 3D graphics rendering and Pygame for displaying PyOpenGL objects.', 'The chapter discusses the concept of vertices in graph theory, with a total of 8 vertices identified within the context of the example.', 'The visual representation helps in understanding the difference made by changing variables.', 'Initializing Pygame using pygame.init is necessary before using Pygame. pygame.init', 'The tutorial explains how to implement a Pygame event loop to handle the pygame.quit event, which uninitializes Pygame and quits the program.']}