0

How do i just create a window with just some controls like menus , check button , radio button , scroll bar ..just with c++ and OpenGL?

Italian
  • 117
  • 1
  • 7
  • You'll need a library for that, or make your own. See also this: http://gamedev.stackexchange.com/questions/3617/good-gui-for-opengl – LogicStuff Mar 21 '15 at 17:14

1 Answers1

0

It depends.

1) You can't use any external libraries.

In this case you would need to create whole framework for creating controls, handling events, hit tests, state changes... Shortly speaking, you would need to write a GUI library like Qt or wxWidgets, but with all controls drawing implemented in OpenGL.

2) You can use 3rd party libs.

Well, simply read the spec and use them. Examples:

GiGi

GLUI

Also, you may want to read this: OpenGL Forum

However, if you don't have to use OpenGL-based solution, I would suggest you use wxWidgets. I've been using it for years. It's my favourite cross-platform GUI library with solid support, quite big community and reliable, up-to-date online/offline documentation.

Mateusz Grzejek
  • 11,698
  • 3
  • 32
  • 49
  • is it a nightmare writing all the libraries ? – Italian Mar 21 '15 at 17:29
  • No, it can be simpler than you think. It all depends on how much functionality do you need. In our company, we were forced to write our own GUI library due to performance issues in the existing ones - portable, with renderers implemented in Xrender/GDI/OpenGL/DirectX11 (depending on platform). Basic design, efficient threads support, controls design, input handling, regions (we also implemented our own, that were proven to be ~30-40 times faster than HRGNs) - almost 1 year of work, but performance is superior (and that was an issue). [...] – Mateusz Grzejek Mar 21 '15 at 18:33
  • [...] However, if you only need a basic set of functionality, it can be very easy. But you need to think carefully and have a solid base in frameworks design. I needed such simple GUI for my rendering engine and it took me 3 days to implement complete (from my point of view), fast and simple library, that I use very extensively without any issues. – Mateusz Grzejek Mar 21 '15 at 18:35
  • Thanks Man !! U helped me a lot today ..can u get me started how to write my own libraries .. i am only 15 – Italian Mar 21 '15 at 18:56
  • That's a heavy topic. You probably should get started from understanding what is a library and how to write it and then use it. Either static `.lib` (https://msdn.microsoft.com/en-us/library/ms235627.aspx) or dynamic `.dll` (https://msdn.microsoft.com/en-us/library/ms235636.aspx). See also this: https://steamcentral.wordpress.com/2011/10/26/how-to-write-a-cpp-library/ and this: http://stackoverflow.com/questions/42770/writing-using-c-libraries. – Mateusz Grzejek Mar 21 '15 at 20:16