Click here to Skip to main content
15,886,422 members
Articles / Desktop Programming / MFC

Rubber-Banding with OpenGL

Rate me:
Please Sign up or sign in to vote.
4.36/5 (11 votes)
7 Jan 2012CPOL2 min read 109.5K   4.2K   50  
Rubber-banding with OpenGL - A utility class
#ifndef JXGL_TRACKER
#define JXGL_TRACKER

///////////////////////////////////////////////////////////////////////
// jxglTracker.h: header file
//
//
// Written by Junlin Xu <junlin.xu@gmail.com>
// Copyright (c) 2006. All Rights Reserved.
//
// This code may be used in compiled form in any way you desire. 
// This file may be redistributed unmodified by any means PROVIDING it is 
// not sold for profit without the authors written consent, and 
// providing that this notice and the authors name and all copyright 
// notices remains intact. 
//
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
//
//////////////////////////////////////////////////////////////////////

class jxglTracker
{
public:
   jxglTracker(void);
public:
   ~jxglTracker(void);
public:
   BOOL Track(CWnd* pWnd, CPoint point);
   CRect GetTrackRect()const; // un-normalized
private:
   void DrawTrackRect(int x1, int y1, int x2, int y2);
   void DrawTrackRect(const CRect& rect);
   CRect m_rect;
   BOOL m_bErased;
   CWnd* m_pWnd;
};


#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
President Computations & Graphics, Inc.
United States United States
Junlin Xu is the founder of Computations & Graphics, Inc. (http://www.cg-inc.com). He is the author of Real3D finite element package, SolverBlaze finite element SDK, OpenGraph Library (OpenGL-based visualization and charting SDK for native and .NET environment), and double128 SDK (quad precision floating point math for C++ and .NET).

Junlin has 20+ years software development experiences in various industries. He has skills in Windows desktop and web application development using C++, C++/CLI, C#, Qt, MFC, STL, OpenGL, GLSL, COM/COM+, WinForms, MS SQL, MySQL, ASP.NET and .NET Core, CSS, jQuery and jQuery UI, Autodesk Revit API, Inno Setup. He is also an expert in mathematical, CAD and algorithmic software development.

Comments and Discussions