-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose the raw field of context #182
Comments
I'd prefer to add these functions to glow instead if possible. One problem with exposing |
Can we have a sort of contributing.md file ? would help some new people to know how to start contributing as this seems like one of the easiest rust projects to contribute to, especially when they are already familiar with opengl. |
Yeah absolutely 👍 I'll try to create one sometime soon |
oof, 3 months is a long time. but just wanted to see if there is some kind of progress related to separating platform specific functionality #76 (comment) . pretty much none of the modern opengl functions exist in webgl(2) and they will all be if there's a sort of winit (platformEXT trait) functionality, lets say Although, I don't know how something like gl functions that are in ARB extensions are dealt with. maybe another trait? where everything is allowed. a good example is bindless textures. to quote khronos wiki page I only added some dsa functions in #191 , and before i start playing with more stuff like multidraw or indirectdraws or bindless textures, I wanted to see if i could avoid polluting webgl context code which will be a lot of unimplemented!() and unnecessary autocompletions. |
I would suggest that a trait like that might not belong in this crate which, as you've pointed out, is more about bridging the gap between OpenGL and WebGL than creating a Rusty interface for all of OpenGL. Personally, I like that, generally, the API surface defined in this crate approximates the features that are usable on both platforms. I think I'd rather see a, for example, |
ah. my bad. my use case of glow is to just have a clean wrapper instead of raw gl bindings with raw pointers and casts flying around everywhere. i asked in the rust gamedev discord and was told that glow allows stuff that is technically not a strict subset of the es/web/desktop gl versions. like c0d566e . either the trait way or a separate crate glow-gl4-ext way is fine for me. |
Yeah, you're 100% right that there are some places where the practical desire for this to be generally useful has overridden the aspirational desire to represent the API available on both platforms. My personal feelings are that a push to implement all of gl46 in this pseudo-Rusty style that glow does might be too big a departure from the generally stated goal of this crate. But, hell, I'm not the maintainer. :P |
It's same for me, I don't use the webgl side of glow at all 😅, and I'm well aware that it's the whole point of this crate |
@coderedart for now I think it's fine to add them to the regular We could always consider restructuring it later if this eventually causes problems (e.g. bloating the web backend too much, too confusing when referencing documentation, etc.). In that case we could probably move them into a separate GL-only trait (possibly also behind a feature that's off by default or separate crate). I'd also like to add doc comments to each function to clarify which versions/backends/extensions support it, which would be a simple way to improve ergonomics in general. |
Has anything changed regarding this issue in the last two years? like exposing the raw fn pointers behind a feature like If it feels like we should not expose it, then its probably time to close this issue. |
Also asking for this half a year later. I am migrating my codebase from |
Hi @polyzium 👋 Could you provide an example of the problem you're running into, and how the raw field would help? Is there a crate you're using for imgui SDL support? |
@grovesNL As for imgui, I am using I know what people might ask me, why didn't I use Excuse me for the rant, but as you can see I am quite lost. |
@polyzium I was wondering how exposing the native context itself would help. Is it because the names are slightly different and you want to use the C names?
|
One very obvious issue that I faced in the past is following a gl tutorial and writing a basic game/app. Now, if I wanted to use a library which uses If glow exposed the raw context, then I could just do pub struct MyGlContext(glow::Context);
impl AsRef<glow::Context> for MyGlContext {
fn as_ref(&self) -> &glow::Context {
&self.0
}
}
impl AsRef<RawDesktopGlContext> for MyGlContext {
fn as_ref(&self) -> &RawDesktopGlContext {
&self.0.raw // something like this
}
} Now, glow based libraries which take eg: glGenBuffers is the usual thing people learn first in opengl. glow doesn't have that. glow provides create_buffer (singular) instead. If i'm learning modern opengl, I will learn about createBuffers (plural). It very much looks like glow's create_buffer, but its not. Instead it is implemented with glGenBuffers behind the scenes. At this point, I am comfortable enough with gl/glow that I can more or less figure out the glow's API, but back then, it was one more challenge when learning openGl. |
Yeah mostly it is exactly that. I am pretty new to OpenGL but I have a basic understanding of graphics, having worked with programs like Blender before, so it would be helpful if I could use C names, or at least snake_case versions of those. also as @coderedart pointed out this is the exact issue I have faced. Either I port my app to |
I'm wondering why you're both wanting to use the |
I initially thought of using this one, but it seems like it works only with older imgui-rs and I didn't want to downgrade it just to get it to work. |
I just cloned it and bumped the allowed version of imgui. It seems to work just fine. I'm not trying to dissuade you, necessarily, from any pedagogical or functional gripes you may have with |
That makes sense, although there are only a few functions like I'd really recommend trying out a switch to |
imgui is just an example. The ecosystem has settled on I think focusing on any particular example would be going too offtopic, as there will always be workarounds. This issue was made when I was just learning openGL (right after learning rust) and back then, it would be really hard to think about forking and patching rust code . Even now, This feature is still useful to me, as I am more likely to use a cool modern gl function if its readily available. But its not absolutely necessary. We can simply workaround by having a fork of glow that exposes the gl fns publicly and Override Crates.io Dependencies to point glow to my fork. This issue is about whether glow would like to expose its raw fns behind an For more general discussion of how to expose platform specific gl functionality, see #76 (comment) . |
i'm learning OpenGL and there's a lot of modern opengl functions/features that i would like to try like DSA or MultiDraw or Indirect rendering. but glow doesn't have most of these functions yet.
but if the core context was exposed either through an unsafe function or by just making the
raw
field of the Context Struct public, i can just use that to try out all the new latest stuff.The text was updated successfully, but these errors were encountered: