I made my first GL project using Piston.

So, I made a Tweet not too long before I made this post, and it was me showing off my first OpenGL project using Piston.
And I attached two images.

One of the target folder, with the program over it:

And the other of the src folder, so you could see …


This content originally appeared on DEV Community and was authored by Calin Baenen

So, I made a Tweet not too long before I made this post, and it was me showing off my first OpenGL project using Piston.

And I attached two images.

One of the target folder, with the program over it:
Image of program and  raw `target` endraw  folder.
And the other of the src folder, so you could see how the app was structured:
The  raw `src` endraw  folder.

The point of this post is to talk about how my experience was, and even as someone who just started, would recommend Piston.

So. What was the project I made in Rust?
A game in-development.

I'm working on RuntDeale, a game inspired by (but NOT an AU of) Undertale, an 2.5D RPG bullet-hell game.
What do I have so far? -- I have a white background with a purple square that can be moved using the W, A, S, and D keys.

So far, my experience has been okay.
I've been able to create a window of a variable size and title, have been able to draw a shape to the screen, provide custom colors, and rotate a shape.

Now, how much code does it take to do all that?
With Piston, this much:

                   # Total lines: 234
                   #     Compact: 135
                   #     CptLns:  (12, 28, 2, 11, 1, 27, 54)
                   #
                   # Avg lines:   033
                   #     Compact: 019
src/
  rd_events/
    gameloop.rs    # Lines: 23
    buttons.rs     # Lines: 49
    mod.rs         # Lines: 02

  rd_utils/
    colors.rs      # Lines: 27 (not all lines are required)
    mod.rs         # Lines: 01

  main.rs          # Lines: 39 (some lines are whitespace)
  app.rs           # Lines: 93

So relative to what I've seen before, that's not a lot of code.
Just a few lines for making the window and event register, a fair bit of lines to rendering the the background and drawing the shape at its given X, Y position, and a small bit for detecting the key-presses and updating the X and Y position.


So. Why do I like Piston so far?
It's concise, and it's been (for the most part) straightforward.

Check out their homepage, https://piston.rs, they even show off some great examples of how their library has been used!

Thanks for reading.
Cheers.


This content originally appeared on DEV Community and was authored by Calin Baenen


Print Share Comment Cite Upload Translate Updates
APA

Calin Baenen | Sciencx (2022-01-30T07:21:15+00:00) I made my first GL project using Piston.. Retrieved from https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/

MLA
" » I made my first GL project using Piston.." Calin Baenen | Sciencx - Sunday January 30, 2022, https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/
HARVARD
Calin Baenen | Sciencx Sunday January 30, 2022 » I made my first GL project using Piston.., viewed ,<https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/>
VANCOUVER
Calin Baenen | Sciencx - » I made my first GL project using Piston.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/
CHICAGO
" » I made my first GL project using Piston.." Calin Baenen | Sciencx - Accessed . https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/
IEEE
" » I made my first GL project using Piston.." Calin Baenen | Sciencx [Online]. Available: https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/. [Accessed: ]
rf:citation
» I made my first GL project using Piston. | Calin Baenen | Sciencx | https://www.scien.cx/2022/01/30/i-made-my-first-gl-project-using-piston/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.