It's impossible. I can't do it. It's too fucking confusing.
>>108630216just ask ChatGPT or Gemini bro, the fuck is wrong with you?have you ever consider suicide as a career path?
>>108630216If you think OpenGL is hard Vulkan will rape you
>>108630216https://nehe.gamedev.net/https://www.youtube.com/watch?v=opADNvgeZYY
>>108630252I'm using SDL2's built-in renderer right now, and it's weak and slow but it is just SO EASY. I would really like to switch to OpenGL so that the code runs faster and I can add special effects like dynamic 2D lighting, but no matter how hard I try, I just cannot fucking wrap my head around it.
>>108630427maybe graphics programming just isnt for you
Direct3D is much better organized.
>>108630216Try to implement a software renderer first.
>>108630225Fuck off, queer.
>>108630225>DON'T READ DOCUMENTATION OR WATCH TUTORIALS OR ANYTHING>JUST ASK A CORPORATE SLOPBORG TO SHIT OUT AN ANSWER
>>108630216what is confusing you exactly? opengl is a state machines, you create/delete objects (buffers, textures..., bind them (with glBind*) to a specific binding point (vertex data, texture data, there is a bunch of kinds) to use them next, set their properties then draw. think of binding as saying "this is the object subsequent functions will work on"
>>108630216Stop listening to retards and learn Vulkan. 1.3+ is very similar to normal, sane programming and you won't be stuck looking at a black box wondering why things aren't working.
>>108630216learnopengl.com/thread
>>108630216What can't you understand about it?
>>108630531good idea thanks anon the opengl llm will reside next to the ffmpeg llm
>>108630531if you weren't underage you'd know how fucking awful most tutorials and "documentation" is as teaching you something you know nothing about. opengl is even more egregious because state machines aren't beginner friendly due to their blackbox nature. with a LLM you can constantly piggy back and ask for clarification about a specific function or concept you do not understand.
>>108630216The Red Book has plenty of examples. An LLM should be able to shit out demo code for something simple like a box and then you can go from there. First time setup is usually the most annoying part.
>>108630582That's now how a state machine works. A state machine is a design paradigm in which separate states are decoupled from each other, and certain states can only change to certain other states. What you're saying has nothing to do with state machines at all.>>108630611basically the whole thing. what are vertex buffers? why the fuck is everything treated like 3D when I only want to do 2D?
>>108630624OpenGL isnt hard to learn
>>108630636>What you're saying has nothing to do with state machines at all.opengl revolve around states, it's a state machine
>>108630647cool story, op is still struggling and telling him that opengl isn't hard to learn accomplishes nothing.
Return to tradition.https://www.youtube.com/watch?v=QztHFzgGu4Q
>>108630624>If you weren't underage??? I'm 43.>with a LLM you can constantly piggy back and ask for clarification about a specific function or concept you do not understand.You could also ask someone who knows OGL well. You are a moron and probably a shill.>>108630627>>108630622Stop with this fucking garbage.
>>108630747>You could also ask someone who knows OGL welland wait hours or days in hope of getting somebody who will barely understand what you were awkwardly asking in the first place, and at best gives you an even more confusing explanation because they are autistic bugger eating faggots who dont understand what being a normal human being learning a new concept is like>and probably a shill.go back to stackoverflow, faggot
>>108630747https://huggingface.co/dayuan/ffmpeg-command-generatorits not garbage id keep a copy of this and ffmpeg over handbrake the age of having to RTFM is OVER
>>108630747>Stop with this fucking garbage.The Red Book is literally how I got started. Are you just attention whoring or did you want actual help? How can you be 43 and still act like a 13 year old?
>>108630905Don't underestimate boomers from third world countries, they're some of the most annoying and obstinate people you find on the internet
>>108630905I'm not OP, shit for brains.
>>108630654I still don't understand. Wouldn't it only have one state, "render stuff"? Why would it even need multiple different states?
>>108631150because the stuff you render has properties. for instance if you call glEnable(GL_CULL_FACE) your next draw calls will discard back faces (by default)...glEnable(GL_CULL_FACE)draw()...glDisable(GL_CULL_FACE)draw()draw()...glEnable(GL_CULL_FACE)draw()same shit when you bind objects with glBind* for use to decide what shader will be used by the next draw call and what vertex/texture/etc buffers will be used by that specific shader. and you enable/disable them by setting their ID to 0.you dont ever pass much to draw* functions, you mostly set states prior to calling drawing/frame buffers operations
>>108630947you're right, you're even more retardedkill all namefaggots
>>108631242to expand this is true not just for drawing but objects as well. for instance to change texture filtering to first bind the correct texture glBindTexture then call glTexParameteri with whatever parameters you want to set. every next call to glTexParameteri will affect the previously bound texture and nothing else. that's why opengl is often called a black box, because the memory you create and manipulate is mostly opaque.
d3d11 just works and dxvk makes your dx11 code work on linux or android with minimal overhead
>>108630654>it's a state machineNo, you retard. OpenGL is as much of a state machine as a light switch. It's just a statefull API.USB PD is a state machine, for example.
>>108631388>It's just a statefull API.so a state machine
>>108631397The point of state machines is to do something useful with their state. If a door is in a locked state it cannot toggle between opened and closed states. No state variables have that property in OpenGL. You just overwrite their values.>inb4 what if i bind a buffer that hasn't been created durrretard
>>108630636Vertex buffers? Basically when you draw shit you define what shape you want to draw (basically points, lines or triangles) and the vertex buffer(s) contain the locations of the edges (or if you draw points then those) of the things that you want to draw. As for why everythings 3D? Because the API devs were lazy (and you can just stuff a value of 1 almost anywhere they are required if you only draw 2D stuff)
do all of learnopengl.com and take notes as you go. If you do it in another programming language it will help with comprehension because you can't just copy paste shit. You have to want it, its not "impossible".t. pro paid graphics programmer after 5 years of struggling with it
>>108630636>what are vertex buffers?they are data buffers passed to the shader program and its data are associated to individual vertex (hence vertex buffer). At minimum you need a position for your vertex, but you can pass anything because its generic, opengl doesnt care what the data represent. you can pass multiple vertex buffers containing color, uv coordinates, normals... it's up to you what you do in the shader with those data.>why the fuck is everything treated like 3D when I only want to do 2D?because opengl is designed to rasterize triangles . 2D is a subset of 3D anyway, just ignore one dimension and you have 2D.
>>108630636>vertex bufferarray on the gpu that stores vertices (e.g position, normal, uv coordinates)>why is it 3D if I only care about 2Dbecause the api was designed for 3D. Targeting 3D means 2D works implicitly. For 2D you're just placing quads (two triangles) and texturing them. It's about GPU accelerationI would also ignore people telling you to learn Vulkan even though it's the better API. It's just so much boiler plate it will make you want to kill yourself unless you have the experience with the higher level API to understand why it exists in in the first place. When you find yourself wanting to do gpu driven rendering / compute shader experimentation that's when its time to switch apis, and even then if you don't give a shit about apple support OpenGL 4.6 can do this all. If you're going to use AI make sure you paste the actual opengl docs in and ask it to explain it so it doesn't hallucinate apis
>>108630252Vulkan made me appreciate just how easy to use OpenGL is.
>>108630216AI stuff can also teach you, I learned basic shaders stuff and compared between display lists and vbos, it was very interesting
>>108630622llms have a pretty easy time with ffmpeg in my experience.If-not, there's always https://github.com/dgr8akki/nano-ffmpeg
>>108630438How do you draw to the screen?
>>108634612You draw on a texture
>upload shaders to gpu>upload meshes to gpu>upload textures to gpu>select shader program to draw mesh with>select mesh to render>select texture to apply to mesh>drawIt's not that hard, if you're just getting a black screen use RenderDoc and check what's happening and what you're state is
>>108630523Sneed, sheer
>>108630427>OpenGL so that the code runs fasteryou can easily hit 2000fps in SDL if you just use an texture atlas for everything (also required or opengl for good fps).>special effects like dynamic 2D lightingIf you don't care about normal maps and per pixel lighting, I think you can use SDL_RenderGeometryRaw to set the color per vertex, and draw using a color modifier to darken your textures.This lighting system works well in minecraft, because lighting needs to scale well, but I admit for 2D you can get away with doing per pixel lighting with 100+ light sources well above 200fps on a steamdeck (but getting it working 200fps on shitty igpu's that can't play most games is another problem), and I think per vertex lighting isn't amazing for dynamic lighting (you can't hold your torch for light in of minecraft, because updating every tile every time you move is more expensive on the CPU & bandwidth than doing per pixel lighting.... but there is no reason you can't use both lighting systems together, in your case, you don't have shaders, but you could render every tile/sprite again with additive blending, you just need to darken the color significantly, this would be massively slower than doing it in a shader, but it would work, and in theory you could tesselate your tiles to make the per vertex color more accurate, but if you are able to zoom in/out very far, you now need to add in Level of Detail levels since triangles might be smaller than a pixel, which is bad).And SDL_RenderGeometry / SDL_RenderGeometryRaw is almost how OpenGL's fixed function API works, sort of like raylib. So that might prepare you a tiny bit (since the memory you put into these functions can be stored on the GPU in opengl instead of being uploaded every frame, but beware, bad opengl code could easily be slower than SDL due to implicit synchronization (sync points in DirectX terms). And a texture atlas is a massive performance gain. Check this:https://github.com/TeamHypersomnia/rectpack2D
>>108635176>but you could render every tile/sprite again with additive blending*in the radius of the light source, and I assume if you have a 2D game, you might has a field of view, and the same algorithm used for the Fov could be used for lighting.AND if you were using the FOV algorithm for lighting, you would not be saving much time on opengl (for dynamic lights!, for static lights, you can cache it), since this algorithm is going to be expensive and it will be the bottleneck for scaling your dynamic light sources (minecraft uses a floodfill for lighting, which means the torch will light up tiles that are around corners, I think?)It does get really complicated once you start thinking about walls, since you probably only want the side that has the light to have light on it (it really depends on the game art direction, "don't starve" doesn't need that, since there are no walls, but for other games, it lets you see light through walls). Sooo that means that now you need a special FoV algorithm just for lighting (probably not called FoV...)
>>108630531>frogshitter with an opinion
>>108635176>but you could render every tile/sprite again with additive blending**there is no point in doing that, it would be faster for a dynamic light to just modify the light of the tile, I don't know why I said you need to redraw with additive blending. But a really cheap looking way of adding a light would be by just drawing a "light.png" texture onto the screen with additive blending (I think this is how games add a flashlight).
>>108635448*Oh and I am showing my lack of knowledge since clearly I don't know that the blending equation is different than the blending functions...and the blending is always additive... unless you want to use the GL_DST_COLOR for the SRC, which is the "light.png" trick for flashlights (only really works for first person 3d games).
>>108630216If I can figure out Vulkan, you can figure out OpenGL
>>108630216vulkan is easier bro trust
>>108635448This picture confused myself for a solid 30 minutes, never really looked too hard at it.I personally use premultiplied alpha, because of the alpha blending of a GL_LINEAR texture (instead of a GL_NEAREST). otherwise you would get a black or white halo around your texture when you stretch it (depends on what color the editor chose to fill the invisible alpha pixels, some editors may have an option to fix this by filling in the alpha color using some Voronoi math, seen on 3d UV maps I think).So nothing is wrong, but I think having alpha higher than RGB is a bug if you were using premultiplied alpha correctly.But linear texture blending is rare, since most people don't like blurry textures, and it wont work with depth testing in 3D (requires manual sorting / false blending).
>>108635676I'm wrong again...Technically, alpha is ignored 100% by the default framebuffer on windows and linux I assume, but I forgot this bug applies to premultipled alpha so it would look like GL_ONE + GL_ONE for premultipled alpah (if nothing was fixed).The non premultipled option (for blending PNG's and such):SRC = GL_SRC_ALPHADST = GL_ONE_MINUS_SRC_ALPHASo the image is darker for both options...Very sorry for the long chain of blog posts. I hope it makes some sense to someone.
>>108630216Get into Metal. Out of the big three (DirectX 12, Vulkan, Metal) it is the least confusing one.
Where does one learn modern OpenGL and I don't mean OpenGL 3.3 by that?
>it's an everyone lies and pretends this shit is easy so they can feel like they're smarter than everyone else episode
>>108630216i mean yeah OP, this domain of SWE is notoriously hard. most /g/eets are unemployed larpers
>>108630216If you can't even into OpenGL, you need to switch to a different interest. Maybe become a prostitute.
>>108635803modern opengl is opengl 3.3there are a couple AZDO stuff in gl 4+ but you are better off in any other API since gl does not have the best mesh shader support.mesh shaders are meh because performance is hard to grasp.AZDO is meh because CPU overhead isn't a big concern unless you are a AAA engine.and GL still has issues with having a fat driver (you don't know how every GPU will run opengl, Angle fixes this by running ontop of a thin/stricter driver like Vulkan or DX11)
>>108636066Can you sell me on mesh shaders? The only use case I was able to come up with was implementing something like fisheye cameras.
>>108630216it's the easiest graphics api there is, especially 1.x versions. if it already filters you, just give it up.
>>108635838OpenGL is well documented with a good reference and plenty of examples and tutorialsThe API design is fucking stupid and vague but that doesn't really matter, you can get something working
>>108630747holy fuck, imagine being a tranny at 43
>>108630252vulkan just has annoying boiler plate to get it going, once everything is initialized it's just as easy as OpenGL, but all the setup is fucking annoying
I don't like opengl and never did, I want to learn 3d programming, but I don't want to waste too much time either, I want to get a game done not get lost in the details.So anyone who has experience with both directx11 and vulkan what are the differences?
>>108630216Why are you learning this 30 years old confusing and crappy API?Just use SDL3 gpu wrapper or wgpu or something like that
>>108630216Jonathan Blow says OpenGL is obsolete and no one should start learning graphics programming with it
>>108636436Sounds like you should be a framework baby, sticking to Unity or Godot.
>>108636467I already tried unity, unreal engine, godot, raylib, love2d and some other stuff, and currently I am making a 2d game in C and SDL, but in the future I want to make 3d games.I don't like engines and how they force me to do things, I want to keep it code focused.
>>108636475>allegedly tried all that stuff>gets filtered by openglmaybe "try" things for more than 5 minutes?
>>108636485I didn't get filtered by opengl, learn to read mongrel.I don't like opengl because of the driver implementation of each gpu vendor doing their own random shit, and I don't want to deal with that.But I guess I'm wasting my time with randoms on 4chan who's job is full time shilling of things they never used themselves.
>>108636436Vulkan is cancer and you'll spend a huge amount of time to deal with all its bullshit boilerplate and bureaucracy (that doesn't even map to anything real in modern hardware).I don't really know about directx11.I would highly recommend using something modern like SDL3's gpu wrapper or wgpu.It's great for 2d games and for learning, but making real good looking 3d games with anything but godot, unreal or unity is going to be quite hard. You won't be getting a game done for the first 2-3 years, probably. Unless you really enjoy getting lost in the details of 3d rendering I don't recommend it.
>>108636460Does he offer an alternative?
>>108636516>I don't want to deal with that.You don'tLiterally inventing problems before you've even started lol
>>108630216bro I learned dx12 in a weekend
>>108630582For me it's contexts. Why are context swaps invalidating VAOs of all things? If you are wrapping opengl with a library you will need lots of bullshit to handle this case across the api.
>>108637123The API is too simple. Context loss can mean anything so it does what most drastic event would necessitate.
>not using 3dfx glidengmi
>>108637123use case for swapping contexts?
>>108630216Yeah. Everything that matters is hidden, global state that lives somewhere in the driver. It's an abomination.
>>108637123You should avoid context swapping whenever possible
>>108636516>I didn't get filtered by opengl,Meanwhile in the OP>It's impossible. I can't do it. It's too fucking confusing.
>>108637156>>108637205Switching between fullscreen and windowed, unless there's a way to that while preserving context.
>>108637247>fullscreenplease dont use exclusive fullscreen in 2026
>>108637247Remake the contextAlso yeah don't use exclusive fullscreen
>>108637247>>108637256exclusive fullscreen is largely dead unless its a legacy app (dx9 era or older)
>>108637297what does this chart mean
>>108637159>hiddenYou can just ask it?https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glGet.xhtml
>>108637304theres multiple ways for your gpu to present to screen or flip. anything but hardware flip is bad. exclusive fullscreen means using composed flip unless you're on Windows where they have FSO and DirectFlip in DirectX.
>>108637348>unless you're on Windowsnobody is making games for Linux bro
>>108637369this affects anything that uses the gpu. not just games. hw accelerated browser for example.
>>108630747go touch some grass unc
>>108637388somehow I don't think the OP is making a browser
>>108637402OP is using a comptuer and computer requires graphics card to display something. Everything you see on your screen is affected by this.
>>108637415>computer requires graphics card to display somethingNot for me. I've hooked up a sound card to an etch-a-sketch.
>>108630225>have you ever considerSAAAAAR
>>108637246I'm not the OP you tard.>>108636518Thanks, will stay away from vulkan.>>108637061There's a german dev who recently released his game, for the demo he used opengl and had a lot of bugs that happened only for very specific gpus, usually amd ones but not only. In the end he switched to dx11 and they were all gone.
>>108637828>ancedotal evidenceI've released 3 OpenGL games with few issues
>>108638246post them, you probably released to 10 players, this guy made over 500k$ from his game, so a lot more varied hardware running it.
>>108638319hundreds of thousands of players at leastthe point is do your own research instead of "one guy told me"
>>108630252Vulkan is easier than OpenGL, you just need to understand the basic principles. With OpenGL it can be really fucking annoying to figure out why something doesn't work.
>>108630531>tripfagging on /g/
>>108637828>second iteration of a software doesn't suckWhoa, what an unexpected turn of events! Surely this can't be attributed to change in skill?
>>108638676>Vulkan is easier than OpenGLpiss off
>>108638716He gave his reasons for why opengl sucks but I don't remember them, and jblow hates opengl too so...I also had bad experiences back in the day running amd cards on emulators that used opengl, it worked fine on nvidia tho.
>>108638676opengl is a fat driver, vulkan is a thin driver.the only simplicity you get from vulkan is the lack of unknowns. And I would hope the validation layers are better than the opengl debug extension (I bet the standard debug stuff, the stuff that causes VK_ERROR would be pretty much the same as opengl debug callbacks, but I see that there are a bunch of other validation layers, would you like to explain which ones you like to use?)but if you are just drawing triangles, opengl is massively more simple.One problem with opengl is that debugging tools like renderdoc and nvidia nsight can't always support shader debugging, AKA being able to step through each line of code in the shader.Opengl technically supports shader debugging in renderdoc, they added it in last year, but it did not work for my project (I probably need spirv compatible shaders, or something, but I am targeting webgl so I don't really care).(I used the Angle vulkan backend + enable spirv debug info for renderdoc shader debugging, which was not very clean, I never actually used it, but I will still use angle with DX11 since it makes fullscreen alt-tabbing smoother and fullscreen overlay support, you can fix this with Nvidia control pannel opengl/vulkan present method->DXGI, but I admit I don't fully understand the scope of the issue, all I know is that DirectX just works better in fullscreen, the only bummer is that vulkan now has a VK_KHR_device_fault and that would let me make Nvidia Aftermath dumps IF you wrote a shader that ends up running in a infinite loop and causes the context to die (or something else? maybe bad memory accesses? or explicit aborts in a compute shader?), you can also use the robustness extension which requires you to recreate all the GPU API stuff, and if you wanted to test robustness without making a "bad shader", you could use llvm pipe (probably only on linux): www.phoronix.com/news/Mesa-26.1-Fake-GPU-Reset