zauonlok/renderer

Please add a basic triangle example

awsdert opened this issue · 5 comments

I'm trying to learn OpenGL but I'm finding the guides to be lacking in the key points so I'm now trying to learn from existing code, I'd like you to add a basic triangle example so I can follow the code back to it's roots and see how new vertices are passed after movement of the triangle via the AWSD keys. It would helpful if the triangle had 3 modes, the first being a flat colour, the 2nd being changeable colours from the arrow keys with/without the shift or control key pressed along side (the 2 modifiers deciding which point to effect) and the 3rd mode having a texture applied instead of modifiable colours, if you can add modes for lighting as well that would be appreciated. You don't need to add a lot of comments, just 1 for each mode branch so that I know where to start analysing from.

Edit: Pure C would be easier for me to read than C++ so that would also be appreciated

Edit 2: I should mention that what I'm having most difficulty with is indexed buffers, I've been able to manipulate positions with uniforms and I've also been able to change vertices by just destroying previous buffers in favour of a new buffer.

Edit 3: Actually could you add a 2nd triangle that moves independently of the 1st, the numpad should be fine for moving it about, the goal isn't an actual game after all, just an example of utilising vertex arrays with vertex & index buffers on multiple objects

I'm afraid that this repository does not suit your need. For learning OpenGL, please refer to https://learnopengl.com/ where you will find great resources for graphics beginners. If you want to inspect vertex data after movements, https://developer.nvidia.com/nsight-graphics is a must-have for you.

I already tried that site, that's why I asked here, you have open source code relies on opengl that I can follow the code path back to the calls and the objects & data they rely on, I'm not concerned about the vertex positions after movement but rather HOW it's done in the 1st place, the guide just doesn't give enough information for that because it moves on to explaining index buffers & matrices instead of giving a clear cut example that utilises both together, anyone who's gotten to the point of learning graphics languages will have already learned enough about normal programming to understand what vertex & index buffers are without further explanation, what we go to these guides for is explanations on how to pass this data to & possibly from the gpu dynamically instead of just once at the start of the app, that is the key information that is missing, as far as the example I'm asking for goes, all I'm asking is for you to create a triangle object file, load it up for 2 separate objects, use both vertex & index buffers together on them, move them and texture them, I don't mean for you to reprogramme the engine but rather use the engine to do just that, leave a couple of comments about what each code path leads to and leave the rest to myself and others who want to learn from the example to just follow all those calls to engine code to the opengl calls, you don't need to do an in depth guide, just a simplest example possible from engine calls

The software renderer contained in this repository does not rely on OpenGL/Direct3D/Metal. You will not be able to learn how to call OpenGL APIs here.

Oh, in that case I retract my request