cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

verput
Journeyman III

Crash with atioglxx error

Hallo!
My application is creshed with this error:

Exception with Klasse EAccessViolation. Zugriffsverletzung bei Adresse 6903151D in Modul atioglxx.dll. Lesen von Adresse (MEISTENS) 1D92100 aufgetretten.

I have ATI FireGL V7600 graphic.
It crashed not allways(WHY?), but often.

I make 3d rendering with Texture, using OpenGL, and need a functions as glTexImage3D and glTexParameterf.
What can I do?

Thanks!

0 Likes
1 Reply
verput
Journeyman III

If (gTexture.Handle = 0)  Then Begin
      Assert (GL_EXT_texture3D, 'Graphic card does not support 3D textures.');
      //Use PROXY to see if video card can support a texture...
      //http://www.opengl.org/resources/faq/technical/texture.htm
      //glTexImage3D(GL_PROXY_TEXTURE_2D, level, internalFormat,  width, height, border, format, type, NULL);
     //Note the pixels parameter is NULL, because OpenGL doesn't load texel data when the target parameter is GL_PROXY_TEXTURE_2D. Instead, OpenGL merely considers whether it can accommodate a texture of the specified size and description. If the specified texture can't be accommodated, the width and height texture values will be set to zero. After making a texture proxy call, you'll want to query these values as follows:
      glTexImage3D   (GL_PROXY_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], 0, gTexture3D.DataType, GL_UNSIGNED_BYTE, nil);
     glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_WIDTH, @i);
     if i < 1 then begin
         showmessage('Your video card is unable to load an image that is this large.');
         exit;
     end;
     //end of PROXY
      If (gTexture.Handle = 0) then
        gTexture.AllocateHandle;
      glBindTexture (GL_TEXTURE_3D, gTexture.Handle);
      glTexParameterf (GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
      glTexParameterf (GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
      glTexParameterf (GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP);
      glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      glTexParameteri (GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
      //OSX glTexImage3D not glTexImage3DEXT
      {$IFDEF Darwin}
      glTexImage3D   (GL_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], 0, gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar(gTexture3D.FiltImg));
      {$ELSE}
      glTexImage3DExt   (GL_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], 0, gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar(gTexture3D.FiltImg));
      {$ENDIF}
      //glTexImage3DEXT    (GL_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], 0, gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar(gTexture3D.FiltImg));
      //glTexImage3DEXT    (GL_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.Dim[1], gTexture3D.Dim[2], gTexture3D.Dim[3], 0, gTexture3D.Data_Type, GL_UNSIGNED_BYTE, PChar (gTexture3D.OData));
  End; //new texture
  //exit;
  If M_Refresh = TRUE Then Begin //if texture changed due to loading new image, adjusting surface threshold, changing cutout
      M_Refresh := FALSE;
      Calculate_Transfer_Function;
      //glTexImage3D    (GL_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.Dim[1], gTexture3D.Dim[2], gTexture3D.Dim[3], 0, gTexture3D.Data_Type, GL_UNSIGNED_BYTE, PChar (gTexture3D.OData));
      //glTexImage3DEXT    (GL_TEXTURE_3D, 0, GL_RGBA8, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], 0, gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar(gTexture3D.FiltImg));
      //OSX only supports glTexSubImage3D not glTexSubImage3DExt
      //Intel cards on Windows only support glTexSubImage3D not glTexSubImage3DExt
      {$IFDEF FPC}
              {$IFDEF Darwin}
              glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar (gTexture3D.FiltImg));
              {$ELSE} //The stable release of Lazarus GLScene for Windows only includes the Ext version...
              glTexSubImage3DExt (GL_TEXTURE_3D, 0, 0, 0, 0, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar (gTexture3D.FiltImg));
              {$ENDIF}
      {$ELSE} //not FPC - Intel cards on Windows prefer glTexSubImage3D over glTexSubImage3DExt
      glTexSubImage3D (GL_TEXTURE_3D, 0, 0, 0, 0, gTexture3D.FiltDim[1], gTexture3D.FiltDim[2], gTexture3D.FiltDim[3], gTexture3D.DataType, GL_UNSIGNED_BYTE, PChar (gTexture3D.FiltImg));
      {$ENDIF}
  End; //if M_refresh


// reset matrix - glLoadIdentity();
  glPushAttrib (GL_ENABLE_BIT);
  glPushMatrix;
  glEnable (GL_BLEND);
  //glShadeModel(GL_SMOOTH);
  //integration can select brightest voxel that the ray traverses [MIP]
  // or the data can be integrated based on alpha level [trnanslucent slices]
  if MIPMenu.checked  then
      glBlendEquationEXT(GL_MAX_EXT)
  else
      glBlendEquationEXT(GL_FUNC_ADD_EXT);
  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glDisable (GL_CULL_FACE);
  glDisable (GL_LIGHTING);
  //glEnable (GL_LIGHTING);
  glTexGenf (GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
  glTexGenf (GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
  glTexGenf (GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
  SetVector (v, XVector, 0.5);
  glTexGenfv (GL_S, GL_OBJECT_PLANE, @v);
  SetVector (v, YVector, 0.5);
  glTexGenfv (GL_T, GL_OBJECT_PLANE, @v);
  SetVector (v, ZVector, 0.5);
  glTexGenfv (GL_R, GL_OBJECT_PLANE, @v);
  glEnable (GL_TEXTURE_GEN_S);
  glEnable (GL_TEXTURE_GEN_T);
  glEnable (GL_TEXTURE_GEN_R);
  //without clip planes, voxels on the edges bleed into the periphery...
  glClipPlane(GL_CLIP_PLANE0, @clip0);
  glClipPlane(GL_CLIP_PLANE1, @clip1);
  glClipPlane(GL_CLIP_PLANE2, @clip2);
  glClipPlane(GL_CLIP_PLANE3, @clip3);
  glClipPlane(GL_CLIP_PLANE4, @clip4);
  glClipPlane(GL_CLIP_PLANE5, @clip5);
  glEnable(GL_CLIP_PLANE0);
  glEnable(GL_CLIP_PLANE1);
  glEnable(GL_CLIP_PLANE2);
  glEnable(GL_CLIP_PLANE3);
  glEnable(GL_CLIP_PLANE4);
  glEnable(GL_CLIP_PLANE5);
  //finally, draw object
  glBindTexture (GL_TEXTURE_3D, gTexture.Handle);
if gPrefs.RenderQuality = kNORender then begin //draw slice sections instead of rendering...
    //glColor4f (1, 1, 1,1);
  //glBlendFunc (GL_ONE,GL_ZERO{GL_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA});
  glBlendFunc (GL_ONE,GL_ZERO);
  glEnable (GL_TEXTURE_3D);
  // glMatrixMode(GL_MODELVIEW);
  z := 0; //slice
  glBegin (GL_QUADS);
  //X constant : sagittal
      glVertex3f (z, 1, 1);
      glVertex3f (z, -1, 1);
      glVertex3f (z,-1,-1);
      glVertex3f (z, 1, -1);
  //Y constant : coronal
      glVertex3f (1, z, 1);
      glVertex3f ( -1,z, 1);
      glVertex3f (-1,z,-1);
      glVertex3f (1,z, -1);
  //Z constant : axial
      glVertex3f (1, 1, z);
      glVertex3f (-1, 1, z);
      glVertex3f (-1,-1, z);
      glVertex3f (1, -1, z);
  glEnd;
end else begin //not 2D planes ... next 3D rendering
  depthplanes := round(sqrt(sqr(gTexture3D.FiltDim[1])+sqr(gTexture3D.FiltDim[2])+sqr(gTexture3D.FiltDim[3])));
  if gPrefs.RenderQuality = kFastRender then
    depthplanes := depthplanes div 2;//round(sqrt(sqr(gTexture3D.FiltDim[1])+sqr(gTexture3D.FiltDim[2])+sqr(gTexture3D.FiltDim[3])));
  if depthplanes < 1 then
    depthplanes := 1;
  glEnable (GL_TEXTURE_3D);
  glGetFloatv (GL_MODELVIEW_MATRIX, @mat);
  vx [0] := mat [0] [0];
  vy [0] := mat [0] [1];
  vz [0] := mat [0] [2];
  vx [1] := mat [1] [0];
  vy [1] := mat [1] [1];
  vz [1] := mat [1] [2];
  vx [2] := mat [2] [0];
  vy [2] := mat [2] [1];
  vz [2] := mat [2] [2];
  ScaleVector (vx, DIAGONAL_LENGTH * 0.5 / VectorLength (vx));
  ScaleVector (vy, DIAGONAL_LENGTH * 0.5 / VectorLength (vy));
  ScaleVector (vz, DIAGONAL_LENGTH * 0.5 / VectorLength (vz));
  step := DIAGONAL_LENGTH / depthplanes;
  z := -DIAGONAL_LENGTH / 2;
  glBegin (GL_QUADS);
  glColor4f (gObjRed, gObjGreen, gObjBlue, 1.0);
    For i := 0 To depthplanes - 1 Do Begin
      //next line commented out...surface normals not used for volume rendering
      //glNormal3f (-GLCamera.AbsoluteVectorToTarget [0], -GLCamera.AbsoluteVectorToTarget [1], -GLCamera.AbsoluteVectorToTarget [2]);
      glVertex3f (vx [0] + vy [0] + vz [0] * z, vx [1] + vy [1] + vz [1] * z, vx [2] + vy [2] + vz [2] * z);
      glVertex3f (-vx [0] + vy [0] + vz [0] * z, -vx [1] + vy [1] + vz [1] * z, -vx [2] + vy [2] + vz [2] * z);
      glVertex3f (-vx [0] - vy [0] + vz [0] * z, -vx [1] - vy [1] + vz [1] * z, -vx [2] - vy [2] + vz [2] * z);
      glVertex3f (vx [0] - vy [0] + vz [0] * z, vx [1] - vy [1] + vz [1] * z, vx [2] - vy [2] + vz [2] * z);
      z := z + step;
    End;
  glEnd;
end; //Rendering
  if MIPMenu.checked  then //return to normal, otherwise overlay text appears odd..
      glBlendEquationEXT(GL_FUNC_ADD_EXT);

  glPopMatrix;
  glPopAttrib;

 

 

Can everobody help me???

0 Likes