Let's code 3D Engine in Python. OpenGL Pygame Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 262

  • @CoderSpaceChannel
    @CoderSpaceChannel  2 ปีที่แล้ว +52

    Note. If you want to use the rotation order around the axes for the model X -> Y -> Z, then you should use the matrix rotation order from right to left ZYX

    • @thereborne5219
      @thereborne5219 2 ปีที่แล้ว +4

      could you please make a tutorial on how i could make first person movement/camera with py and opengl?

    • @CoderSpaceChannel
      @CoderSpaceChannel  2 ปีที่แล้ว +7

      @@thereborne5219 The implementation of such a camera will be exactly the same as in this project. And by the way, PyOpengl and ModernGL can be used together (for version 3.3 and higher)

    • @galtechtv4239
      @galtechtv4239 2 ปีที่แล้ว +6

      ​@@thereborne5219 you can change move() function of camera to this to have a "fps" movement
      def move(self):
      velocity = SPEED * self.app.delta_time
      keys = pg.key.get_pressed()

      if keys[pg.K_z]:
      #forward
      forward = glm.normalize(glm.cross(self.right, glm.vec3(0, 1, 0)))
      forward.y = 0
      self.position -= forward * velocity
      if keys[pg.K_s]:
      #backward
      forward = glm.normalize(glm.cross(self.right, glm.vec3(0, 1, 0)))
      forward.y = 0
      self.position += forward * velocity
      if keys[pg.K_q]:
      #left
      self.position -= self.right * velocity
      if keys[pg.K_d]:
      #right
      self.position += self.right * velocity
      if keys[pg.K_SPACE]:
      #up
      self.position += (0, velocity, 0)
      if keys[pg.K_LCTRL]:
      #down
      self.position -= (0, velocity, 0)

    • @easydraw3420
      @easydraw3420 ปีที่แล้ว +1

      Can you tell me what theme you use in pycharm please?

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว +1

      @@easydraw3420 color scheme: Monokai

  • @SuboptimalEng
    @SuboptimalEng 2 ปีที่แล้ว +177

    I like how you purposefully leave bugs in the code and explain the mistake before fixing it a little while later. Awesome teaching style!

    • @mattiskardell
      @mattiskardell ปีที่แล้ว +4

      att first i thought it was sarcassim

    • @rileylecaptain113
      @rileylecaptain113 7 หลายเดือนก่อน +1

      Amazing way to show what errors you would come across and give an idea on how you would fix it.

  • @StarFury2
    @StarFury2 2 ปีที่แล้ว +70

    This video has few years worth of knowledge regarding computer graphic's practices and techniques, compressed into 33 minutes. It's definitely one of the most valuable stuff I watched on TH-cam ever.

    • @Lampe2020
      @Lampe2020 ปีที่แล้ว +5

      It's actually a tutorial I could easily understand and follow! I've watched many programming tutorials but rarely were they that good.

  • @DamianthTV
    @DamianthTV 9 หลายเดือนก่อน +4

    30 minute video, but a entire day to put it in practice. Great video! Thank you very much

  • @donhippo8305
    @donhippo8305 2 ปีที่แล้ว +16

    Great video!
    I would absolutely love an OpenGL turorial style series as you mentioned at the end of the video
    - not just for learning practical opengl but also about how it works behind the scenes in more detail (such as the pipeline, contexts VBO VAO explanations you gave) and in general about the mathematical aspects of computer graphics (such as the linear algebra stuff, the lighting and shading alogrithms).
    Honestly just you mentioning these stuff briefly always gets me to pause the video and google them immediately.. takes me a couple of hours to finish your videos but I'm learning a bunch lol.
    Anyways these videos are GOLD thank you!

  • @AinurEru
    @AinurEru 2 ปีที่แล้ว +21

    Great video! Just a small correction: OpenGL is not right-handed nor left-handed at the geometry phase, it is only left-handed after rasterization, much like DirectX and all other graphics APIs. What determines what handedness is assumed, is how the projection matrix is generated. In this case, it uses GLM's function, which includes the Z-flip in the matrix it produces - this is what makes this assumption about the source vertex data being structured with a right-handed coordinate system. If you flip that z-negation back in the projection matrix that GLM perspective yields (or just construct it manually yourself) you can then use a left-handed coordinate system for your vertex data. OpenGL has no say in the matter, it is you that is multiplying your vertex data with that matrix that you yourself are also providing - all in your vertex shader. The only real requirement is that the output of the vertex shader's vertex positions are all left-handed. GLM just followed the very legacy 'convention' of 'assuming' that the incoming vertex data is right-handed, and so includes that z-flip in the perspective projection matrix that it's function produces. That's where that assumption is made, not in OpenGL itself. Way back, when OpenGL had it's own built-in perspective projection, it really was the case that you could say 'OpenGL is right-handed' (sorta..), but once it started requiering vertex shaders, that stopped being the case - and that's already decades ago.

  • @lukask.3465
    @lukask.3465 2 ปีที่แล้ว +8

    This is honestly one of the best tutorials i have seen, python makes it really easy to grasp, but all info applies in other languages... great work!

    • @ProgrammingWithRook
      @ProgrammingWithRook 10 หลายเดือนก่อน

      Honestly it doesn't, you can not take anything what so ever from this tutorial and apply it to C,c++,java... there is no GL commands anywhere.

    • @ProgrammingWithRook
      @ProgrammingWithRook 10 หลายเดือนก่อน

      apart from the window context ( window hints)

  • @MarioAbbruscato
    @MarioAbbruscato 2 ปีที่แล้ว +45

    The best programming teacher in the world. Everything is explained clearly. The rhythm, the tone of voice, the background music manages to keep the level of attention high even for 30 minutes. And this is fabulous! Hope there are more tutorials for various types of lighting, mirror reflections, various materials, independent object animations.The sun has returned to shine inside the konsole
    Thank you very much!

    • @carstenschmucker9140
      @carstenschmucker9140 ปีที่แล้ว +7

      Hmm, sounds to me more like a (very good) computer voice?!

    • @markm1514
      @markm1514 ปีที่แล้ว

      ChatGPT lit cuh

  • @jonomoth2581
    @jonomoth2581 2 ปีที่แล้ว +3

    been using this alot to learn openGL for a project, i probably account for around a third of this videos views. thank you very much

  • @thedebapriyakar
    @thedebapriyakar 2 ปีที่แล้ว +4

    Hands down the best tutorial on Pygame OpenGL I've ever seen.

  • @picardr6
    @picardr6 2 ปีที่แล้ว +1

    I am brand new to DAW and soft soft - these tutorials are excellent an very helpful to get soone like up and running. Appreciate

  • @icotwilight8597
    @icotwilight8597 2 ปีที่แล้ว +6

    Oh my god, thank you so much!!! I have been waiting for a tutorial like this, who would have guessed only the most sensible coder would make it ^w^.
    Btw I subbed on 3 accounts, you deserved more.

  • @theotherquou
    @theotherquou 2 ปีที่แล้ว +6

    This is really good. I will shill this next time someone asks how to get started with graphics programming.

  • @MeltedIce_
    @MeltedIce_ 2 ปีที่แล้ว +4

    Best python tutorial I ever seen so far! Thanks!!!

  • @zaqk2
    @zaqk2 ปีที่แล้ว +1

    Best open GL tutorial so far.... Thank you so much for making these... Subscribed 👍

  • @azaias
    @azaias ปีที่แล้ว +1

    Many thanks. Been trying to figure out how to use OpenGL/shaders and use them with pygame and this video has been the most helpful

  • @embodythelogos
    @embodythelogos ปีที่แล้ว +3

    Hi! Is it ok to use the content I learn from your tutorial to develop an app for commercial use? I will write my own code but will use your code as template/reference since this is a tutorial. Do I have to give you an attribution for this (and how do I do that)? Thank you!!

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว +1

      If you will use the code from github, then just provide a link in the readme to the source code.

  • @scottcastle9119
    @scottcastle9119 2 ปีที่แล้ว +5

    This is pretty awesome, would love to see a 2D engine from start to finish.

  • @acanimationfilmstudio1018
    @acanimationfilmstudio1018 ปีที่แล้ว +1

    That's why programming bis very powerful and awesome when the job is done.good work

  • @kommanderkeen
    @kommanderkeen ปีที่แล้ว +3

    I just love you videos man! Thanks

  • @JacobKinsley
    @JacobKinsley 2 ปีที่แล้ว +6

    I love how coding a rendering engine is just *8 years later* oh my god! I made a blue square! *10 seconds later* now I'm rendering a full city!

  • @PraveenKulkarnipraveen
    @PraveenKulkarnipraveen ปีที่แล้ว +1

    I like the speed of your videos, feels full of content. For experienced python programmers, all sounds smooth. Don't plan to make it slow ;)

  • @Temple_Cloud
    @Temple_Cloud 5 หลายเดือนก่อน

    Oh my word! Another awesome video from Coder Space! As the other comments say, it is super condensed. I recommend going through it slowly, copying it whilst making notes.
    Utterly brilliant.
    Hope this adjusts the TH-cam algorithm...

    • @Temple_Cloud
      @Temple_Cloud 5 หลายเดือนก่อน

      Oh, and my personal tweak to 'camera.py' to make it work how I like it. Just inverts the axis and removes the clamping (for other who are learning and like it this way).
      def rotate(self):
      rel_x, rel_y = pg.mouse.get_rel()
      self.yaw += rel_x * SENSITIVITY
      self.pitch -= rel_y * SENSITIVITY # Invert the pitch angle (non-flight controls)

      # Keep the angles within 0 to 359 degrees.
      self.yaw %= 360 # Keep the yaw angle within 0 to 359 degrees
      self.pitch %= 360 # Keep the yaw angle within 0 to 359 degrees
      # Reset the mouse position to the center of the screen on each frame
      # This prevents the mouse from reaching the edge of the screen and preventing camera movement.
      pg.mouse.set_pos(self.app.WIN_SIZE[0] // 2, self.app.WIN_SIZE[1] // 2)
      Thanks again for an ace tutorial!

  • @sajagpradhanang8805
    @sajagpradhanang8805 2 ปีที่แล้ว +1

    Thank You for this easy to follow and on-point tutorial.

  • @gianlucagiuman6132
    @gianlucagiuman6132 2 ปีที่แล้ว +1

    WOW !! this IS the tutorial !! A really great teacher for what i like !!! Thanks

  • @sanador2826
    @sanador2826 2 ปีที่แล้ว +2

    Excellent video! I plan on using openGL to do physics simulations so I am excited to implement some of this. :)

  • @aycatarakcoglu7539
    @aycatarakcoglu7539 2 ปีที่แล้ว +1

    Take a week just learning the basics and you will be good, I been using soft soft since it was Fruity Loops back in 03, and still learn

  • @AizarkLizard
    @AizarkLizard 6 หลายเดือนก่อน +1

    Cool author. Cool lesson. There is very little open information on this issue. Thank you for your work. I would be glad if you continue to release something further on this topic.

  • @koufdell
    @koufdell 2 ปีที่แล้ว +2

    this is gold , thx for the top G content :)

  • @RedstoneHair
    @RedstoneHair ปีที่แล้ว

    This is perfect, it's fast and not a lot is explained which is good, cause you'd expect the person to have some opengl knowledge to go as far as to 3D. Yet python also makes this very easy, I'm so glad I found this video, I've been wanting to make stuff like this

  • @Lampe2020
    @Lampe2020 ปีที่แล้ว +2

    Thanks a lot for this video! I hope I can use this knowledge to create my own Minecraft-inspired block game...

  • @kapilshandilya903
    @kapilshandilya903 2 ปีที่แล้ว +1

    Woot! Thank goodness, I needed this back on my computer! Thank you!! :D

  • @sakalagamingyt3563
    @sakalagamingyt3563 ปีที่แล้ว +1

    This guy is seriously a great genius

  • @Anomalous-ye3hi
    @Anomalous-ye3hi ปีที่แล้ว +1

    Damn… thanks!! Best tutorial ever!

  • @sandywake3498
    @sandywake3498 2 ปีที่แล้ว +1

    Hi.
    In the Transformation section of the video; in the 'get_model_matrix()' function,
    the 'self.pos' parameter in 'm_model = glm.translate(m_model, self.pos)' is marked as an unexpected argument by Pycharm and only a single cube is showing.
    What could be causing this?

    • @sandywake3498
      @sandywake3498 2 ปีที่แล้ว

      Solved this, had the 'get_model_matrix()' function in both the BaseModel and the Cube class

  • @zaneaussie
    @zaneaussie ปีที่แล้ว +2

    WOW man that is flipping awesome. You are much smarter than I could ever hope to be. A sub from me my man! You have almost made eve online haha..im a fan

  • @yunusemrekaraman5294
    @yunusemrekaraman5294 2 ปีที่แล้ว +1

    I'm a rapper who can't really afford production so I want to learn to make my own soft. I just want to say that I appreciate your teacNice tutorialng

  • @bedirhanyelkovanc5422
    @bedirhanyelkovanc5422 2 ปีที่แล้ว

    year for all of us, for so- it's still ongoing. i respect you for being honest as that's what's been keeping a bit sane recently, just being

  • @mythicalwhalers
    @mythicalwhalers 2 ปีที่แล้ว +1

    This is a fantastic tutorial. Hope to see more of these!

  • @ryanperks7747
    @ryanperks7747 ปีที่แล้ว

    Hey I’m having an issue at 12:48 where the colour of my cube is just black, any idea as of why?

  • @ImPiton
    @ImPiton 9 หลายเดือนก่อน

    Добрый день.
    подскажи а как в посмотреть что там находиться?

  • @KJ7JHN
    @KJ7JHN 2 หลายเดือนก่อน

    What cpu was this run on? Arm? Pentium? Thanks. Oh, and how much memory?

  • @guidetoplantfibercordage3028
    @guidetoplantfibercordage3028 ปีที่แล้ว +1

    For some reason, the PyGLM module itself isn't working. Every time I try to install it, it errors.
    UPDATE: pyglm doesn't like python 3.12.0. use an earlier version.

  • @M4DST4N
    @M4DST4N 2 ปีที่แล้ว +1

    That's a great video! Thank you very much!

  • @JohannaWagne
    @JohannaWagne 6 หลายเดือนก่อน

    Hi! I have followed your tutorial in order to create a 3D engine and I have been trying to implement a terrain instead of the boxes. I have a height map (512x512) where the grey color corresponds to the height. I want to use this height map to build the terrain/ground of the 3D world. Do you have any tips on how to do this? Would be really helpful :)

  • @jackl8545
    @jackl8545 2 ปีที่แล้ว

    thank you soo much very direct link n works for me love the way you expressed the installation .

  • @diandradeeke
    @diandradeeke 6 หลายเดือนก่อน

    hello, i have problems with the glm-module. for some reason it is marked as malware by my anti virus program. So i cant compile the code, simply because it cant import the glm-module. What am i supposed to do?

  • @giusepperadatti225
    @giusepperadatti225 11 หลายเดือนก่อน

    how do I ensure that when the camera touches the blocks there is a collision and the camera does not pass through them?

  • @piponu
    @piponu 2 ปีที่แล้ว +2

    Thank you very much for this great tutorial! Exactly what I was looking for. I am new to PyCharm and was wondering how/which color scheme you used to make your python code look so tidy? Greetz

    • @CoderSpaceChannel
      @CoderSpaceChannel  2 ปีที่แล้ว +1

      monokai

    • @fester_lay
      @fester_lay ปีที่แล้ว

      @@CoderSpaceChannel Hello Coder Space. Why version PyGLM you using

  • @manuelkarner8746
    @manuelkarner8746 8 หลายเดือนก่อน

    if i want to animate a 3d model, would the engine be powerful enough for a naive approach where i just have a sequence of obj files for the animation and load them in fast ? or is there a better way?
    awsome video btw

    • @CoderSpaceChannel
      @CoderSpaceChannel  8 หลายเดือนก่อน

      try assimp library

    • @manuelkarner8746
      @manuelkarner8746 8 หลายเดือนก่อน

      @@CoderSpaceChannel wow thanks for the fast reply, I will definitely give it a try.
      I want to use it within your voxel engine :)

  • @dawna2011
    @dawna2011 4 หลายเดือนก่อน

    even though I installed all requirement modules, I still have errors message. It is modernGL (mgl) no attribute to vec3. Why?

  • @kumu2024
    @kumu2024 ปีที่แล้ว

    Best tutorial I have seen. A lot of information that you need to come back several times.
    While the code was written in front of me, I made several mistakes (colon rather than semicolon, typo ..etc).. I learned also that doing mistakes in the shader is not easy to debug.
    As a beginner in OpenGL I see this tutorial great.
    Can I ask what text-to-speach program you use please?
    Thank you very much for the time you put to produce this great content.

  • @robertwhite8194
    @robertwhite8194 หลายเดือนก่อน

    I’m glad I just took linear algebra, but this was pushing my limits.

  • @ImPiton
    @ImPiton 8 หลายเดือนก่อน

    Good afternoon. Please tell me how to find in your application what vertices it has in an object. That is, where is the vertex array located and how to view it. Thanks in advance)

  • @LeiffNathanAMendoza
    @LeiffNathanAMendoza 8 หลายเดือนก่อน

    TRUE CHARM INDEED ... AWESOME DETAILS AND CRITICAL STEPS ... KUDOS

  • @dipanmondal3664
    @dipanmondal3664 ปีที่แล้ว

    I have successfully installed PyGLM in my python but when i am trying to run my code it shows error. : module 'glm' has no attribute 'vec3'

  • @TheRealWinsletFan
    @TheRealWinsletFan 8 หลายเดือนก่อน

    Cool tutorial, but I must say I'm quite unhappy with the performance; it runs like an absolute dog on my 2019 iMac with 3.6GHz i9 and 580X Radio Pro. Obviously the hardware is not weak for a scene like this, what is the primary bottleneck?

  • @brent9129
    @brent9129 ปีที่แล้ว

    Great tutorial! I'm fairly new to programming. I've implemented color picking to this so far and have been stuck on trying to understand how to move the cat individually. Reassigning the position does not work, but would be optimal. I'm wondering if it's possible, or there is a better way?

  • @zhabiboss
    @zhabiboss ปีที่แล้ว

    @Coder Space When I try to execute the file it just gives me a segmentation fault when it creates a context

  • @robinhorneman2245
    @robinhorneman2245 2 ปีที่แล้ว

    I still get those irritating white lines after applying mipmaps and the isotropic filter. Any clue as to why? The mipmap made it a little better but they are still clear as day.

  • @lavaa7392
    @lavaa7392 2 ปีที่แล้ว +1

    This tutorial is amazing, but I'm getting stuck at 6:52. When I try to run the program at that point it says "FileNotFoundError: [Errno 2] No such file or directory: 'shaders/default.vert'" even though the file exists and is in the right spot in the folder. I checked and there are no typos. I don't know what happened.

    • @CoderSpaceChannel
      @CoderSpaceChannel  2 ปีที่แล้ว +1

      the project code is available from the link in the video description, try it

    • @lavaa7392
      @lavaa7392 2 ปีที่แล้ว +1

      Ok. I think I found the issue. I needed to have only the folder for the 3D engine open. If I have another directory open with that folder inside, it doesn't work. Thanks!

  • @snoppgubbe2310
    @snoppgubbe2310 ปีที่แล้ว

    I understand you use some plugin or program to simulate typing, what is it called?

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว

      hmm, this approach of typing was created by me personally… because I didn’t find anything like it

  • @yahyabeysami101
    @yahyabeysami101 ปีที่แล้ว

    I don't understand the way to describe verticies. Is there more ressources on this topic ?

  • @Racengineer2
    @Racengineer2 7 หลายเดือนก่อน

    All very cool and a much easier approach than I was taking. However, what would I have to do if I wanted to render a cube with 6 different textures or colours. Like a rubix cube. Would I have to split the cube into their own surfaces (6 cubes with thin walls) or is there a better/different way. I don't really want to split the cube in 6 since that will mean that if I wanted to move the cube I would have to move each instead of moving the whole cube.

  • @MrNunchackus
    @MrNunchackus ปีที่แล้ว

    Great video!
    Is it possible to improve this project for ray tracing, defining recursiveness of tracing and so on?

  • @dominik4205
    @dominik4205 ปีที่แล้ว +1

    I can't even get the triangle to show up.. only edit in code was winsize being at 1280, 720.

  • @Titouan_Jaussan
    @Titouan_Jaussan 8 หลายเดือนก่อน

    Hmmm, Why do I have the background color but not the rest ? I verified my code and the only potential problem that I can see is that I cant use version 330 OpenGl So I use version 310 in the GraphicsEngine class context but It still works if i set the version to 330 in the shaders

  • @maxcartoon23
    @maxcartoon23 10 หลายเดือนก่อน

    ummmm hey. about the GLSL Shader. How do i put it? i am on Visual Code Studio

    • @maxcartoon23
      @maxcartoon23 10 หลายเดือนก่อน

      do i need to install it or how.

    • @Nikola95inYT
      @Nikola95inYT 8 หลายเดือนก่อน

      it's just the name of programming language. Languages themselves cannot be installed, they can be learned.

  • @ggre55
    @ggre55 2 ปีที่แล้ว

    Damn thanks
    I really wanted to see how to make graphics engine and i really really wanted to make one myself thanks again

  • @loan777
    @loan777 ปีที่แล้ว +1

    Thank you for this video, I learned a lot by playing with the code and I was able to create projects that I wanted to achieve.
    But I'd need some advice. I'm creating a physics engine and i'm struggling a lot with the spherical shapes like the icosphere or cylinders.
    I have written several scripts but none of them work. How would you proceed, in the way of this tutorial, to render sphericals object ?
    I had a great time watching all your videos.
    Thank you for all of them they are really usefull.
    Can't wait to see the next one !

  • @zonea1826
    @zonea1826 2 หลายเดือนก่อน +1

    Thai is next level python

  • @joshbarros1995
    @joshbarros1995 ปีที่แล้ว

    Your tutorials are amazing!
    Do you plan on creating a Quake Clone with Pygame?

  • @mostafaghobashy2724
    @mostafaghobashy2724 ปีที่แล้ว

    the vao means vertex attribute object
    while the ebo means element buffer object
    while the vbo means vertex buffer object

  • @Hekysei
    @Hekysei 9 หลายเดือนก่อน

    how i can draw HUD using pygame in this project?

  • @rizu1444
    @rizu1444 2 ปีที่แล้ว

    i followed all these steps but when you are using sample that you have imported the program just bugs up.

  • @caspargrevelhorster4298
    @caspargrevelhorster4298 ปีที่แล้ว +1

    which python version are you using?

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว +1

      3.9

    • @caspargrevelhorster4298
      @caspargrevelhorster4298 ปีที่แล้ว

      @@CoderSpaceChannel i had problems getting 3.11 to run with pygame. found
      pip install pygame --pre
      to work for me. thank you for your quick reply.

  • @voytechj
    @voytechj 2 ปีที่แล้ว +2

    If you define a texture with internal GL_SRGB8 format then you can get hardware auto conversion from sRGB to linear space and don't need power function in a fragment shader. I really don't know if this is possible in Moderngl?
    The last conversion (pow(1/gamma)) could be also avoided if Pygame supports creation of SRGB framebuffer. For example in FreeGLUT you can create window with GL_SRGB flag, and then call glEnable(GL_FRAMEBUFFER_SRGB) to get final auto conversion from linear to sRGB space for free.
    There is a good reason to have nonlinear displays and cameras. If you transfer pictures through medium (cable, air, etc.) you will always get extra noise attached to your signal. Our eyes have logarithmic response and are oversensitive to dark colours so noise is much more visible when light is very weak (dark faces, shadows, etc.). Pictures with nonuniform "noise damage" (perceptually concentrated in dark regions) looks bad so EE engineers designed cameras with x^(1/2.2) transfer function to boost dark colours that can survive noise attack during travel through space. Displays inverse that with x^2.2 function to bring back original relationship between colours. In the end noise is still on the picture but perceptually is spread across whole picture and final result is much more pleasant to human eyes, and they are wiling to pay money for such designed nonlinear systems.
    In digital systems 8-bit light intensity values are considered noisy and "bands" (quantization noise) are visible in dark colours just like in old analog systems. You need at least 12-bit for each red, green and blue value to have perfect picture without visible artefacts. But we like 8-bit because it's cheap, less bytes to transfer so it's fast, it also takes less space on SSDs. Because of that, we have nonlinear cameras and displays with gamma=2.2 just like in old analog systems.

  • @Wasilij1337
    @Wasilij1337 ปีที่แล้ว

    hi, i made everything good but i still gets error wherein program can't understand GraphicsEngine() in app = GraphicsEngine() pls help

    • @Wasilij1337
      @Wasilij1337 ปีที่แล้ว

      CODE:
      import pygame as pg
      import moderngl as mgl
      import sys
      class GraphicsEngine:
      def __init__(self, win_size=(1600, 900)):
      pg.init()
      self.WIN_SIZE = win_size
      pg.display.gl_get_attribute(pg.GL_CONTEXT_MAJOR_VERSION, 3)
      pg.display.gl_get_attribute(pg.GL_CONTEXT_MINOR_VERSION, 3)
      pg.display.gl_get_attribute(pg.GL_CONTEXT_PROFILE_MASK, pg.GL_CONTEXT_PROFILE_CORE)
      pg.display.set_mode(self.WIN_SIZE, flags=pg.OPENGL | pg.DOUBLEBUF)
      self.ctx = mgl.create_context()
      self.clock = pg.time.Clock()
      def check_events(self):
      for event in pg.event.get():
      if event.type == pg.QUIT or (event.type == pg.KEYDOWN and event.key == pg.K_ESCAPE):
      pg.quit()
      sys.exit()

      def render(self):
      self.ctx.clear(color=(0.08, 0.16, 0.18))
      pg.display.flip()
      def run(self):
      while True:
      self.check_events()
      self.render()
      self.clock.tick(60)
      if __name__ == '__main__':
      app = GraphicsEngine()
      app.run()

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว

      import pygame as pg
      import moderngl as mgl
      import sys
      class GraphicsEngine:
      def __init__(self, win_size=(1600, 900)):
      pg.init()
      self.WIN_SIZE = win_size
      pg.display.gl_set_attribute(pg.GL_CONTEXT_MAJOR_VERSION, 3)
      pg.display.gl_set_attribute(pg.GL_CONTEXT_MINOR_VERSION, 3)
      pg.display.gl_set_attribute(pg.GL_CONTEXT_PROFILE_MASK, pg.GL_CONTEXT_PROFILE_CORE)
      pg.display.set_mode(self.WIN_SIZE, flags=pg.OPENGL | pg.DOUBLEBUF)
      self.ctx = mgl.create_context()
      self.clock = pg.time.Clock()
      def check_events(self):
      for event in pg.event.get():
      if event.type == pg.QUIT or (event.type == pg.KEYDOWN and event.key == pg.K_ESCAPE):
      pg.quit()
      sys.exit()
      def render(self):
      self.ctx.clear(color=(0.08, 0.16, 0.18))
      pg.display.flip()
      def run(self):
      while True:
      self.check_events()
      self.render()
      self.clock.tick(60)
      if __name__ == '__main__':
      app = GraphicsEngine()
      app.run()

  • @rayangamedev1912
    @rayangamedev1912 2 ปีที่แล้ว

    bro i got a problem, in my model.py file i have right all code correct but it's give me an error, the error is such a file or directory not found: shaders/{shader_name}.vert, help plz

    • @Kantdhx
      @Kantdhx ปีที่แล้ว

      I'm facing the same problem
      but my mistake was that the shader files were not in the shaders file/directory
      it's simple

    • @rayangamedev1912
      @rayangamedev1912 ปีที่แล้ว

      @@Kantdhx Bro thanks for help🙂

    • @Kantdhx
      @Kantdhx ปีที่แล้ว

      please, bro =) 😉

  • @lumeras115
    @lumeras115 ปีที่แล้ว

    I'm getting an error saying "Triangle() takes no arguments"

  • @z3n1te
    @z3n1te ปีที่แล้ว

    I recommend using GLFW instead of Pygame and also give use to Index Buffers, othervise, good watch!

    • @AcceleratedVelocity
      @AcceleratedVelocity ปีที่แล้ว

      but pygame supports many functionalities, eg this code snippet
      def surf_to_texture(app, surf):
      tex = app.ctx.texture(surf.get_size(), 4)
      tex.filter = (moderngl.NEAREST, moderngl.NEAREST)
      tex.swizzle = 'BGRA'
      tex.write(surf.get_view('1'))
      return tex
      converts a pygame surface to a sampler2D texture to allow for 2d games in 3d ones, and its far simplet to use

  • @quantumgamer6208
    @quantumgamer6208 8 หลายเดือนก่อน +1

    Can you make a tutorial for how to make a 3D engine using vulkan

  • @rapidlemon906
    @rapidlemon906 ปีที่แล้ว

    You should talk in videos, it would feel more natural and engaging, luv your videos btw 👍

  • @benadler56
    @benadler56 2 ปีที่แล้ว

    you are the best dude

  • @esraasabbagh5018
    @esraasabbagh5018 2 ปีที่แล้ว

    Very helpful..thanks a lot.

  • @lochoang6192
    @lochoang6192 11 หลายเดือนก่อน

    What is the algorithm of this project? Sir

  • @tuncay7061
    @tuncay7061 2 ปีที่แล้ว

    Hello. Your videos are awesome! Can you tell which pycharm theme you use? Its elegant!

    • @CoderSpaceChannel
      @CoderSpaceChannel  2 ปีที่แล้ว

      Color scheme: Monokai

    • @tuncay7061
      @tuncay7061 2 ปีที่แล้ว

      @@CoderSpaceChannel Thank you so much

  • @absurdemtiefer1950
    @absurdemtiefer1950 2 ปีที่แล้ว

    Super Nice - instant abo

  • @dowlso
    @dowlso 2 ปีที่แล้ว +1

    8:50 Error: module glm has not attribute perspective

    • @tunaan80
      @tunaan80 ปีที่แล้ว

      Same here 😔

  • @knowscope
    @knowscope ปีที่แล้ว

    how to make each surface of the cube have a different texture

  • @lumaia1990
    @lumaia1990 ปีที่แล้ว

    what would be the path to take to make an android apk?

  • @daru25able
    @daru25able ปีที่แล้ว

    any ideas on how to implement billboards ?

  • @lachlanjohn8223
    @lachlanjohn8223 ปีที่แล้ว

    HI! im new to OpenGL and pygame, but at 5:01 i keep getting an error, i have tried downloading the code, still dosnt work. this is what dosnt work "program = self.ctx.program(vertex_shader=vertex_shader, fragment_shader=fragment_shader)" im not sure why... sorry for disturbing you
    Edit: OMG I GOT IT WORKING THANK YOU X

  • @sonicfan88321
    @sonicfan88321 ปีที่แล้ว

    I don't know if anyone else is having this problem, but when I tried to add multiple cubes to the scene (after following the video to completion), I only ever saw the last cube added to the list of objects in the scene class.

    • @lkjh161
      @lkjh161 5 หลายเดือนก่อน

      me too.

  • @yassirouedraogo4671
    @yassirouedraogo4671 2 ปีที่แล้ว

    Absolutely!!

  • @SkyFly19853
    @SkyFly19853 2 ปีที่แล้ว

    Welcome back.
    Finally, a new video.

  • @tunaan80
    @tunaan80 ปีที่แล้ว

    At 8:30 it says that glm has no attribute perspective?

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว

      check that you have installed the correct glm:
      pip install PyGLM

    • @tunaan80
      @tunaan80 ปีที่แล้ว

      @@CoderSpaceChannel İ did that too, doing it again now it says requirements already satisfied

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว

      you can email me

    • @tunaan80
      @tunaan80 ปีที่แล้ว

      @@CoderSpaceChannel what's your email?

    • @CoderSpaceChannel
      @CoderSpaceChannel  ปีที่แล้ว

      email in the section - about the channel

  • @montsamu
    @montsamu 10 วันที่ผ่านมา

    Interestingly, apparently it's a long-standing pygame bug for some PCs that you can't have BOTH event.set_grab True and mouse.set_visible True without things going haywire in a non-fullscreen window. So if anyone else has unexpected issues at that part (around 18:00) just comment out setting the mouse invisible.

  • @hacerdemirel9833
    @hacerdemirel9833 ปีที่แล้ว

    Why is it between -89 and 89?

  • @mentalites
    @mentalites 2 ปีที่แล้ว

    Does it co with the samples?