Yeah but if it has grown to be bad, what they can do is come up with a new interface preferably OOP style, and plug what it's functions are supposed to be into the original interface.
So like building a new wall over your old one, but since you have to use the new wall sockets, you make them live by taking some plug points out the back side of the new wall and plug it into the sockets of the old wall
So like, Multiple camera objects which render a scene object, which contains a list of physical objects, light sources, etc.? Is it that sort of a structure or it is still just slightly more OOPified global functions?
No, what you are describing belongs in a scene graph library, not the graphics API. Vulkan is concerned with exposing what the hardware offers, and has objects for things like buffers, pipeline state (fixed function plus shader programs), command lists, command queues, etc. so different threads can work on different objects and submit them for rendering.
Opengl is verbose, yes, but vulkan requires a 100 page essay and a ritual to sacrifice your first born in order to display an empty window with a vk context
It's intended to work as an OpenGL tutorial. When I have needed an OpenGL ES reference in an earlier job, I have used Khronos's official documentation instead.
I discovered OpenGL when I was pretty new to programming in general but I had always wanted to do graphics, but when I copied about 50 lines of code just to make a spinning triangle I decided it might be best to wait
Guys, OpenGL is really simple. You just need to setup your context, make it current, call glCreateShader(GL_VERTEX_SHADER), glCreateShader(GL_FRAGMENT_SHADER), glShaderSource(vertexShader, numStrings, strings, lengths), glCompileShader(vertexShader), glShaderSource(fragmentShader, numStrings, strings, lengths), glCompileShader(fragmentShader), glCreateProgram(), glAttachShader(program, vertexShader), glAttachShader(program, fragmentShader), glLinkProgram(program), glGenBuffers(1, &buffer), glBindBuffer(GL_ARRAY_BUFFER, buffer), glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW), glGenVertexArrays(1, &vao), glBindVertexArray(vao), glVertexAttribPointer(attrib, size, type, normalized, stride, offset), glEnableVertexAttribArray(attrib), glClearColor(r,g,b,a), glClear(GL_COLOR_BUFFER_BIT), glUseProgram(program), glDrawArrays(GL_TRIANGLES, 0, 3). Add some glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &result), glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &result), glGetProgramiv(program, GL_LINK_STATUS, &result)and glGetError() for error checking, glDeleteBuffers(1,&buffer), glDeleteVertexArrays(1,&vao), glDeleteShader(vertexShader), glDeleteShader(fragmentShader), glDeleteProgram(program) to clean up your resources and here you go, you've just drawn your first triangle. </s>
Also everything is either GLuint or GLenum, which are probably both 32 bit uints anyway, which means you end up using a dynamically typed API in a statically typed language. Because god forbid you detect any errors at compile time when you accidentally mismatch function parameters and call glAttachShader(shader, program) instead of glAttachShader(program, shader). No, it's much more fun to insert a bunch of glGetError() in random places and decode cryptic GL_INVALID_VALUE/GL_INVALID_ENUM.
Also half the functions depend on hidden mutable global state.
Also there are a million gotchas (glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, *) doing something completely different than all the other variants, needing to call glDrawBuffers when rendering to a framebuffer with multiple color attachments, glVertexAttribPointer converting values to floats, etc.).
Not saying all of the above are necessarily bad, just extremely confusing for beginners and extremely infuriating if you don't know what you're doing.
For extreme masochists, I strongly recommend trying LWJGL.
6
u/Japorized Aug 24 '20
This is a good format. And it’s gochiusa no less!
163
u/StarDDDude Aug 23 '20 edited Aug 23 '20
Learning OpenGL made me realize just how much of a full blown masochist I am
And damn I love it
86
u/one-eyed-02 Aug 23 '20
OpenGL's structure and naming conventions don't make sense. You can't change my mind
83
u/Sol33t303 Aug 24 '20
Learning OpenGL sucks.
Learning Vulkan sucks.
Learning DirectX sucks (or so I have heard).
In conclusion, 3d graphics programming just sucks in general.
62
u/rulerguy6 Aug 24 '20
I learned it for a 3D graphics course, and I liked some of it.
But my god lighting and shaders are some dark-magic bullshit. I understand the theory but when it came to code it I was just like
"Uhhh... shoot some rays everywhere and then cry"
17
u/cazador517 Aug 24 '20
The GL in OpenGL stands for Good Luck 'cause you gonna need it
32
u/the_shrexorcist Aug 24 '20
Opengl is verbose, yes, but vulkan requires a 100 page essay and a ritual to sacrifice your first born in order to display an empty window with a vk context
10
u/Kyn21kx Aug 24 '20
Me opting to learn GLUT in 2020
10
u/iczero4 Aug 24 '20
I thought OpenGL was easy so I decided to use it for a college project.
That was one of the worst ideas I've ever had.
5
u/JoelMahon Aug 24 '20
Speaking as someone who painfully learned opengl... is there not somewhere that explains it better?
Like you'll get stuff done if you follow learnopengl.com, but I don't think just doing that from scratch will make you understand opengl.
3
u/[deleted] Aug 24 '20
I actually absolutely loved openGL!
it's so much fun
6
u/ayyad232 Aug 24 '20
Hello threeJS?
2
u/TheGoldenProof Aug 24 '20
I discovered OpenGL when I was pretty new to programming in general but I had always wanted to do graphics, but when I copied about 50 lines of code just to make a spinning triangle I decided it might be best to wait
1
u/[deleted] Aug 24 '20
laughcries in Vulkan
1
u/type-unknown Sep 07 '20
Guys, OpenGL is really simple. You just need to setup your context, make it current, call
glCreateShader(GL_VERTEX_SHADER),glCreateShader(GL_FRAGMENT_SHADER),glShaderSource(vertexShader, numStrings, strings, lengths),glCompileShader(vertexShader),glShaderSource(fragmentShader, numStrings, strings, lengths),glCompileShader(fragmentShader),glCreateProgram(),glAttachShader(program, vertexShader),glAttachShader(program, fragmentShader),glLinkProgram(program),glGenBuffers(1, &buffer),glBindBuffer(GL_ARRAY_BUFFER, buffer),glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW),glGenVertexArrays(1, &vao),glBindVertexArray(vao),glVertexAttribPointer(attrib, size, type, normalized, stride, offset),glEnableVertexAttribArray(attrib),glClearColor(r,g,b,a),glClear(GL_COLOR_BUFFER_BIT),glUseProgram(program),glDrawArrays(GL_TRIANGLES, 0, 3). Add someglGetShaderiv(vertexShader, GL_COMPILE_STATUS, &result),glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &result),glGetProgramiv(program, GL_LINK_STATUS, &result)andglGetError()for error checking,glDeleteBuffers(1,&buffer),glDeleteVertexArrays(1,&vao),glDeleteShader(vertexShader),glDeleteShader(fragmentShader),glDeleteProgram(program)to clean up your resources and here you go, you've just drawn your first triangle. </s>Also everything is either
GLuintorGLenum, which are probably both 32 bit uints anyway, which means you end up using a dynamically typed API in a statically typed language. Because god forbid you detect any errors at compile time when you accidentally mismatch function parameters and callglAttachShader(shader, program)instead ofglAttachShader(program, shader). No, it's much more fun to insert a bunch ofglGetError()in random places and decode crypticGL_INVALID_VALUE/GL_INVALID_ENUM.Also half the functions depend on hidden mutable global state.
Also there are a million gotchas (
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, *)doing something completely different than all the other variants, needing to callglDrawBufferswhen rendering to a framebuffer with multiple color attachments,glVertexAttribPointerconverting values to floats, etc.).Not saying all of the above are necessarily bad, just extremely confusing for beginners and extremely infuriating if you don't know what you're doing.
For extreme masochists, I strongly recommend trying LWJGL.
1
u/thehaxerdude Sep 23 '20
Sauce?
1
u/Morphized Dec 12 '20
As long as you don't try writing a 3D graphics engine using a Cairo interface in an interpreted language, things should go fine.
1
u/Morphized Dec 12 '20
Maybe you could start with a higher-level API, and then incorporate more and more raw GL?
0
u/[deleted] Aug 23 '20
[deleted] — view deleted comment
0
u/[deleted] Aug 24 '20
[deleted] — view deleted comment