pouët.net

how do i get started with opengl and shader coding?

category: code [glöplog]
*chuckles nervously while deleting old code*
added on the 2024-07-31 10:41:45 by sagacity sagacity
i'm pretty sure my code is worse but at least i don't pretend it to be any good
added on the 2024-07-31 16:53:52 by havoc havoc
Gargaj's critique of Defiance "system" is mostly right, except...

Quote:

(...) it's some of the worst code I've seen.

Everything is in globals, (...)


But, but... OpenGL is built around *global state machine* paradigm.
Also many libraries are doing it for "simplicity", for example, ImGui.
Of course, Defiance naive implementation is way worse, as it's unnecessarily keeps everything in globals.
added on the 2024-08-01 00:17:16 by tomkh tomkh
You can still wrap the globals into something sensible.

Although, in all fairness, I've been slowly developing a new thing for my personal use and I've gone for modern C++ but with C-like simplicity. Very little fancy features, very little abstraction. Just code that does its thing. Even some global objects...
added on the 2024-08-01 13:28:30 by Preacher Preacher
defiance got banned because of his (maybe misguided) attempt to support his (maybe not so leet) demo tool ?
added on the 2024-08-01 13:40:38 by Navis Navis
Preacher: it's fully understandable. Using immutable functions or at least functions without side-effects everywhere should be in theory the way to go, but in practice it require to pass many arguments, context etc...to every single call, which is annoying. That's why OpenGL, ImGui, etc... are using global states.

The other option, in C++, is to use OOP and put context into a class member, but it sucks, cause enforces you to use OOP design all the way, which usually ends up in weird design conundrums. That's why many people use DOD or even go back to good old C style.

AFAIK there are languages like Scala that have what they call implicit arguments. So in a function call you don't have to explicitly pass implicit arguments as they will be taken automatically from the context (local scope I believe?). But I never really used Scala, so hard to say how it feels in practice.
added on the 2024-08-01 13:55:55 by tomkh tomkh
Quote:
But, but... OpenGL is built around *global state machine* paradigm.

OpenGL is pretty bad, so that's not a counterargument.
added on the 2024-08-01 18:22:23 by absence absence
Oh boy, so disagreeing with gargaj is now a cause of getting banned?
added on the 2024-08-01 19:05:55 by kusma kusma
nonsense, that dude was warned to change his behaviour dozens of times but never listened.
added on the 2024-08-01 19:56:10 by havoc havoc
Quote:
Quote:
But, but... OpenGL is built around *global state machine* paradigm.

OpenGL is pretty bad, so that's not a counterargument.


It is, since Garaj was complaining about using global variables in Defiance's code as an argument to not use it and at the same time recommending OpenGL tutorials.

Other than that, yes, OpenGL is not up to modern standards, but was perfectly fine back in the days.
added on the 2024-08-01 20:07:26 by tomkh tomkh
I use mostly immediate mode and display lists, like it is 2002. So what, it does the job and I m happy. Killer of framerate in my case is shaders.
added on the 2024-08-01 20:52:35 by Navis Navis
Quote:
OpenGL [...] was perfectly fine back in the days.

I'd argue that its implicit state and "black screen" flavour of error handling were never anywhere near perfectly fine, but as long as it floats your boat.
added on the 2024-08-01 21:08:33 by absence absence
Quote:
"black screen" flavour of error handling


So you never used glGetError? ;)
added on the 2024-08-01 22:14:17 by tomkh tomkh
It's clear that you haven't, if you think that's a solution. :P
added on the 2024-08-01 23:28:23 by absence absence
havoc: I can't find anything apart from disagreeing about coding practices. Care to enlighten me with a link or two? The optics of this is pretty terrible from my point of view...
added on the 2024-08-01 23:37:06 by kusma kusma
kusma: nope
added on the 2024-08-02 00:00:04 by havoc havoc
OK, so you're just labeling things you don't want to be true as nonsense. Whatever dude.
added on the 2024-08-02 00:02:09 by kusma kusma
nah i just don't have the time/willpower to look that crap up (just like you, apparently)
added on the 2024-08-02 00:05:37 by havoc havoc
Oh, I tried to look it up. It just doesn't seem to be there.

This is pretty blatant admin abuse from what I can tell.
added on the 2024-08-02 00:11:50 by kusma kusma
6 minutes... ¯\_(ツ)_/¯
added on the 2024-08-02 00:16:14 by havoc havoc
I'm not sure where you get that number from, but even if so, how's that not plenty when there's supposedly dozens of warnings given. I can't find a single, and it seems you can't either.
added on the 2024-08-02 00:21:00 by kusma kusma
yeah yeah whatever, just keep pushing your narrative
added on the 2024-08-02 00:22:34 by havoc havoc
for the record and in defence of Defiance - he is a good guy and one of ours in the small greek scene, and pretty active, at least as production comments go (where he is polite and reasonable).
I dont know what he did wrong, but he is definitely not a lamer. His tool might not be the best but so what, we are here to argue over these matters for all eternity... No newbie will ever be "damaged" by his tool, more so than watching nextempire demos or doing iq tests on hugi.
added on the 2024-08-02 00:52:38 by Navis Navis
My narrative? Thats rich. I'm not even a party in the conflict, just a bystander who spoke up against what happened. You're the one who is pushing a narrative without backing it up.
added on the 2024-08-02 00:55:14 by kusma kusma
Quote:
Oh boy, so disagreeing with gargaj is now a cause of getting banned?

obviously this wasn't a narrative... OH WAIT
added on the 2024-08-02 01:05:00 by havoc havoc

login