当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: 今天写了个基于MFC对话框的OpenGL类:COpenGL,可以在对话框程序中使用OpenGL了,并且提供了全屏与非全屏转换的两个函数,很容易使用,速度快。
 

 

    摘要:1)互斥对象的概念:互斥对象是系统内核维护的一种数据结构,它定保证了对象对单个线程的访问权 互斥对象的结构:包含了一个使用数量,一个线程id,一个计数器 使用数量是指有多少个线程在调用该对象,线程id是指互斥对象维护的线程的id 计数器表示当前线程调用该对象的次数2)互斥对象的创建】handle createmutex( lpsecurity_attributes lpmutexattr......
 ·skinload程序界面换肤工具    »显示摘要«
    摘要:skinload程序界面换肤工具 作者:耿海增 asp?id=1959">下载本文示例工程 asp?id=2445">版本更新skinload v0.3 本文在vc知识库链接 说明:skinload是一个给程序换肤的工具,通过几个简单的函数调用就可以给你的应用程序加上漂亮的皮肤,包括所有的系统对话框。通过skinloadmaker皮肤编辑工具,可以自己定制皮肤。 界面效果图如......


基于MFC对话框的OpenGL类

  今天写了个基于mfc对话框的opengl类:copengl,可以在对话框程序中使用opengl了,并且提供了全屏与非全屏转换的两个函数,很容易使用,速度快.  可以到这里下载demo project.有什么意见或问题,请大家给我留言.:)  使用方法:在对话框上加一个static控件(或者其他的也可以),在oninitdialog()中加人下面这段代码(假设控件id为idc_opengl,m_opengl是类copengl的对象): codedivstart()  crect rect; getdlgitem(idc_opengl)->getwindowrect(rect); screentoclient(rect); m_opengl.create(rect, this); codedivend()   然后在适当的地方调用m_opengl.renderglscene()就可以了.  以下是类代码(opengl.h与opengl.cpp): codedivstart() #if !defined(afx_opengl_h__38b5d1c8_2dff_4a7d_9a99_3ac401c19d72__included_)#define afx_opengl_h__38b5d1c8_2dff_4a7d_9a99_3ac401c19d72__included_

/////////////////////////////////////////////////////////////////////////////// copengl window 【程序编程相关:Implement the 3D vie

#if _msc_ver > 1000#pragma once#endif // _msc_ver > 1000// opengl.h : header file// 【推荐阅读:利用DirectShow开发自己的Fil

// attributespublic: 【扩展信息:[C++]监控特定文件夹的事件:三种解决

class copengl : public cwnd{// constructionpublic: copengl();

// operationspublic:

// overrides // classwizard generated virtual function overrides //{{afx_virtual(copengl) //}}afx_virtual

// implementationpublic: bool setnormscreen(); bool setfullscreen(int width, int height, int depth); virtual void renderglscene();  void create(crect rect, cwnd *parent); virtual ~copengl();

 // generated message map functionsprotected: crect m_rect; cwnd* m_parent; bool m_bfullscreen; devmode m_dmsaved; bool m_binit; int initgl(); void killglwindow(); hdc m_hdc; hglrc m_hrc; //{{afx_msg(copengl) afx_msg int oncreate(lpcreatestruct lpcreatestruct); afx_msg void onpaint(); afx_msg void onsize(uint ntype, int cx, int cy); //}}afx_msg declare_message_map()};

/////////////////////////////////////////////////////////////////////////////

//{{afx_insert_location}}// microsoft visual c++ will insert additional declarations immediately before the previous line.

#endif // !defined(afx_opengl_h__38b5d1c8_2dff_4a7d_9a99_3ac401c19d72__included_) codedivend() codedivstart() // opengl.cpp : implementation file//

#include "stdafx.h"#include "dialogopengl.h"#include "opengl.h"#include <gl/gl.h>#include <gl/glu.h>

#ifdef _debug#define new debug_new#undef this_filestatic char this_file[] = __file__;#endif

/////////////////////////////////////////////////////////////////////////////// copengl

copengl::copengl():m_binit(false),m_bfullscreen(false),  m_hdc(null),m_hrc(null),m_parent(null){}

copengl::~copengl(){ killglwindow(); // shutdown}


...   下一页
    摘要: mfc界面包装类 ——多线程时成员函数调用的断言失败 经常在论坛上看到如下的问题:dword winapi threadproc( void *pdata ) // 线程函数(比如用于从com口获取数据){ // 数据获取循环 // 数据获得后放在变量i中 cabcdialog *pdialog = reinterpret_cast< cabcdial......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE