我目前正在嘗試使用角度組件將現有的OpenGL代碼調整到通用Windows應用程序,該角度組件應該將OpenGL調用轉換爲DirectX。 給我一個問題的一個基本功能是全屏顯示紋理中的四邊形(以便將着色器應用於該四邊形)。 常規的OpenGL代碼是直接的:在角度:glLoadIdentity和glOrtho中使用OpenGL的角度:glLoadIdentity和glOrtho未定義
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-viewWidth, viewWidth, -viewHeight, viewHeight, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
my_quad.RenderObject();
(渲染對象結合合適的緩衝液爲頂點和紋理座標,然後調用glDrawElements)。
該代碼使用OpenGL和Glut在常規的Win32應用程序中生成並運行良好。當試圖使用相同的代碼的角度+ UWP,編譯器返回的基本功能生成錯誤:
error C2065: 'GL_PROJECTION': undeclared identifier
error C3861: 'glMatrixMode': identifier not found
error C3861: 'glLoadIdentity': identifier not found
error C3861: 'glOrtho': identifier not found
error C2065: 'GL_MODELVIEW': undeclared identifier
error C3861: 'glMatrixMode': identifier not found
error C3861: 'glLoadIdentity': identifier not found
error C2065: 'GL_TEXTURE_ENV': undeclared identifier
error C2065: 'GL_TEXTURE_ENV_MODE': undeclared identifier
error C2065: 'GL_MODULATE': undeclared identifier
error C3861: 'glTexEnvf': identifier not found
我不是太熟悉的OpenGL ES(明顯),但根據教程像glLoadIdentity功能應該是支持的。 我錯過了什麼嗎? Angle文件夾(gl2.h,glext.h和gl2platform.h)中的標題不定義它們。
謝謝。這是否意味着我必須使用着色器來顯示我的四邊形?我實際上在我的原始Win32程序中嘗試過,但由於我正在顯示四邊形以使紋理由另一個着色器處理,所以我認爲我正在發生衝突(無論如何它都沒有按預期工作)。 – Alx
是的,你必須使用着色器和一切。 – BDL