1.ç¨vb çOpenGL å¨pictureä¸ç»ä¸ä¸ªä¸è§å½¢ã
2.å¦ä½è·å¾wglswapbuffers
ç¨vb çOpenGL å¨pictureä¸ç»ä¸ä¸ªä¸è§å½¢ã
è¦æ³å¨VB6.0ä¸ä½¿ç¨OpenGLç»å¾ï¼å¿ é¡»å ä¸è½½ä¸ä¸ªSDK,源码定位平台源码ååå«vbogl.tlbã
ä¸è½½è¯¥æ件åï¼ç´æ¥å¨VB6.0âå·¥ç¨â-âå¼ç¨âéé¢å¼ç¨
1ãå¨formä¸å å ¥ä¸ä¸ªPictureBoxæ§ä»¶
2ãè¦å¨Windowséé¢ä½¿ç¨OpenGLï¼å¿ é¡»å è¿è¡åç´ æ ¼å¼è®¾ç½®ï¼å½æ°ä»£ç å¦ä¸
Dim hRC As Longâå ¨å±åé
'å¯ç¨OGL
Sub EnableOpenGL(ghDC As Long)
On Error GoTo Err
Dim pfd As PIXELFORMATDESCRIPTOR 'pfdåç´ æ ¼å¼è®¾ç½®.
ZeroMemory pfd, Len(pfd)
pfd.nSize = Len(pfd) '大å°
pfd.nVersion = 1 'çæ¬
pfd.dwFlags = PFD_DRAW_TO_WINDOW Or PFD_SUPPORT_OPENGL Or PFD_DOUBLEBUFFER 'æ å¿
pfd.iPixelType = PFD_TYPE_RGBA 'åç´ ç±»å
pfd.cColorBits = 'é¢è²ä½æ°
pfd.cDepthBits = 'ä½å®½
pfd.iLayerType = PFD_MAIN_PLANE 'å¾å±ç±»å
Dim PixFormat As Long
PixFormat = ChoosePixelFormat(ghDC, pfd) 'éæ©è®¾å¤ä¸æå¹é æ们æ设置çåç´
SetPixelFormat ghDC, PixFormat, pfd '设置æå½åçåç´
hRC = wglCreateContext(ghDC) '建ç«ç¿»è¯æ述表
wglMakeCurrent ghDC, hRC 'å°å»ºç«çç¿»è¯æ述表设置为å½å
Exit Sub
Err:
MsgBox "Can't create OpenGL context!", vbCritical, "Error"
End
End Sub
å¨å·¥ç¨çFORMçloadä¸å å ¥è°ç¨ä»£ç
Call EnableOpenGL(Picture1.hDC)
3ãä¸å¯ç¨å¯¹åºçç¦ç¨
'ç¦ç¨OGL
Sub DisableOpenGL()
wglMakeCurrent 0, 0
wglDeleteContext hRC
End Sub
å¨å·¥ç¨çformçunloadä¸å å ¥ç¦ç¨ä»£ç
Call DisableOpenGL
4ãç»å¾
Private Sub Display()
glClearColor 0#, 0#, 1#, 0# 'æ¸ ç©ºé¢è²ç¼åçRGBAé¢è²å¼
glClear clrColorBufferBit '为ç»ä¸å¸§æ²é¢æ¸ é¤ç¼å²åº
glColor3f 0.8, 0.3, 0.5 '设置æ¾ç¤ºçåä½é¢è²
glPushMatrix 'ä¾æ®å½å模å¼ï¼æ¨¡å¼-è§å¾ç©éµï¼ä½¿ç©éµå ¥æ
glBegin glBeginModeConstants.bmPolygon 'å¼å§ç»å¾ï¼ç»å¶ä¸ä¸ªä¸è§å½¢
glVertex2f -0.5, -0.5 'ä¸è§å½¢ç3个顶ç¹
glVertex2f -0.5, 0.5
glVertex2f 0.5, -0.5
glEnd
glPopMatrix 'ä¾æ®å½å模å¼ï¼æ¨¡å¼-è§å¾ç©éµï¼ä½¿ç©éµåºæ
SwapBuffers Picture1.hDC 'åæ¢ç¼å
End Sub
5ãå¨PictureBox1çPAINTäºä»¶ï¼è°ç¨æ¾ç¤ºçå½æ°
Display
å¦ä½è·å¾wglswapbuffers
å¦ä½è·å¾wglswapbuffers
wglswapbuffers
æ¯åå驱å¨å¸¦æ¥ç
ms opengl 1.1 ä¸çsourceï¼
__inline FARPROC GetAPI(char *szDll, char *szAPI, HMODULE *phDll)
{
*phDll = LoadLibraryA(szDll);
if (*phDll == NULL)
{
return NULL;
}
return GetProcAddress(*phDll, szAPI);
}
/
2024-12-29 05:472507人浏览
2024-12-29 05:38733人浏览
2024-12-29 05:142972人浏览
2024-12-29 05:07716人浏览
2024-12-29 04:132765人浏览
2024-12-29 03:401886人浏览
、12月8日,敘利亞首都大馬士革 新華社在敘利亞的中國公民多數已於近日撤離,但仍有部分人留在敘利亞各地。傳媒引述在敘中國人消息稱,截至周日12月8日)下午,首都大馬士革還有100多名中國公民,他們指敘
1.新版二开微信发卡小程序源码卡密系统/支持流量主2.探索千变万化的网络王国:GTA5辅助发卡网源码剖析3.陌屿个人发卡网V50免费版陌屿个人发卡网V50免费版功能简介4.开源发卡网源码自动企业发卡网
1.怎么在手机上查看APP的源码?2.成品短视频app源码有什么优势?3.如何看到一个APP应用的源代码4.怎样获取成品app的源码?5.如何查找安卓app源码6.有一个APP的源代码怎么运营怎么在手