我最近在OS X上進入OpenGL(tl; dr:我是OpenGL noob),並得到了一些代碼工作,繪製了一個立方體。然而,我沒有看到任何面孔(除了前面),因爲我的觀點沒有被翻譯。我嘗試使用gluLookAt
函數來做這個翻譯,但是我得到一個GL_INVALID_OPERATION
錯誤。這是我做我的渲染:GL_INVALID_OPERATION當調用gluLookAt
// Activate and lock context
[_glView.openGLContext makeCurrentContext];
CGLLockContext(_glView.openGLContext.CGLContextObj);
// Update camera position
gluLookAt(0, 2.0, 0, 0, 0, 0, 0, 1, 0);
gl_GetError();
// Update viewport and render
glViewport(0, 0, _glView.frame.size.width, _glView.frame.size.height);
[_renderer doRender:time];
// Unlock and flush context
CGLUnlockContext(_glView.openGLContext.CGLContextObj);
[_glView.openGLContext flushBuffer];
當我註釋掉gluLookAt
號召,從我可以從文檔收集此代碼的工作,這個錯誤是由glBegin
和glEnd
之間執行gluLookAt
引起的。我不知道這些是在哪裏接到電話,因爲我自己並沒有給他們打電話,並且打電話給gluLookAt
在glBegin
和glEnd
沒有解決問題。
如果它有所作爲,我使用的是OpenGL 3.2 Core Profile。
看着opengl標籤的人一定要四處走動,幾乎所有問題都沒有評論。這真是讓我煩惱。 – thokra
@thokra我只是再次投票。如果你認爲一個問題是不好的,解釋原因,沒有任何藉口。 –
@AntonD:所以你低估了,然後再次投票,因爲你無法給出解釋?我有點困惑。 – thokra