Jump to content
  • Advertisement
Sign in to follow this  
afraidofdark

[.net] seting up an opengl window in c++.net

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

Hello, I have been working on a level editor,I used win32 libraries and cplusplus, however using native win32 library is making development very hard. So i decided to move to c++.net I spend about 2 days on research and I found out C#.net has a library named CSGL it is working fine and I can use it for my project. But I prefer using c++.net in my project. Than I found an article about creating opengl view in windows form and it was realy useful.Here its link http://www.codeproject.com/KB/miscctrl/OpenGLViewWinForms.aspx but when I make a project and run it, 1) m_hglrc = wglCreateContext(hdc); this line return a null 2) public ref class COpenGL: public System::Windows::Forms::NativeWindow instead of NativeWindow, Can I use Form I used form but same error occurred(wglCreateContext return null) soryy for my English, I hope that I can explain myself properly

Share this post


Link to post
Share on other sites
Advertisement
I checked the last error
ERROR_INVALID_PIXEL_FORMAT
2000

here is my format(actually it was working without problem)

PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};



moreover Im using ChoosePixelFormat to set the pixel format.

any idea ?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!