3 ms·
> I don't agree that people like to bind an object to a global variable, execute a global procedure, and unbind it. Does that sound like the API of anyone's dre
by Narishma 9y ago
> I don't agree that people like to bind an object to a global variable, execute a global procedure, and unbind it. Does that sound like the API of anyone's dreams? The binding and unbinding sounds like pure overhead to me.
Isn't that how OpenGL works?
- robotresearcher 9y agoNot in the old days, no. glColor3f( 1,0,0 ); glBegin( GL_POLYGON ); glVertex3f( 0,0,0 ); glVertex3f( 1,1,0 ); glVertex3f( 1,2,0 ); glEnd();
- kuschku 9y agoThat's exactly the global state I am complaining about. The current polygonal environment is a global state variable. The current vertex is a globally set variable (as you'll notice once you try to set textures and colors, becayse glVertex3f just sets a global variable), etc. Try throwing two threads at this, you'll get hilarious results, and there's no way to propeely fix this. And OpenGL 1.0 to 1.5 and then 2.0 made it even worse. You allocate a buffer, fine. But to write to it, you first bind the buffer to a global variable, then use a call writing to a global variable.
- nhaehnle 9y ago> The current vertex is a globally set variable (as you'll notice once you try to set textures and colors, becayse glVertex3f just sets a global variable), etc. Bad example. glVertex3f is the one function (among the various glColor, glMultiTexCoord etc.) which doesn't set global state. It actually triggers a vertex to be sent (which takes its attributes from the global state you mentioned). But all this is pretty moot, because it's not how OpenGL has been meant to be used in ages. Use the core profile, where these functions don't even exist any more. > You allocate a buffer, fine. > But to write to it, you first bind the buffer to a global variable, then use a call writing to a global variable. Also outdated, though not by quite as much. Direct state access (DSA) has been a thing for a pretty long time, now.
- kuschku 9y ago> Also outdated, though not by quite as much. Direct state access (DSA) has been a thing for a pretty long time, now. If it just worked for everything... Even in 4.5 there's many functions that have no direct state version yet, and many others were only introduced in 4.4 and 4.5 (meaning it won't be really compatible anywhere). For me, the #1 advantage of Vulkan is having DSA for everything, just working.
- nhaehnle 9y ago> Even in 4.5 there's many functions that have no direct state version yet Which ones are you missing in particular?