Jump to content

  • Log In with Google      Sign In   
  • Create Account


getting pixel format with wglChoosePixelFormatARB


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Paxi   Members   -  Reputation: 179

Like
0Likes
Like

Posted 10 February 2013 - 04:24 PM

I currently have following code:

 

 

 

int pixelFormatIndex = 0;
    int pixelCount = 0;


    std::vector<int> pixAttribs;
    
    // specify the important attributes for the pixelformat used by OpenGL
    int standardAttribs[] = {
        WGL_SUPPORT_OPENGL_ARB, 1, // Must support OGL rendering
        WGL_DRAW_TO_WINDOW_ARB, 1, // pf that can run a window
        WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB, // must be HW accelerated
        WGL_RED_BITS_ARB, 8,
        WGL_GREEN_BITS_ARB, 8,
        WGL_BLUE_BITS_ARB, 8,
        WGL_ALPHA_BITS_ARB, 8,
        WGL_DEPTH_BITS_ARB, 16, // 16 bits of depth precision for window
        //WGL_STENCIL_BITS_ARB, 8,
        WGL_DOUBLE_BUFFER_ARB, GL_TRUE, // Double buffered context
        WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, // pf should be RGBA type
        0}; // NULL termination
    
    pixAttribs.insert(pixAttribs.begin(),standardAttribs,standardAttribs+(sizeof(standardAttribs)/sizeof(int)));
    
    // specify multisampling mode if it has been set
    if(mMSMode != SLIMGF_MULTISAMPLING_OFF) {
        pixAttribs.push_back(WGL_SAMPLES_ARB);
        pixAttribs.push_back(mMSMode);
    }


    // OpenGL will return the best format for the pixel attributes defined above
    BOOL result = wglChoosePixelFormatARB(mDeviceContext, pixAttribs.data(), NULL, 1, &pixelFormatIndex, (UINT*)&pixelCount);
    ASSERT(result != false, "wglChoosePixelFormatARB() failed");
 

The problem is when im using WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB my screen just stays black and when im not using it my device created is Version 1.1.

 

I listed two picks with and without the hw support flag (info obtained by wglGetPixelFormatAttribivARB())

hwacc.png

nohwacc.png

 

The format with hardware support got a 24bit depth buffer and from some trying I thought that may have something to do with the problem allthough i dont know why.

Im using the newest version of GLEW that is succesfully intialized before.

My GPU is a GTX680.

 

I currently render with following test code:

 

 

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


    glBegin(GL_TRIANGLES);


    glColor3f( 255, 0, 0 ); // red
    glVertex3f(-1.0f, -0.5f, -5.0f);
    
    glVertex3f(1.0f, -0.5f, -5.0f);
    glVertex3f(0.0f, 0.5f, -5.0f);
    
    glEnd();
 

I already thought about OpenGL4.2 causing problems with render this old way?

 

Thanks in advance

 

 



Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 7784

Like
1Likes
Like

Posted 10 February 2013 - 04:34 PM

I already thought about OpenGL4.2 causing problems with render this old way?

Are you saying that you're creating a version 4.2 rendering context and using immediate mode rendering? Immediate mode was completely removed from the API in version 3.3, and from version 3.0 if you use a core profile context. You are required to use shaders and vertex arrays to do the rendering now.



#3 Paxi   Members   -  Reputation: 179

Like
0Likes
Like

Posted 10 February 2013 - 04:45 PM

Thank you very much. I just started with OpenGL but wanted to port my old Windows System class first, I used with my DX9 framework before getting into OpenGL itself so i did not know about that. It seems that immediate mode rendering stopped working with 3.2. Creating a render context >= 3.2 causes my screen to stay black.



#4 powly k   Members   -  Reputation: 632

Like
0Likes
Like

Posted 10 February 2013 - 05:35 PM

Immediate rendering was thrown out at 3.0, 2.1 should be the last version where you can do it. You can always just query a non-core context and do whatever you want.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS