Original Post
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