• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Upgrading from 0.22 to 0.26.4

Started by Rodrigo Robles, 13 February 2012, 12:50:03

Previous topic - Next topic

Rodrigo Robles

Hi friends,

    I'm using Imaging version 0.22 in a game project, and now I realize that I will need the TImagingCanvas blending. So upgrade Imaging is required.
    The only thing I had to change in the source was the property TSingleImage.ImageData that was renamed to ImageDataPointer. After this the project successfully built.
    For my surprise the program emits a segmentation fault message at start. I tried to debug it, but it happens before the first line of code!
    So... I did anything wrong?

Galfar

Hi Rodrigo,
could you provide some details about compiler and OS you use for Mundo?
Maybe there could be some problem with code in "initialization" section in Imaging in your OS+compiler combination.

Rodrigo Robles

15 March 2012, 19:11:21 #2 Last Edit: 15 March 2012, 19:13:13 by Rodrigo Robles
After upgrade Lazarus, I can get a stack image:


#0 ?? at :0
#1 ISGLEXTENSIONSUPPORTED(0x818c118 'GL_ARB_texture_compression') at ./Imaging/Extensions/ImagingOpenGL.pas:316
#2 GETGLTEXTURECAPS({MAXTEXTURESIZE = 135828120, NONPOWEROFTWO = true (254), DXTCOMPRESSION = true (217), ATI3DCCOMPRESSION = true (5), LATCCOMPRESSION = true (8), FLOATTEXTURES = true (84), MAXANISOTROPY = 135851124, MAXSIMULTANEOUSTEXTURES = 135828120, CLAMPTOEDGE = true (92), TEXTURELOD = true (244), VERTEXTEXTUREUNITS = 134576832}) at ./Imaging/Extensions/ImagingOpenGL.pas:340
#3 CREATEGLTEXTUREFROMMULTIIMAGE(0xb7f70778, 0, 0, true, 0, IFUNKNOWN, 0x0, 0x0) at ./Imaging/Extensions/ImagingOpenGL.pas:576
#4 CREATEGLTEXTUREFROMIMAGE({WIDTH = 0, HEIGHT = 0, FORMAT = IFUNKNOWN, SIZE = 211550273, BITS = 0xb7f60cdc, PALETTE = 0x0}, 0, 0, false, IFUNKNOWN, 0xbffff408, 0x0) at ./Imaging/Extensions/ImagingOpenGL.pas:540
#5 TTEXTUREIMAGING__LOAD(0xb7f60c28 '../client/data/font/dejavu-mono-white.png', <error reading variable>) at textureimagings.pas:34
#6 TFONTBITMAP__CREATE(0xb7f60c28 '../client/data/font/dejavu-mono-white.png', 0xb7f60c90) at fontbitmaps.pas:57
#7 TFONT__CREATE(0xb7f60c28 '../client/data/font/dejavu-mono-white.png', 0xb7f70790) at fonts.pas:52
#8 TGAME__CREATE(0xbffff408) at /media/dados/rodrigo/temp/mundo_trunk/src/common/games.pas:822
#9 GAMES_init at /media/dados/rodrigo/temp/mundo_trunk/src/common/games.pas:2370
#10 fpc_initializeunits at :0
#11 ?? at :0
#12 __libc_start_main at :0
#13 SI_C21__FPC_LIBC21_START at :0

In 0.22 version I used TSingleImage.ImageData. In 0.26 this property was apparently replaced by ImageDataPointer. This assumption is correct? So I replaced it in my source, that looks like:

procedure TTextureImaging.Load(AFileName: string);
var
  i: TSingleImage;
begin
  Debug.Msg(dlBegin, 'TTextureImaging.Load("' + AFileName + '")');
  i := nil;
  try
    i := TSingleImage.Create;
    i.LoadFromFile(AFileName);
    FWidth := i.Width;
    FHeight := i.Height;
    FId := CreateGLTextureFromImage(i.ImageDataPointer^);
    i.Free;
  except
    i.Free;
    raise;
  end;
end;

The exception is raised in the line: FId := CreateGLTextureFromImage(i.ImageDataPointer^);
Now I'm using Lazarus 0.9.30 and Ubuntu 11.10.

Rodrigo Robles

The solution was simple: The new Imaging  uses dglOpenGL. DglOpenGL requires initialization through InitOpenGL. After adding this initialization the access violation is gone.

Galfar

You can configure ImagingOpenGL to use "Gl, Glu" instead of "dglOpenGL headers if that's what you are using in Mundo.

Rodrigo Robles

DglOpenGL have more features than the traditional gl headers, right?

Galfar

dglOpenGL is still being updated so new OpenGL features are in (e.g. OpenGL 3/4),
I'm not sure if "GL, GLext" headers are. 
It doesn't matter if your game targets older hardware (where new OpenGL features are not supported
by HW anyway).

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk