Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem with glMapBufferARB

Started by Nielske Jan 22, 2008 at 10:44 AM 1 replies 1.4k views
Original Post
Nielske
Nielske
Hello everybody, I'm trying to build a complete software implementation of a videodecoder, so and using one triangle and 1 texture that gets updated every frame (yeah not best solution) But i get error in next lines typedef unsigned int TColor; TColor make_color(float r, float g, float b, float a){ return ((int)(a) << 24) | ((int)(b) << 16) | ((int)(g) << 8) | ((int)(r) << 0); } TColor *d_dst = NULL; is defined in beginning.. glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE); glutInitWindowSize(g_width,g_height); printf("..Loading extensions: %s\n", glewGetErrorString(glewInit())); if(!glewIsSupported("GL_VERSION_2_0 ""GL_ARB_pixel_buffer_object " "GL_EXT_framebuffer_object ")) { fprintf(stderr, "ERROR: Support for necessary OpenGL extensions missing."); fflush(stderr); } glEnable(GL_TEXTURE_2D); glGenTextures(1, ≷_Tex); glBindTexture(GL_TEXTURE_2D, gl_Tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, g_width, g_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, h_Src); glGenBuffers(1, ≷_PBO); glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, gl_PBO); glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, g_width * g_height * 4, h_Src, GL_STREAM_COPY); is in init and in my displayfunc d_dst = (TColor*)glMapBufferARB(gl_PBO, GL_READ_WRITE); //some calculations on which i have to write to the texture, buffer, .. d_dst[Cposition++] = make_color(r,g,b,0); which complains with a Access violation writing location 0x00000000 . . Anybody would be so kind to look through this code and help me (and explain what i did wrong so I will never do it again ;) ).. Kind regards EDIT * TYPO
Spoonbender
Spoonbender
What you need to know about debugging.
Your problem is not (directly) an OpenGL error. You're simply trying to read or write from a null pointer. Use a debugger to find out where that pointer is, and then find out why it is null.
V-man
V-man
Looks like you forgot to create a window.
Here is an example

glutInit(&argc, argv);glutInitWindowPosition(10, 10);glutInitWindowSize(512, 512);glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA );glutCreateWindow("title");

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.