Original Post
Hey all, I''m not totally sure whether this should go in the DirectX or OpenGL forum (I''m making a mini-engine for both API''s), so moderators please feel free to move it.
In my FinishScene() function, if the current renderer is Direct3D, I simply call the EndScene() and Present() functions. If my renderer is OpenGL, I simply call SwapBuffers(), with my device context as a parameter. Simple enough.
If I run the function in Direct3D, it works flawlessly. If I run it in OpenGL though, I encounter some problems. I get an Access Violation error, and the debugger traces me back to the EndScene() function.
The only thing is that if I''m using OpenGL, the if statement should skip the code... but I get an Access Violation. If you''re confused, here''s the source:
I''m not sure whether I''m using the debugger right (in that function... I run Go but it stops at EndScene()), because this is one really weird error.
.elendil67
// Function to finish rendering the scene
int CEngine::FinishScene()
{
// If Direct3D is the current renderer
if(this->m_bOpenGL == false)
{
// Finish rendering the scene in Direct3D
// Finish rendering the scene
this->m_pDirect3DDevice->EndScene();
// Present the scene
this->m_pDirect3DDevice->Present(NULL, NULL, NULL, NULL);
}
// If OpenGL is the current renderer
else
{
// Finish rendering the scene in OpenGL
// Swap buffers
SwapBuffers(this->m_hDC);
}
return 1;
}