Sign in to follow this  

gui opengl

This topic is 3588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quote:
Original post by MJP
MS Paint uses standard Windows controls from the Windows API, which you can't use if you're using OpenGL. You'll either have to implement these controls yourself, or use a library like GLUI.


why do you think you cant use the controls from the Windows API if you are using OpenGL? of course you can.

Share this post


Link to post
Share on other sites
As the above poster mentioned, you can simply use standard windows controls, and just use OpenGL for the rendering. If you have never used standard windows controls, mabey this might help.

Share this post


Link to post
Share on other sites
As the last two posters have stated, it's perfectly fine to use OpenGL and windows components in the same program. I've done it plenty of times. My suggestion to you would be to start looking at a bunch of basic Win32 tutorials and try to play around with the various buttons and lists, and textfields and widgets (before hooking in OpenGL). Win32 is complicated enough if you've never messed with anything like it so just go through a bunch of tutorials and use MSDN for reference when you want to know how something works or why something isn't working.

Then you can grab the first couple OpenGL tutorials that you can find at most sites (NeHe for example) which will show you how to set up and use OpenGL in a Win32 environment.

I HIGHLY recommend using Microsoft's Visual Studio IDE (you can get a free version, or shell out a couple hundred for your own copy) rather than DevC++ especially if you are doing windows programming. You can even use the IDE to generate the bitmaps for all your custom buttons and such (and most tutorials come in the form of a visual studio project).

Share this post


Link to post
Share on other sites
actually the fact is :

i already have the basic knowledge of using windows programming in opengl in
dev c++ ( i know how to use messagebox etc etc)

but i dont know how to create a button type of thing on my opengl window
i downloaded glui package but is still feeling helpless

can someone tell me how to create a button type of thing on my opengl window

thanks

Share this post


Link to post
Share on other sites
Ok heres an answer for you some pepole are saying to just use the standard win32 controls in your application now to create them you would use the function CreateWindow or CreateWindowEx... just look it up on msdn.com and search google For c++ Win32 tutorials and im sure you will find out how to create a button in no time.

Now as for the Win32 control drawing to the application this however raises the question of wether or not the win32 api is compatable with the OpenGL device context for drawin i myself am not to sure if its not then you would have to go and use a GUI lib or do the GUI yourself if you have not been programing for too long or do not have a good grasp of class's i recommend you just use the library until you are comfterable with inheritance of class's and the other nine yards.

my recommendation is if you want to do just standard controls in win32 just like "Ms Paint" try to create a win32 controls " Google for FunctionX that may help" and just make a OpenGL window and create a control its not that hard to make one and you will soon find out if the two apis are nicly compatable if not then Try a GUI library. On the other if you have really simple controls that do not require much more then a click on it like sya a button you could just fake it by drawing a texture on a plane in your screen and seeing if the window has been left clicked on while within the Pixels Region of that Plane.

Anyways Try doing the win32 control first then go to a GUI lib if it draws funny or just don't work out well

Regards Jouei.

Share this post


Link to post
Share on other sites
Ahh it looks like I was very mistaken, I was using some faulty assumptions. If other OpenGL guys say it's okay to use Win32 controls, then please listen to them (they probably have much more experience with GL than I do!). I hope I haven't wasted too much of your time by setting you on the wrong path.

Share this post


Link to post
Share on other sites
where exactly do you want the buttons to be? in the middle of the rendering area? off to the side?

in map editors and the like i have made before i generally make 1 big dialog and place my button controls and stuff on it out of the rendering area, then i put another control (doesnt really matter what it is) and place it where i want to render and make it the size i want to render. then in the code, you can get a HWND and DC and such of that control and render to the control.

this way you can put all your buttons, list box, etc... on this dialog and also be rendering to an area of this dialog.

now if you want to actually draw buttons into the rendering area...well that is a different story but can still be done with opengl

Share this post


Link to post
Share on other sites

This topic is 3588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this