Pygame Python Game Development Tutorial 95 OpenGL Display Cube

preview_player
Показать описание
Abstract video content

hello everybody welcome to another pie game with python and pie opengl tutorial

video from $FULLPHONENUM sent to export bucking new boston in the last video

we're working on was our glu perspective and now we're ready to modify basically

we're where we start sort of in relation to our cube so we're going to use GL

trans translate f and g 0 translate officially multiplies the current meet

tricks by a translation matrix so what it really ties is it lets you kind of

move about the object and the parameters that you pastor here are just XYZ and

you'll see what i mean in a moment about moving about the object if you know

syndrome again so we're just going to pass through 0.0 0.0 and then we'll pass

a negative 5 . sir

ok so what this means is like we can pass through values here again just like

Jill you perspective and just like the importance of order here room i will

show you once we have a coupon screen you can actually have kind of fun time

editing some of this stuff because opengl is pretty much going to draw

whatever you throw at it so sometimes you can draw some pretty funny looking

things anyway

this will be our basically negative 5 means we're going to take five unit

steps back and from our cube otherwise we don't you negative 5rq will be the

screen but and we'll have no idea the cube is even there

uh-huh but it that so we take negative 5y august if you took negative five

steps back you would actually take five steps forward so we're actually going to

take five states back and 45 units back and then we'll see your actual cute

so the next thing that we're going to cover is rotate so we can also do GL

rotate F and this is basically this actually takes four parameters this

takes the angle then XYZ and so the angle will just say 20 degrees and then

X will just have zero and then 0n0 XYZ all zeros but as you modify these that's

what's going to basically like tilt things so i'll show you what i mean by

that probably again once we render the cube so let's work on actually rendering

the cube so we have a WoW true and this is where we throw in our typical pygame

event right so for events in my game . event die get what do we want to do

sometimes we print event here but we won't

first we're going to say if event . type equals PI game . with what do we want to

do we're going to run

whoops pygame . quit and then finally a quit so this allows us to actually X out

of the screen and and that'll be it for now and now what we want to do is form

and we don't want that for loop for now so it's basically going to allow so just

leave one only if instead of like having like exit out very messy so now what we

want to do is we're going to do a will do will run a GL clear this basically

acts like our fill statement used to so before we would say Phil white and it

would fill the screen white and we would draw everything on top of the screen

again

GL clear clears the view because um if you draw like in pygame it was ok

because the way renders but in OpenGL it's it

things were a little differently if you draw everything in the back and it's

still going to render it in the foreground because why because more

matters than what can you can view right you need to get a little change of

perspective so it's always going to have that stuff in the back end so you kind

of have to keep that in mind so GL clear and then here we put in some some

serious parameters so turn your caps caps button here

GL color underscore buffer underscore bit pipe then geo underscored depth

underscore buffer underscore bit some-some opengl Constance basically

then after we clear the screen

we're going to go ahead and run draw cube so draw underscore cube and then

we'll run by game . display . update and then we don't really have a to-do frames

per second but we can do instead is use dupuy game . time . wait 10 then we can

run main and we've written a lot of code before we get to bug check so we'll see

how this pans out for us but let's go ahead and save and run that see what see

what happens

goe a typo depth buffer bit depth here we go

yep bit oh my goodness under cased all good all right

ok another problem for edge in edges

oops we need to call that edges so this list of edges the edges four edges

dragon

a lot of errors folks oh my goodness

Burt is not defined

alright vertex one more time one more time

oh my could be ok Biden has been ok let's try it let's we'll pass through

flip display up to a full it mom

ok so like I said that was quite the challenge so this is our obviously our

display we've got the cube up there it doesn't totally I mean we can imagine

that this is a cube but we c

...
Рекомендации по теме
join shbcf.ru