Developing Games on Intel Graphics
If you are gaming on graphics integrated in your Intel Processor, this is the place for you! Find answers to your questions or post your issues with PC games
493 Discussions

glFramebufferTexture2DEXT problem

trigve
Beginner
968 Views
Hi,
I have problem with glFramebufferTexture2DEXT function with intel GMA4500MHD 7.15.10.1688 drivers (using vista 32 bit). I'm attaching sample project which demonstrate failure (exception):
[cpp]First-chance exception at 0x10053930 in enum.exe: 0xC0000005: Access violation reading location 0xfeeeff86.
Unhandled exception at 0x10053930 in enum.exe: 0xC0000005: Access violation reading location 0xfeeeff86.[/cpp]
The code throw exception in enum.cpp on line 109:
[cpp]glDeleteTextures(1, &tid); // <--Crash--[/cpp]

If line 102 in the enum.cpp file
[cpp]glTexImage2D(target, 0, fmt, prob_size, prob_size, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, tid, 0); // <--Here--[/cpp]
with comment "// <--Here--" is commented, no exception is thrown.

Here is the full listing:
[cpp]// enum.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
#include
#include "GL/glew.h"

#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0501
#endif

LRESULT __stdcall dummyWndProc(HWND hwnd, UINT umsg, WPARAM wp, LPARAM lp)
{
return DefWindowProc(hwnd, umsg, wp, lp);
}

int main(int argc, char* argv[])
{
LPCSTR dummyText = "WglDummy";
HINSTANCE hinst = GetModuleHandle( NULL );

WNDCLASS dummyClass;
memset(&dummyClass, 0, sizeof(WNDCLASS));
dummyClass.style = CS_OWNDC;
dummyClass.hInstance = hinst;
dummyClass.lpfnWndProc = &dummyWndProc;
dummyClass.lpszClassName = dummyText;
ATOM a = RegisterClass(&dummyClass);
assert(a != NULL);

HWND hwnd = CreateWindow(dummyText, dummyText, WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 32, 32, 0, 0, hinst, 0);
// if a simple CreateWindow fails, then boy are we in trouble...
if (hwnd == NULL)
return 1;
// no chance of failure and no need to release thanks to CS_OWNDC
HDC hdc = GetDC(hwnd);
if(hdc == NULL)
return 2;
// assign a simple OpenGL pixel format that everyone supports
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
8, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
24, // 32-bit z-buffer
8, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
// if these fail, wglCreateContext will also quietly fail
int format;
if ((format = ChoosePixelFormat(hdc, &pfd)) != 0)
{
if(SetPixelFormat(hdc, format, &pfd) == FALSE)
return 3;
}
// Create and set GL context
HGLRC hRC = wglCreateContext(hdc);
if(hRC == NULL)
return 4;
if(!wglMakeCurrent(hdc, hRC))
return 5;
// Show The Window
ShowWindow(hwnd,SW_SHOW);
SetFocus(hwnd);
// Initialize glew
GLenum err = glewInit();
if (GLEW_OK != err)
{
std::cout << "Error(" << err << "): " << glewGetErrorString(err) << std::endl;
return 6;
}
// Create and attach framebuffer
GLenum const fmt = GL_LUMINANCE8;
short const prob_size = 16;
GLuint fb, tid;
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
// Create and attach texture
GLenum const target = GL_TEXTURE_2D;
glGenTextures(1, &tid);
glBindTexture(target, tid);
// Set some default parameters so it won't fail on NVidia cards
glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexImage2D(target, 0, fmt, prob_size, prob_size, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, tid, 0); // <--Here--
// Check status
GLuint status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
// Delete texture and framebuffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &fb);

glDeleteTextures(1, &tid); // <--Crash--

// clean up our dummy window and class
assert(DestroyWindow(hwnd) != 0);
UnregisterClass(dummyText, hinst);

return 0;
}

[/cpp]
Thanks

Trigve
0 Kudos
3 Replies
trigve
Beginner
968 Views
Hello,
this problem is showstopper for me, if someone can look at it it would be great.

Thank you

Trigve
0 Kudos
Chuck_De_Sylva
Beginner
968 Views
Quoting - trigve
Hi,
I have problem with glFramebufferTexture2DEXT function with intel GMA4500MHD 7.15.10.1688 drivers (using vista 32 bit). I'm attaching sample project which demonstrate failure (exception):
[cpp]First-chance exception at 0x10053930 in enum.exe: 0xC0000005: Access violation reading location 0xfeeeff86.
Unhandled exception at 0x10053930 in enum.exe: 0xC0000005: Access violation reading location 0xfeeeff86.[/cpp]
The code throw exception in enum.cpp on line 109:
[cpp]glDeleteTextures(1, &tid); // <--Crash--[/cpp]

If line 102 in the enum.cpp file
[cpp]glTexImage2D(target, 0, fmt, prob_size, prob_size, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, tid, 0); // <--Here--[/cpp]
with comment "// <--Here--" is commented, no exception is thrown.

Here is the full listing:
[cpp]// enum.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
#include
#include "GL/glew.h"

#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0501
#endif

LRESULT __stdcall dummyWndProc(HWND hwnd, UINT umsg, WPARAM wp, LPARAM lp)
{
return DefWindowProc(hwnd, umsg, wp, lp);
}

int main(int argc, char* argv[])
{
LPCSTR dummyText = "WglDummy";
HINSTANCE hinst = GetModuleHandle( NULL );

WNDCLASS dummyClass;
memset(&dummyClass, 0, sizeof(WNDCLASS));
dummyClass.style = CS_OWNDC;
dummyClass.hInstance = hinst;
dummyClass.lpfnWndProc = &dummyWndProc;
dummyClass.lpszClassName = dummyText;
ATOM a = RegisterClass(&dummyClass);
assert(a != NULL);

HWND hwnd = CreateWindow(dummyText, dummyText, WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 32, 32, 0, 0, hinst, 0);
// if a simple CreateWindow fails, then boy are we in trouble...
if (hwnd == NULL)
return 1;
// no chance of failure and no need to release thanks to CS_OWNDC
HDC hdc = GetDC(hwnd);
if(hdc == NULL)
return 2;
// assign a simple OpenGL pixel format that everyone supports
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
8, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
24, // 32-bit z-buffer
8, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
// if these fail, wglCreateContext will also quietly fail
int format;
if ((format = ChoosePixelFormat(hdc, &pfd)) != 0)
{
if(SetPixelFormat(hdc, format, &pfd) == FALSE)
return 3;
}
// Create and set GL context
HGLRC hRC = wglCreateContext(hdc);
if(hRC == NULL)
return 4;
if(!wglMakeCurrent(hdc, hRC))
return 5;
// Show The Window
ShowWindow(hwnd,SW_SHOW);
SetFocus(hwnd);
// Initialize glew
GLenum err = glewInit();
if (GLEW_OK != err)
{
std::cout << "Error(" << err << "): " << glewGetErrorString(err) << std::endl;
return 6;
}
// Create and attach framebuffer
GLenum const fmt = GL_LUMINANCE8;
short const prob_size = 16;
GLuint fb, tid;
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
// Create and attach texture
GLenum const target = GL_TEXTURE_2D;
glGenTextures(1, &tid);
glBindTexture(target, tid);
// Set some default parameters so it won't fail on NVidia cards
glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexImage2D(target, 0, fmt, prob_size, prob_size, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, tid, 0); // <--Here--
// Check status
GLuint status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
// Delete texture and framebuffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &fb);

glDeleteTextures(1, &tid); // <--Crash--

// clean up our dummy window and class
assert(DestroyWindow(hwnd) != 0);
UnregisterClass(dummyText, hinst);

return 0;
}

[/cpp]
Thanks

Trigve

I took your test case and entered a bug in our tracking system today, fyi.
0 Kudos
trigve
Beginner
968 Views
Hi,
tried with the new drivers (7.15.10.1908) , with Vista SP2 installed and still without success. Can I somehow help to resolve this issue???

Thanks,

Trigve
0 Kudos
Reply