Sign in to follow this  
Sock5

Using pixel format '2' crashes SetPixelFormat, but other values don't?

Recommended Posts

Sock5    162

Using SetPixelFormat and passing 2 as a format crashes and GetLastError() gives me a code of 2000.I used the example code from Rastertek: http://www.rastertek.com/gl40tut03.html , but when I do it, it causes a crash.I have no idea how to proceed, I mean I can't even find what '2' means, it's probably  "RGBA 8 bits per channel", as it is described in the description array prior to the format creation, but why would it say it's invalid?

Share this post


Link to post
Share on other sites
Kaptein    2224
result = wglChoosePixelFormatARB(m_deviceContext, attributeListInt, NULL, 1, pixelFormat, &formatCount);

 result = SetPixelFormat(m_deviceContext, pixelFormat[0], &pixelFormatDescriptor);

 

there is no '2' anywhere near the pixelformats, as i could find.. am i looking in the wrong place?

Share this post


Link to post
Share on other sites
Sock5    162
result = wglChoosePixelFormatARB(m_deviceContext, attributeListInt, NULL, 1, pixelFormat, &formatCount);

 result = SetPixelFormat(m_deviceContext, pixelFormat[0], &pixelFormatDescriptor);

 

there is no '2' anywhere near the pixelformats, as i could find.. am i looking in the wrong place?

 

Yeah the '2' is the value inside pixelFormat that I see when I hover over it when I put a breakpoint in the debug code.I tried using '1' and '2' directly and '1' works, however I have no idea what they mean.I couldn't find an online table of GL pixel formats and their related integers :/ .

Share this post


Link to post
Share on other sites
wintertime    4108
There is no online table because that depends on your OS, your graphics card and your graphics driver. You could try http://www.realtech-vr.com/glview/index.html to show info about your system.
Maybe there is also some modern equivalent to DescribePixelFormat you could use, but the easiest way is to think in terms of the features you want from the context and feed those into ChoosePixelFormat (or the newer function wglChoosePixelFormatARB for modern OpenGL versions) do that work for you.

Share this post


Link to post
Share on other sites

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