Jump to content

Timage and reading pixels


Madjack
 Share

Recommended Posts

Ok - time for another dumb newbie question.

 

I'm looking to load an image and read pixel colours (with which to ultimately deform a mesh)

 

I would have thought loadimage would be the one, but I'm finding defining a TImage is giving a

'Identifier TImage not found' error when used with the framework.

 

Strict
Framework leadwerks.engine
Local j_image:TImage

 

I'm using BMax v1.45, LE is up to date. Remove the framework ref and the code compiles ok.

 

Is anyone else experiencing this? What am I missing?

Link to comment
Share on other sites

You might be able to use OpenGL functions on that TTexture. Haven't tried this myself, so it's just an idea.

 

There is also the possibility to use an external library to load images and read their pixels. I have used http://www.lonesock.net/soil.html in the past and it worked pretty well.

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

LE doesn't allow native access to pixel data? Seriously?

 

<EDIT> This makes no sense to me. So I can create a buffer for a texture and store texture channel data in that buffer but there's no easy way to read a colour at a given x/y?

 

For example ;

Local TEX_TEMP:TTexture = LoadTexture("abstract::CHECKERBOARD.JPG")
Local T_BUFFER:TBuffer = CreateBuffer(256, 256)
SetBuffer(T_BUFFER)
SetColorBuffer(T_BUFFER, TEX_TEMP)

GetColorBufferXY(T_BUFFER) ' Something like this does not exist in LE?? 

Link to comment
Share on other sites

well it hasnt even been a day since you first posted... patience... remember that the community is spread out across many different time zones and most of us have jobs... so if you do not get an immediate response, give it time...

 

as for your issue, you could just import the glmax2d module into your bmax code, then just use the needed commands from it... im sure there are some commands that you would have to use namespace to prevent conflicts between LE and max2d... just a thought... or you could use raw opengl commands...

 

<edit> the import seems to work... but i have no idea if this will cause any issues elsewhere... using raw opengl might be better...

madjack_opengl.bmx

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...