Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::OpenGLControl Class Reference

#include <OpenGLControl.h>

Inheritance diagram for VCF::OpenGLControl:

VCF::CustomControl VCF::Control VCF::Component VCF::AbstractView VCF::ObjectWithEvents VCF::View VCF::Object List of all members.

Public Member Functions

 OpenGLControl ()
virtual ~OpenGLControl ()
virtual void paint (GraphicsContext *context)
 Override this function to add you own custom GL graphics calls here.
virtual void swapBuffers ()
virtual void afterCreate (ComponentEvent *event)
 Special initializations may then happen here.

Detailed Description

This is a custom control that can be used for OpenGL drawing. It takes care of setting up an OpenGL context and you can customize the paint function to do you own OpenGL drawing there.
All the low level setup code to associate a platform window with the OpenGL system is taken care of for you.


Constructor & Destructor Documentation

VCF::OpenGLControl::OpenGLControl  ) 
 

virtual VCF::OpenGLControl::~OpenGLControl  )  [virtual]
 


Member Function Documentation

virtual void VCF::OpenGLControl::afterCreate ComponentEvent event  )  [virtual]
 

Special initializations may then happen here.

See also:
Component::afterCreate()

Reimplemented from VCF::Control.

virtual void VCF::OpenGLControl::paint GraphicsContext context  )  [virtual]
 

Override this function to add you own custom GL graphics calls here.

Make sure to call the super class though or things won't work correctly!

    void MyGLControl::paint(GraphicsContext * context)
    {
        OpenGLControl::paint( context );
        //rest of your GL code

        swapBuffers();//need to call this when you're done
    }
Note:
When you are done with your OPenGL code, you need to call swapBuffers() to push all your changes to the right GL buffer. Under the hood it will call the platform's SwapBuffers API function, or whatever it's called on your windowing system. On Win32 it's called "SwapBuffers". On OS X I believe this would end up calling "aglSwapBuffers".

Reimplemented from VCF::CustomControl.

virtual void VCF::OpenGLControl::swapBuffers  )  [virtual]
 

This gets the controls OpenGL context and calls the swapBuffers() function on it. This in turn calls the native windowing systems GL function for swapping the front and back buffers. On Win32 this resolves to a call to SwapBuffers(). On Mac OS X, this should resolve to aglSwapBuffers.


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information