Jump to content
  • Advertisement
Sign in to follow this  
Vectormycalculus

Bezier Curve / SwapBuffers

This topic is 3634 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[0]);
     glEnd();
     glFlush();
     glFinish(); // SwapBuffers(g_HDC) goes here
}

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!