pouët.net

how do i get started with opengl and shader coding?

category: code [glöplog]
Quote:
I think what Preacher and Sesse seem to be pointing to can be described to a degree by the old “Hello world”. It couldn’t be more trivial to tease the “Hello world” out of all 8-bitters. Even if you were a caveman. Today?

I feel like "Hello World" is no longer a valid example in a world of graphical user interfaces; with Visual Studio you can have a window with buttons running basically without even writing a single line of code, just next-next-next through a template wizard.

But you can get to drawing stuff even sooner with even less: I highly recommend watching https://hello.processing.org/ as an example.
added on the 2024-08-25 23:55:33 by Gargaj Gargaj
Quote:
it is basically impossible to impress people

Yes, but that's where it becomes a cultural problem.
added on the 2024-08-25 23:56:21 by Gargaj Gargaj
Quote:
Unless you want to go into oldschool, it is basically impossible to impress people
I dare you to make a C-64 demo that impresses me.
added on the 2024-08-26 03:45:27 by Krill Krill
Quote:
I highly recommend watching https://hello.processing.org/ as an example.


Yes, I'm familiar Processing (well OK P5.js actually, but it's the same thing) and I really like the concept. I think it's great. On a side note, I've even seen it used to write proper apps too.
added on the 2024-08-26 09:31:33 by 4gentE 4gentE
I'd like to talk about a related question: How long will OpenGL last?

I stole code snippets from various sources 15 years ago to create a kind of demo/game framework using Visual C++ and OpenGL. The programs created with this framework still work on modern configurations. But how long will that situation last?
added on the 2024-08-26 11:18:24 by Adok Adok
Quote:
I highly recommend watching https://hello.processing.org/ as an example.


I'm not sure if I ever saw someone so annoyingly enthusiastic, but the content is good stuff, true. :D
added on the 2024-08-26 11:57:43 by kb_ kb_
Quote:
How long will OpenGL last?

Native support is up to graphics card vendors, but even without that there are translation layers to run it on Direct3D, similar to how web browsers support OpenGL ES on desktop. Like all the other legacy APIs, it's not going away anytime soon.
added on the 2024-08-26 12:34:05 by absence absence
So, progress update. I’ve checked out the places you’ve shown me and decided to settle on Glitter. I was finding it really difficult to figure out GLFW and compiling, since despite knowing a bit of C and C++, I didn’t really know how to do much when it came to compiling. So to save me stress in the short term and passion in the long term, I decided to just start at square 1. I intend to fully understand everything though, so I won’t settle here once I understand enough to actually write it myself. Thanks everyone from heaven and back, especially Gargaj, for pointing me in the right direction!
also, sorry for taking so long!
glitter was a lie.

the sheer amount of errors i got while trying to mingw32-make -k this was way too much to be called "ready out of the box".

seems like most errors were from assimp (and from my mingw header files for some reason. i never modified them).

here's a sample:
Glitter\Glitter\Vendor\assimp\code\AssetLib\FBX\FBXDeformer.cpp:82:20: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
82 | const Element& TransformLink = GetRequiredElement(sc,"TransformLink",&element);

repeat one miillion times.
almost forgot:

these two are unique:

C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_algobase.h:452:30: error: 'void* __builtin_memmove(void*, const void*, long long unsigned int)' forming offset 4 is out of the bounds [0, 4] [-Werror=array-bounds=]
452 | __builtin_memmove(__result, __first, sizeof(_Tp) * _

and

In file included from C:/msys64/ucrt64/include/c++/14.1.0/bits/specfun.h:43,
from C:/msys64/ucrt64/include/c++/14.1.0/cmath:3898,
from C:/Users/User/Desktop/Glitter/Glitter/Vendor/assimp/include/assimp/vector2.h:53,
from /Glitter/Glitter/Vendor/assimp/include/assimp/types.h:64,
from /Glitter/Glitter/Vendor/assimp/include/assimp/IOStream.hpp:53,
from /Glitter/Glitter/Vendor/assimp/include/assimp/DefaultIOStream.h:55,
from Glitter/Glitter/Vendor/assimp/include/assimp/Exceptional.h:49,
from /Glitter/Glitter/Vendor/assimp/include/assimp/BaseImporter.h:52,
from /Glitter/Glitter/Vendor/assimp/code/AssetLib/MDL/MDLLoader.h:50,
from \Glitter\Glitter\Vendor\assimp\code\AssetLib\MDL\MDLLoader.cpp:51:
In static member function 'static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = long unsigned int; _Up = long unsigned int; bool _IsMove = false]',
inlined from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = long unsigned int*; _OI = long unsigned int*]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_algobase.h:521:30,
inlined from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = long unsigned int*; _OI = long unsigned int*]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_algobase.h:548:42,
inlined from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = long unsigned int*; _OI = long unsigned int*]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_algobase.h:555:31,
inlined from '_OI std::copy(_II, _II, _OI) [with _II = long unsigned int*; _OI = long unsigned int*]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_algobase.h:651:7,
inlined from 'std::vector<bool, _Alloc>::iterator std::vector<bool, _Alloc>::_M_copy_aligned(const_iterator, const_iterator, iterator) [with _Alloc = std::allocator<bool>]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_bvector.h:1342:28,
inlined from 'void std::vector<bool, _Alloc>::_M_reallocate(size_type) [with _Alloc = std::allocator<bool>]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/vector.tcc:1054:40,
inlined from 'void std::vector<bool, _Alloc>::reserve(size_type) [with _Alloc = std::allocator<bool>]' at C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_bvector.h:1130:17,

i'm tired.
The Glitter github readme seems to say you should be using Visual Studio, not Mingw's GCC. In theory GCC should also work but I suppose the Glitter code isn't superportable?

Anyway, the Visual Studio community edition is free and can be downloaded at https://visualstudio.microsoft.com/vs/community/
added on the 2024-09-10 21:20:08 by sagacity sagacity
the reason i actively stand away from vs is because the day i install it will be the last day on earth for my pc.

also, i prefer FOSS software as much as possible, so yeah.
Ok, fair enough. In that case, good luck compiling :)
added on the 2024-09-10 22:09:25 by sagacity sagacity
after trying again in VScode and this is what i know:

b3GpuParallelLinearBvh.h
-warning LINE 88 COL 30:
ignoring attributes on template argument 'cl_long' {aka 'long long int'} [-Wignored-attributes]

/C:/msys64/ucrt64/include/c++/14.1.0/bits/stl_algobase.h (AKA: A KEY INCLUDE FILE.):
error LINE 452 COL 30:
'void* __builtin_memmove(void*, const void*, long long unsigned int)' forming offset 4 is out of the bounds [0, 4] [-Werror=array-bounds=]

the rest are mainly deprecation warnings
You can probably just rip out ASSIMP for now, it's just a mesh/scene loader, you can try adding it back later, once everything else works.
added on the 2024-09-10 22:44:05 by Gargaj Gargaj
Ironically as far as I can tell the main.cpp provided with Glitter doesn't even use ASSIMP, so just trim it out from the root CMakeLists.txt and see where that goes.
added on the 2024-09-10 22:52:26 by Gargaj Gargaj
Regarding __builtin_memmove error: Recent versions of gcc are producing false positives on array bound checking in STL.

Try to find the "-Werror=array-bounds" string in the makefile and remove it so that this warning isn't treated as a compilation-stopping error.
added on the 2024-09-11 13:14:57 by Fell Fell
TBH on second look I'd remove both ASSIMP and Bullet; neither of those are necessary for just starting out.
added on the 2024-09-11 20:44:30 by Gargaj Gargaj

login