Anyone have some good resources for learning pic related?

Anyone have some good resources for learning pic related?
I've self taught myself all the basics, but there are so many features and gotchas that I keep stumbling over. I don't know how many times I've discovered a feature that would've made the thing I already did so much easier.

Attached: 1200px-Opengl-logo.svg.png (1200x520, 116K)

Other urls found in this thread:

youtube.com/watch?v=W3gAzLwfIP0&list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2
learnopengl.com/
open.gl/
twitter.com/AnonBabble

Also general graphics programming thread I guess.

Start with a software renderer, using your own linear algebra functions.
You will forever stumble through OpenGL if you don't have your linear algebra down to a t.

I know my linear algebra, I took a college course in it. I also wrote a doom-style rendering engine back in high school.
My stumbling block has been discovering features in OpenGL. There's 100 ways to do everything and all the references I look at usually pick the easy way as opposed to the fast way.

i would suggest learning OpenGL ES first as it is a stripped down version with only the basics needed, desktop OpenGL is horrendously complicated and suffers from severe feature bloat

however for general reference, get yourself a copy of this book, it's pretty much the canonical reference material

Attached: 1503715475281.jpg (497x648, 131K)

Jamie King OpenGL on YouTube and opengl tutorial .org

Thanks, I've heard good things about that book. Does it cover all the useful features of OGL?

I'd suggest just learning Vulkan since OpenGL is a bloated piece of shit with endless pages of legacy shit meant to support 15 year old hardware.

Vulkan doesn't support older hardware. I target 3.3.

Attached: opengf_logo.png (440x192, 11K)

It supports anything made after 2012, though if you target 3.3 you won't even get direct state access. Anyway, it's really hard to recommend a source without knowing what you know. Learnopengl.com is good for a beginner and even covers some advanced techniques.

I've written a model loader, basic deferred rendering system, shadows, etc.
Most recently I've been writing a voxel engine and I've been having trouble getting it to be fast.
I figured out how to pack the vertices much more efficiently but my main bottleneck is having tons of drawcalls. I think glmultidrawarrays or something like that exists but the documentation is a bit sparse.

This is ironically where Vulkan would have helped immensely, but I digress. Honestly, if you've learned all that then you're more than equipped to learn from the documentation. glMultiDrawArrays is essentially multiple glDrawArrays calls where you set vertex indices and vertex counts per call. It allows you to draw disjointed, separate ranges with a single call. I find the Khronos documentation clear enough on that.

Still, the rendering itself isn't necessarily the expensive part of voxel engines. How are you extracting the mesh from the voxel data? Are you culling properly?

it covers everything that isn't deprecated, you will still need to double check everything you do to make sure it's supported in 3.3

>voxel engine
>lots of drawcalls

if it's a minecraft-type game where everything is a cube, you should only need one array and one draw call for the whole environment

I build the the meshes on the CPU then upload it to the GPU. It's a pretty fast process and I have a seperate thread for actually building the mesh so it doesn't impact my frame times significantly. Everything is properly culled out.
I've read the docs ong glMultiDrawArrays and the main hangup I have is that it's not super clear on how to have different uniforms for each mesh, since each chunk has it's own model matrix for putting it in the right place.
It's split into 16^3 chunks so they can be easily modified without rebuilding the whole world.

Also I would be interested in learning vulkan, I wouldn't mind writing a seperate renderer for fun at some point, but I don't think any of my systems can use vulkan atm due to lacking support in the amdgpu driver.

You could try profiling it with multiple threads for building chunks? No idea what your pipeline looks like, but draw calls shouldn't be a problem unless you're doing hundreds or even thousands per frame.

building the chunks is currently a non issue.
The big issue is I have a drawcall for every chunk and there can be many thousands of chunks loaded at once.
My current plan is to batch them together in groups of 8, I think it should be pretty fast now that I've figured out how to pack the data more effectively but it'll be 8x more data transferred each time a chunk updates since you have to have them back to back in memory. I can cache the geometry in memory to make this step pretty quick I think. I'll have to try it and profile it.

>it's not super clear on how to have different uniforms for each mesh
you can't, if you do things with multidraw then all your verts need to be in world space, not in chunk space

alternatively you can come up with some creative way to use uniforms arrays/buffers to pass some indexed data

read your knuth, never optimize before you profile

Seems like you've gotta find a compromise while keeping the bandwidth usage sane, larger chunks or fewer chunks. I'm pretty sure Minecraft only shows a few dozen chunks at most.

I remember reading a code example showing this exact thing but I can't find it anymore.
Also, I've profiled enough to know that drawcalls are my bottleneck so I'm trying to reduce that.
Minecraft is notoriously poorly coded so I wouldn't try to use it as a technical benchmark. There are a lot of other voxel rendering systems that can handle way more.

I did a bit of thinking and I think I can pack the face offsets for a 2^3 group of chunks into 5 bits per axis, for a total of 15. I believe that will fit into my current system without having to change much, I had a few spare bits left.

you are probably thinking of instancing, which is only useful when you are rendering the same set of vertices over and over again with different uniforms. your problem is you need both different vertices and different uniforms

probably a good solution as any

How hard is it to learn graphics programming? What is the math and programming prior knowledge that you need? Also, how did you people get started on it and what would you recommend a beginner to do?

youtube.com/watch?v=W3gAzLwfIP0&list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2

learnopengl.com/

I will check it later, thanks

You still need a massive index array tho

open.gl/ is also pretty good for learning the very basics.

Does anyone have some good tips for debugging shaders? Everyone keeps saying to color stuff to debug, but the problem is that I'm not seeing any geometry at all and it would be a huge help to actually see what positions are being output by my vertex shader.

transform feedback