OpenGL with PyOpenGL Python and PyGame p.2 - Coloring Surfaces

preview_player
Показать описание
In this tutorial, we learn some more of the 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, adding colors to the surfaces. We also learn a bit more about how OpenGL works on the back-end.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

FYI (and for others that where equally as confused as I was) with the vertices you have defined node 7 and 8 on the figure you displayed are actually swapped. I know this because I mapped the cube in paint, and the fact that the two squares had a different pattern greatly confused me until I realized it was because of the vertices definition. *This happened because you broke the rule of only changing 1 of the 3 values at the same time in the previous video* :P

The pattern after the definition is actually
1-2
4-3
and second square is
5-6
7-8

Simply changing node 7 and 8 values should make the same pattern, but that also means changing all the edges. Or you could alternatively just not give a crap that they are listed in the wrong order.

MrLorgy
Автор

Hello, sorry I wanna ask. I am still confused why for the color, you declare in 12 times, while the surfaces only 6. Thank you

ahmadnurriza
Автор

How could I also rotate my cude around another axis? So, simultaneously the cube will be rotated around its axis and around another relative axis. In case you need I can send the code

papath
Автор

how do you make sure that the two triangles have only one colour? Like..One colour per surface?

chinmayapurohit
Автор

Would you be able to recommend a way to put sprites for a HUD in OpenGL mode? 

profskitty
Автор

I'm from 7 years in the future ... you can use color names as a string now instead of using values - "red" "blue" "green" e.t.c.

ricks
Автор

for (color, surface) in zip(colors, surfaces):

LionKimbro
Автор

does it makes sense to watch this in 2021?

ico-theredstonesurgeon
Автор

what does x=0 and x+=1 mean? what do they related to?

fa
welcome to shbcf.ru