PDA

View Full Version : Runtime error while loading .ppm for texture maps



MastahYodah
05-09-2009, 10:59 AM
Hi everyone,

This might not be directly related to computer graphics, but when I use texture maps and load a certain number of images, I get the following error:

../common/dri_bufmgr_fake.c:594: dri_fake_bo_alloc: Assertion `size != 0' failed.

When I use gdb to debug, it spits out this for "where" :

(gdb) where
#0 0xb80e4430 in __kernel_vsyscall ()
#1 0xb7d528a0 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7d54268 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0xb7d4b72e in __assert_fail () from /lib/tls/i686/cmov/libc.so.6
#4 0xb7924c8e in ?? () from /usr/lib/dri/i915_dri.so
#5 0xb79240b1 in dri_bo_alloc () from /usr/lib/dri/i915_dri.so
#6 0xb792caae in intel_region_alloc () from /usr/lib/dri/i915_dri.so
#7 0xb792ea9d in intel_miptree_create () from /usr/lib/dri/i915_dri.so
#8 0xb793014a in ?? () from /usr/lib/dri/i915_dri.so
#9 0xb7930c3e in intelTexImage2D () from /usr/lib/dri/i915_dri.so
#10 0xb79cbd05 in _mesa_TexImage2D () from /usr/lib/dri/i915_dri.so
#11 0x0804c00e in BoxInit ()
#12 0x08049cea in myinit ()
#13 0x0804b250 in main ()




This occurs in file Box.c where I texture map a skybox. The code is huge, so I will only post BoxInit(), where I use TexImage2d:

void BoxInit() {

//image1 = (image1*)mallloc(sizeof(image1));

image1 = reader(&h1, &w1, &co1, "city_ft.ppm");
image2 = reader(&h2, &w2, &co2, "city_lf.ppm");
image3 = reader(&h3, &w3, &co3, "city_bk.ppm");
image4 = reader(&h4, &w4, &co4, "city_rt.ppm");
image5 = reader(&h5, &w5, &co5, "city_up.ppm");
image6 = reader(&h6, &w6, &co6, "city_dn.ppm");
image7 = reader(&h7, &w7, &co7, "stars.ppm");

glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glPixelStorei(GL_UNPACK_SWAP_BYTES,GL_TRUE);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);



// glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
// glTexGenfv(GL_S, GL_OBJECT_LINEAR, planes);
// glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
// glTexGenfv(GL_T, GL_OBJECT_LINEAR, planet);
// glEnable(GL_TEXTURE_GEN_T);

glGenTextures(6, _skybox);
glBindTexture(GL_TEXTURE_2D, _skybox[0]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h1,w1,0,GL_RGB,GL_U NSIGNED_INT, image1);


// glGenTextures(6, _skybox);
glBindTexture(GL_TEXTURE_2D, _skybox[1]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h2,w2,0,GL_RGB,GL_U NSIGNED_INT, image2);

// glGenTextures(6, _skybox);
glBindTexture(GL_TEXTURE_2D, _skybox[2]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h3,w3,0,GL_RGB,GL_U NSIGNED_INT, image3);


// glGenTextures(6, _skybox);
glBindTexture(GL_TEXTURE_2D, _skybox[3]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h4,w4,0,GL_RGB,GL_U NSIGNED_INT, image4);


// glGenTextures(6, _skybox);
glBindTexture(GL_TEXTURE_2D, _skybox[4]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h5,w5,0,GL_RGB,GL_U NSIGNED_INT, image5);

// glGenTextures(6, _skybox);
glBindTexture(GL_TEXTURE_2D, _skybox[5]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h6,w6,0,GL_RGB,GL_U NSIGNED_INT, image6);

// glEnable(GL_TEXTURE_GEN_S);
// glEnable(GL_TEXTURE_GEN_T);
printf("adasdaas\n");


glGenTextures(1, temple);
glBindTexture(GL_TEXTURE_2D, temple[0]);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D,0,3,h7,w7,0,GL_RGB,GL_U NSIGNED_INT, image7);

}


If anyone knows anything about this error msg that is associated with glTexImage2D, please let me know, I really don't know how ti fix it. I am using Ubuntu 8.10.