Skip to content
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

missing glMatrixMode and glTexCoord2f #548

Open
markkimsal opened this issue Jun 6, 2024 · 1 comment
Open

missing glMatrixMode and glTexCoord2f #548

markkimsal opened this issue Jun 6, 2024 · 1 comment

Comments

@markkimsal
Copy link

Every OpenGL tutorial I come across on the internet references these functions, yet they aren't in this library.

This library has a function TexCoordP1ui which does not seem to be part of the OpenGL spec and also has no documentation.

What am I not understanding?

@natanalt
Copy link

natanalt commented Dec 21, 2024

This post is quite old and I found it by accident, but this answer may perhaps help others who somehow get here.

These functions are a part of OpenGL's fixed-function pipeline. This API design is ancient and I think it stems from how GPUs were programmed in the 90s. Modern graphics drivers do the bare minimum to support it, as modern GPUs can't be cleanly mapped to that programming model (and by modern I mean like 2008 and newer).

This may be a bit disappointing to hear, but you should learn how to use slightly newer versions of the API, like OpenGL 3. It's pretty old by now too, but all of OpenGL is almost deprecated nowadays, you know lol. The website learnopengl.com has a pretty decent tutorial on it. You should avoid using tutorials for OpenGL 2.0, as that's not really how GPUs work nowadays, even if that can be kinda said even of OpenGL 4.6. You won't be using functions like glMatrixMode in modern OpenGL, as managing data passed to the GPU becomes your responsibility (and you'll be able to use as many matrices as you'd like!), which also means the code will be slightly more complicated. If you just want a simple API to draw stuff on the screen, I recommend looking into dedicated 2D/3D libraries for that, or even outright game engines. They're much more optimized for modern hardware, and have a lot more useful functionality.

As for why the bindings don't have these functions. The main gl crate exposes bindings for the Core profile of OpenGL 4.6, which is the newest version as of writing (and probably for the rest of time). The Core profile removes all deprecated OpenGL functions, including fixed-function pipeline ones.

If you're still hell-bent on using obsolete OpenGL functionality, I've had success manually using the gl-generator crate to create bindings for OpenGL 2.0. OpenGL 3.0 with the Compatibility profile also works, just not 3.3 because I think by that point the deprecated APIs were fully gone from both Core and Compatibility profiles. But beware, GPU drivers may be even more glitchy there than they are on modern OpenGL.

As for the glTexCoordP1ui function, it seems to be a part of the ARB_vertex_type_2_10_10_10_rev extension. I didn't read much into it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants