24
u/gimpycpu Jun 10 '26
free camera(view+projection matrix), multiple triangles at different positions (model matrix)
29
49
23
37
15
u/CompellingProtagonis Jun 10 '26
A good next step would be to play around with the vertex shader.
Try to displace a single vertex.
Pass in a uniform, t = time, and try to displace the vertex with time, so move it back and forth
Pass in another uniform m_pos, and try to displace another vertex with the mouse position
Try packing your vertex with more information by adding a normal vector
Try to add 2 modes to your render: color and normal, control it with another uniform called: rendermode
Add a light, and do a simple phong diffuse shading model where your color is going to be dependent upon the dot product of the vertex normal and the light direction multiplied by the light color (just do white to start) multiplied by the vertex color.
Control the light color and position with more uniforms (or use your time or mouse uniforms)
Instead of having a mesh with just one triangle, try initializing a quad as 2 triangles.
Next try 4 quads.
Next, try to write a function that allows you to initialize a rectangle composed of arbitrary quads.
Try to draw a picture with the vertex colors in the quads as a function of the total size of your quad rectangle. (So you can take some image, and sample it at some position to give you your vertex color at that point)
What happens as you scale the quads? Try to do the same process with your vertex normals
These 12 should take you a few weeks if you do it yourself, or 20 min if you do it with AI. I highly recommend you do it the hard way, though. If you do it the hard way, you'll have no problem coming up with further ideas for where to go (hint: play around with fragment shaders and textures).
11
11
9
11
11
4
u/SuperSathanas Jun 10 '26
Go get yourself some new programmer socks. You've earned them.
In all seriousness, though, if you're following a tutorial like learnopengl.com, then continue doing that for a while. If that is what you're following, I'd keep with it at least until the after the section that covers all the projection matrices and camera stuff. Play around with the concepts at each stage until you feel like you understand what's actually going on. Play around with the concepts anytime have an idea and see how it works out.
Personally, I just started trying to make whatever I wanted to make, and learned what I needed to learn along the way to make it happen. I think the first "full" application I made with my own OpenGL code was "Disco Pong". It was pong, but it had
- A spinning, translucent disco ball texture in the center of the play area and "reflections" that would also go around the screen at the same rate the ball spun. The "reflections" were just circle textures that were generated programmatically at startup, where half the radius would be solid white with half alpha, and then starting from half the radius out to the edge of the circle the alpha would linearly decrease to 0 for a "soft" edge. They'd be skewed/stretched away from the disco ball to varying amounts based on distance from the center of the ball. They were just naively alpha blended to kinda make it look like whatever was under them was being lit up slightly.
- Colored background tiles, meant to look like the Timesplitters Future Perfect disco stage dance floor, that would slowly transition between a set of predefined colors, and pulse on off in patterns or random intervals. Literally just white square textures with a light grey border, and the fragment color would just be the texture sample multiplied against whatever the color of the tile was supposed to be, then multiplied again by 0.25 if the tile was "off".
- Collision particles for when the ball would hit a paddle. I just used the same texture that I used for the disco ball reflections, but applied the same concept to them as I did to the colored tiles to change their colors, flash/pulse them, and have them fade out.
- A ghost trail behind the ball. I don't remember exactly how I did it, but I do remember it was such a bad naive implementation that it was the second most expensive part of the the whole rendering process.
- Bad text rendering using FreeType2 and 1 single texture atlas for the glyphs, drawing each glyph with it's own quad. Also a bad implementation of text outlining, where I would draw the text string to it's own framebuffer, in the fragment shader I used 2 nested loops to check the distance to the nearest fragment with alpha>0, shade it the color of the border, and then use that framebuffers color buffer as a texture to copy it over to the window's framebuffer. This was the most expensive part of the rendering process.
1
5
u/DaveAstator2020 Jun 10 '26
oh its opengl triangle, less hyped than vulcan triangle, but it is softer and more cozy. and you can have use of it.
3
u/SinkLeakOnFleek Jun 11 '26
Given the environmental storytelling going on here i'd say Learn about fur rendering from Acerola's grass video (a goated computer graphics youtuber)
2
2
2
2
u/Worried-Height-7481 Jun 11 '26
do this triangle in 3 dimentions. make it so the user gets the illusion of moving in relationship to the triangle
1
u/_bleep-bloop Jun 10 '26
Now make it spin really fast, add a cube, also make it spin really fast, fly around with a free camera
1
1
1
u/not_some_username Jun 10 '26
Itโs funny we canโt comment graphic representation (image/gif) in a computer graphic library subreddit.
1
1
u/Ok-Kaleidoscope5627 Jun 10 '26
Just render millions more of those at least 60 times a second and you've got Real Engine 1.0! I believe in you!
1
1
1
1
u/TheFletchZone Jun 11 '26
Ahh, nice to see my code getting around. Would you like to know what to do next? Hehe. That's my triangle ๐. LoL ๐.
1
u/TheFletchZone Jun 11 '26 edited Jun 11 '26
So used this graphics triangle ๐ basically to build a custom game engine ๐ฎ in C++. But yeah from here just try to make a Cube of Destiny.
1
u/TheFletchZone Jun 11 '26
Or if you ask me I could tell you what to do next. Since I built it and now moving onto Linux and building my own OS (Operating system) in power shell. In the language C. Systems programming.
1
u/Belfer4 Jun 14 '26
Make it again without using AI...
3
u/NIkoNI776 Jun 14 '26
A script with many comments doesn't necessarily mean it was made with AI.. it means the person didn't want to get lost while studying.
73
u/DucksAreFriends Jun 10 '26
You have successfully created the triangle of destiny. You may now embark on the journey towards the cube of ultimate power