Jump to content
  • Advertisement
Sign in to follow this  
guyver23

OpenGL and Windows Forms

This topic is 4370 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

Hi. My Computer Science I class is built around the study of the Windows forms technology, and we are learning C++ through this. I am familiar with standard C++, and I was wondering if I could somehow use this environment to learn OpenGL? I don't really have a firm grasp of Win32 programming anymore, which is why I ask. Also, will my Visual C++ .NET Express Edition rebel if I try using standard C++ code? Is there any way to do this? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Iam using VC++ 2005 Expres and it dont rebel when i use standard win32 functions and OpenGL. You have probably some strange project settings. And for win32 functions .. it is only few lines of code, for which you can Copy&Paste from somewhere else.

Share this post


Link to post
Share on other sites
Quote:
Original post by guyver23
Also, will my Visual C++ .NET Express Edition rebel if I try using standard C++ code? Is there any way to do this?


What language do you expect it to want you to use?

Share this post


Link to post
Share on other sites
I am sure there was a better way of expressing that thought. For instance, instead of using the standard string.h stuff, we use System::String. And to convert numbers we use variable.toString. I know none of that is standard C++ code, but our instructor won't explain what this stuff is called or how it interacts with standard C++, because he considers this to be be the new way everyone is going to program, and that standard C++ is outdated.

Hence my own confusion. =(

Share this post


Link to post
Share on other sites
Quote:
Original post by guyver23
I am sure there was a better way of expressing that thought. For instance, instead of using the standard string.h stuff, we use System::String. And to convert numbers we use variable.toString. I know none of that is standard C++ code, but our instructor won't explain what this stuff is called or how it interacts with standard C++, because he considers this to be be the new way everyone is going to program, and that standard C++ is outdated.

Hence my own confusion. =(



If your instructor is teaching you to use System::String over the standards compliant and cross-platform std::string, then he/she is not the best person for teaching C++ IMO.

In windows as long as you can get the handle of a form or control you can pretty much always create an OpenGL context with it. IIRC creating a rendering context from a handle is something like:

hDC = GetDC(hWnd)
hRC = wglCreateContext(hDC)
wglMakeCurrent(hDC,hRC)

Where hWnd is the window handle. You'll have to set a pixel format somewhere as well, and handle OnPaint/OnSize events too.

Take a look at tutorial 1 of NeHe and use chunks from the windows creation code but instead of getting a window handle from CreateWindow, just use the one from the control.

I hope that makes sense.

Luke.

P.S. If you just want to create a standalone window and not OpenGL on one of those forms, just use tutorial 1 in its entirety.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!