convert image to array of bytes or InPtr

R

Ricardo Furtado

I'm using OpenGL in Visual Basic .net 2005 and i need to use the following
function

glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap as System.InPtr)

or

glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap() as byte)

I've been looking for a way to pass an array of bytes or a pointer to an
image, in visual basic .net but i don't seem to find it.
either if i use an image
Dim imgToPtr As Image = Image.FromFile("C:\TestImage.jpg")

or a bitmap
Dim bmpTest As Bitmap = New Bitmap("C:\TestImage.jpg")

i can't find a way to convert it to a pointer or an array of bytes.

Can you help?

My thanks in advanced

Ricardo Furtado
 
A

Armin Zingler

Ricardo Furtado said:
I'm using OpenGL in Visual Basic .net 2005 and i need to use the
following function

glBitmap(width as integer,height as integer, xorig as single, yorig
as single, xmove as single, ymove as single, bitmap as System.InPtr)

or

glBitmap(width as integer,height as integer, xorig as single, yorig
as single, xmove as single, ymove as single, bitmap() as byte)

I've been looking for a way to pass an array of bytes or a pointer
to an image, in visual basic .net but i don't seem to find it.
either if i use an image
Dim imgToPtr As Image = Image.FromFile("C:\TestImage.jpg")

or a bitmap
Dim bmpTest As Bitmap = New Bitmap("C:\TestImage.jpg")

i can't find a way to convert it to a pointer or an array of bytes.

Can you help?

Have a look at the Bitmap's LockBits function. The Scan0 property of the
returned object might be what you're looking for. I don't know if the
function expects any header.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top