Sign in to follow this  

Bezier Curve / SwapBuffers

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

Working on a tutorial that explains how to create a Bezier Curve. the last function for the source code is SwapBuffers() with g_HDC as its paramater. (OpenGL) Is there a header that im missing that defines this function? besides wingdi.h I did try using gl_Finish() insted of SwapBuffers() But no significant result i know the HDC is the device context and is a function in the winMain and LRESULT setupPixelFormat..etc But i really dont think getting SwapBuffers(g_HDC) to work will solve my problem Im getting a Blank Screen... heres their code..
float control[4][3] = { {1.0, -3.0, 0.0}, { 3.0, 2.5, 0.0 },
                        {8.0, -2.0, 0.0}, { 7.0, 2.0, 0.0 } };
                        
void CGfxOpenGL::Initialize()
{
     glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // clear to "blackground"
     glShadeModel(GL_FLAT);         // using a smooth shading method
}

void CGfxOpenGL::Render()
{
        
     // clear the screen
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glLoadIdentity();
          
     // centre the scene for the bezier curve
     glTranslatef(-5.0f, 0.0f, -10.0f);
     
     // set up bezier curve
     glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &control[0][0]);
     glEnable(GL_MAP1_VERTEX_3);
     
     // setting color to white
     glColor3f(1.0, 1.0, 1.0);
     
     // draw the curve
     glBegin(GL_LINE_STRIP);
          for (int i = 0; i <= 100; i++)
                  glEvalCoord1f((float)i/100.0f);
    
     glEnd();
     // now we draw points at there coords
     glPointSize(3.0);
     glColor3f(1.0, 1.0, 1.0);
     glBegin(GL_POINTS);
            for(int i = 0; i < 4; i++)
                 glVertex3fv(&control[i][0]);
     glEnd();
     glFlush();
     glFinish(); // SwapBuffers(g_HDC) goes here
}

Share this post


Link to post
Share on other sites

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