Attempted to read or write protected memory with Ilut.ilutGLBindTexImage()

View: New views
4 Messages — Rating Filter:   Alert me  

Attempted to read or write protected memory with Ilut.ilutGLBindTexImage()

by sinosoidal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have an app which uses OpenGL to make a 3D slidshow.

I pass it a directory and it processes all the files present in it.

This app was converted in a windows control and it is called by a
control manager in a thread, along with other controls.

I'm having problems with this function if other controls are used as
well. If other controls are not used, there is no problem at all.

The result is:

[System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at Tao.DevIl.Ilut.ilutGLBindTexImage()

My loading function is:

bool loadImages()
{
images = new int[2];

Il.ilGenImages(2, imageIds); // Generate Image Ids

for (int i = 0; i < 2; i++)
{
Console.WriteLine("Loading images!");
Il.ilBindImage(imageIds[i]); // Bind Image Id to Be Current
if (!Il.ilLoadImage(imagesName[i]))
{
Il.ilDeleteImages(2, imageIds);
return false;
}

Console.WriteLine(
"Image name: " + imagesName[i] +
" Width: " + Il.ilGetInteger(Il.IL_IMAGE_WIDTH) +
" Height: " + Il.ilGetInteger(Il.IL_IMAGE_HEIGHT));

Console.WriteLine("images[" + i + "]");

images[i] = Ilut.ilutGLBindTexImage();

if (Il.ilGetError() != 0)
{
Console.WriteLine("Image loading error report: " +
Ilu.iluErrorString(Il.ilGetError()));
Il.ilDeleteImages(2, imageIds);
return false;
}
}

return true;
}

My guess is that the texture that is being updated is being used by the
render process, but by the time i do that, i think they are not being used.

Can anyone help me finding what is wrong with this?

Many thx,

Nuno
_______________________________________________
Tao-list mailing list
Tao-list@...
http://galactus.ximian.com/mailman/listinfo/tao-list

Re: Attempted to read or write protected memory with Ilut.ilutGLBindTexImage()

by JTalton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When accessing either windows forms controls or opengl, the calls need to be done on the main thread.

On 5/17/07, Nuno Santos <developer@...> wrote:
Hi,

I have an app which uses OpenGL to make a 3D slidshow.

I pass it a directory and it processes all the files present in it.

This app was converted in a windows control and it is called by a
control manager in a thread, along with other controls.

I'm having problems with this function if other controls are used as
well. If other controls are not used, there is no problem at all.

The result is:

[System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.
at Tao.DevIl.Ilut.ilutGLBindTexImage()

My loading function is:

bool loadImages()
{
images = new int[2];

Il.ilGenImages(2, imageIds); // Generate Image Ids

for (int i = 0; i < 2; i++)
{
Console.WriteLine("Loading images!");
Il.ilBindImage(imageIds[i]); // Bind Image Id to Be Current
if (!Il.ilLoadImage(imagesName[i]))
{
Il.ilDeleteImages(2, imageIds);
return false;
}

Console.WriteLine(
"Image name: " + imagesName[i] +
" Width: " + Il.ilGetInteger(Il.IL_IMAGE_WIDTH) +
" Height: " + Il.ilGetInteger(Il.IL_IMAGE_HEIGHT));

Console.WriteLine ("images[" + i + "]");

images[i] = Ilut.ilutGLBindTexImage();

if (Il.ilGetError() != 0)
{
Console.WriteLine("Image loading error report: " +
Ilu.iluErrorString(Il.ilGetError ()));
Il.ilDeleteImages(2, imageIds);
return false;
}
}

return true;
}

My guess is that the texture that is being updated is being used by the
render process, but by the time i do that, i think they are not being used.

Can anyone help me finding what is wrong with this?

Many thx,

Nuno
_______________________________________________
Tao-list mailing list
Tao-list@...
http://galactus.ximian.com/mailman/listinfo/tao-list


_______________________________________________
Tao-list mailing list
Tao-list@...
http://galactus.ximian.com/mailman/listinfo/tao-list

Re: Attempted to read or write protected memory with Ilut.ilutGLBindTexImage()

by sinosoidal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'll try to figure out if that solves my problem.

Thx,

Nuno

James Talton wrote:

> When accessing either windows forms controls or opengl, the calls need
> to be done on the main thread.
>
> On 5/17/07, *Nuno Santos* < developer@...
> <mailto:developer@...>> wrote:
>
>     Hi,
>
>     I have an app which uses OpenGL to make a 3D slidshow.
>
>     I pass it a directory and it processes all the files present in it.
>
>     This app was converted in a windows control and it is called by a
>     control manager in a thread, along with other controls.
>
>     I'm having problems with this function if other controls are used as
>     well. If other controls are not used, there is no problem at all.
>
>     The result is:
>
>     [System.AccessViolationException: Attempted to read or write protected
>     memory. This is often an indication that other memory is corrupt.
>     at Tao.DevIl.Ilut.ilutGLBindTexImage()
>
>     My loading function is:
>
>     bool loadImages()
>     {
>     images = new int[2];
>
>     Il.ilGenImages(2, imageIds); // Generate Image Ids
>
>     for (int i = 0; i < 2; i++)
>     {
>     Console.WriteLine("Loading images!");
>     Il.ilBindImage(imageIds[i]); // Bind Image Id to Be Current
>     if (!Il.ilLoadImage(imagesName[i]))
>     {
>     Il.ilDeleteImages(2, imageIds);
>     return false;
>     }
>
>     Console.WriteLine(
>     "Image name: " + imagesName[i] +
>     " Width: " + Il.ilGetInteger(Il.IL_IMAGE_WIDTH) +
>     " Height: " + Il.ilGetInteger(Il.IL_IMAGE_HEIGHT));
>
>     Console.WriteLine ("images[" + i + "]");
>
>     images[i] = Ilut.ilutGLBindTexImage();
>
>     if (Il.ilGetError() != 0)
>     {
>     Console.WriteLine("Image loading error report: " +
>     Ilu.iluErrorString(Il.ilGetError ()));
>     Il.ilDeleteImages(2, imageIds);
>     return false;
>     }
>     }
>
>     return true;
>     }
>
>     My guess is that the texture that is being updated is being used
>     by the
>     render process, but by the time i do that, i think they are not
>     being used.
>
>     Can anyone help me finding what is wrong with this?
>
>     Many thx,
>
>     Nuno
>     _______________________________________________
>     Tao-list mailing list
>     Tao-list@... <mailto:Tao-list@...>
>     http://galactus.ximian.com/mailman/listinfo/tao-list
>
>

_______________________________________________
Tao-list mailing list
Tao-list@...
http://galactus.ximian.com/mailman/listinfo/tao-list

Re: Attempted to read or write protected memory with Ilut.ilutGLBindTexImage()

by sinosoidal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Yes, that was the problem!

Many thx,

Nuno


James Talton wrote:

> When accessing either windows forms controls or opengl, the calls need
> to be done on the main thread.
>
> On 5/17/07, *Nuno Santos* < developer@...
> <mailto:developer@...>> wrote:
>
>     Hi,
>
>     I have an app which uses OpenGL to make a 3D slidshow.
>
>     I pass it a directory and it processes all the files present in it.
>
>     This app was converted in a windows control and it is called by a
>     control manager in a thread, along with other controls.
>
>     I'm having problems with this function if other controls are used as
>     well. If other controls are not used, there is no problem at all.
>
>     The result is:
>
>     [System.AccessViolationException: Attempted to read or write protected
>     memory. This is often an indication that other memory is corrupt.
>     at Tao.DevIl.Ilut.ilutGLBindTexImage()
>
>     My loading function is:
>
>     bool loadImages()
>     {
>     images = new int[2];
>
>     Il.ilGenImages(2, imageIds); // Generate Image Ids
>
>     for (int i = 0; i < 2; i++)
>     {
>     Console.WriteLine("Loading images!");
>     Il.ilBindImage(imageIds[i]); // Bind Image Id to Be Current
>     if (!Il.ilLoadImage(imagesName[i]))
>     {
>     Il.ilDeleteImages(2, imageIds);
>     return false;
>     }
>
>     Console.WriteLine(
>     "Image name: " + imagesName[i] +
>     " Width: " + Il.ilGetInteger(Il.IL_IMAGE_WIDTH) +
>     " Height: " + Il.ilGetInteger(Il.IL_IMAGE_HEIGHT));
>
>     Console.WriteLine ("images[" + i + "]");
>
>     images[i] = Ilut.ilutGLBindTexImage();
>
>     if (Il.ilGetError() != 0)
>     {
>     Console.WriteLine("Image loading error report: " +
>     Ilu.iluErrorString(Il.ilGetError ()));
>     Il.ilDeleteImages(2, imageIds);
>     return false;
>     }
>     }
>
>     return true;
>     }
>
>     My guess is that the texture that is being updated is being used
>     by the
>     render process, but by the time i do that, i think they are not
>     being used.
>
>     Can anyone help me finding what is wrong with this?
>
>     Many thx,
>
>     Nuno
>     _______________________________________________
>     Tao-list mailing list
>     Tao-list@... <mailto:Tao-list@...>
>     http://galactus.ximian.com/mailman/listinfo/tao-list
>
>

_______________________________________________
Tao-list mailing list
Tao-list@...
http://galactus.ximian.com/mailman/listinfo/tao-list