How to make buttons in OpenGL c++

Hi. I have been searching the web for how to make buttons in opengl c++. I want to make a button from either scratch or with the use of a library. I do not want to use glui as I can not place the button in a xy position. If there is any library or code for this. Code for making a button with rectangles and mouse clicks would be great. This have really been a burden to me since I have been searching and trying to learn how to do this for quite some time. Thanks.
Please send code our video on how to make a button.

OpenGL is a rendering library. It doesn’t have anything to do with mouse input. For that, you’ll need to refer to whichever windowing API (win32, Xlib) or toolkit (GLUT, GLFW, SDL, GTK, Qt, wxWidgets, MFC) you’re using.

How can I make it with GLUT. I don’t want to use GLFw or GLUI anything like that. I want to know how I can make with only opengl and glut

Use glutMouseFunc to register a mouse callback. When it’s invoked, check whether the coordinates lie within the outline of the button. Bear in mind that mouse coordinates have their origin in the top-left corner of the window compared to the bottom-left corner for OpenGL’s rendering coordinates.

I understand what you are trying to say. But since I am new I do not know how to do that. Can you please send some code

here is some code:

#include<stdio.h>
int main(int argc, char *argv[]) {
    printf("try googling for glutMouseFunc example\n");
    return 0;
}

Can I get some actual code. Thank you but this doesn’t help me a bit.

You’re basically asking people to write a GUI library (or at least a non-trivial portion of one) for you. That’s a pretty big thing to ask.

OpenGL is not a GUI toolkit; it is a low-level rendering system. It has no “make button” function, nor anything remotely resembling one. Therefore, if you want to make one, you must assemble it from low-level building blocks: rendering an object that looks like a button, then doing mouse input to detect when the button was clicked, feeding that click data to its destination, etc. If you’re not willing to use a dedicated UI library, then all of that has to be written by you.

And it’s not reasonable to ask random forum-goers to do that much work for you.

I just want to see some code that helps me make a button. I have code from a website, but it is in c. If you can translate it in c++ it would be appreciated.

why do you want it in c++ when you don’t know c++.
homework?

Kind of. In online school my teacher wants to make a button from either scratch or with a gui library that allows me to place buttons in a xy position.

in that case, i’m out of this discussion. last time i made homework was more than 20 years ago, and it was surely not someone else’s homework.