intx,y,width,height;
view->get_viewport( x, y, width, height );
int WindowWidth = 4096;
int WindowHeight = 4096;
int MaxTextureSize = 0;
int MaxFrameSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxTextureSize);
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &MaxFrameSize);
if ( MaxTextureSize < WindowWidth ) WindowWidth = MaxTextureSize;
if ( MaxTextureSize < WindowHeight ) WindowHeight = MaxTextureSize;
if ( MaxFrameSize < WindowWidth ) WindowWidth = MaxFrameSize;
if ( MaxFrameSize < WindowHeight ) WindowHeight = MaxFrameSize;
// allocate final image buffer
GLubyte* image = reinterpret_cast<GLubyte*>( malloc( WindowWidth * WindowHeight * 3 ) );
GLubyte* cimage = reinterpret_cast<GLubyte*>( malloc( WindowWidth * WindowHeight * 3 ) );
clGLFrameBuffer* FrameBuffer = new clGLFrameBuffer( WindowWidth, WindowHeight, 8, true );
FrameBuffer->AfterConstruction();
.
.
.
void clGLFrameBuffer::AfterConstruction()
{
glGenFramebuffersEXT( 1, &FFrameBuffer );
BindRenderTarget(0);
.
.
.
void clGLFrameBuffer::BindRenderTarget(int TargetIndex) const
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FFrameBuffer);
.
.
.
After this call my program calls this “make_current”-function and delivers me my “00xC0000005:Access Violation while reading position 0x00000120”-error.
void gl_context_data::make_current( view3d *view )
{
if (view)
{
wglMakeCurrent(m_hdc, m_hGLrc);
}
else
{
wglMakeCurrent(NULL, NULL);
}
}
I hope that this little extract can illustrate the problem a little bit.