Recent

Author Topic: TBGRABitmap to Texture possible?  (Read 2067 times)

JasonLugg

  • Jr. Member
  • **
  • Posts: 67
TBGRABitmap to Texture possible?
« on: March 15, 2018, 09:05:13 am »
Hi All, thx in advance.

I am creating a TBGRABitmap using:

Code: Pascal  [Select][+][-]
  1. Spr:=TBGRABitmap.Create(sfilename);
  2.  

As expected this creates an image whoch can be drawn on a canvas.

I then want to use this image as a base for an IBGLtexture (mainly because I want to use animated sprites and so far have only got animated textures working?)

When I do this
Code: Pascal  [Select][+][-]
  1. MyTexture:=IBGLTexture(Spr.Bitmap);
  2.  

It throws an error stating bitmap no the correct size?

I am drawing to a virtual screen btw.

Ideally what I want is to be able to load a bunch of images as TBGRABitmaps and display these in a list (no issues here)' then drag and drop them onto the virtual screen, which so far crashes.

Even drawing the Spr to the virtual screen's TBitmap does not work?

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: TBGRABitmap to Texture possible?
« Reply #1 on: March 31, 2018, 08:54:33 pm »
Spr.Bitmap is an LCL TBitmap. Simply do BGLTexture(Spr)

Note also that it is not with an I in the beginning. IBGLTexture(Spr.Bitmap) which would be supposing that Spr.Bitmap is itself an IBGLTexture.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018