Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

convert image to array of bytes or InPtr

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

Comments

  • HackmanCHackmanC Member Posts: 441
    Maybe this could help.
    Read the whole file into an array of Byte.
    I remember this was for VB 2002.
    But should work on 2005 (with minor changes maybe!)

    [code] ' READ THE FILE INTO MEMORY
    FileInfo1 = New System.IO.FileInfo("C:jessica-alba-100204-01.jpg")
    FileStream1 = New System.IO.FileStream("C:jessica-alba-100204-01.jpg", IO.FileMode.Open)
    Dim Array1(CInt(FileInfo1.Length - 1)) As Byte
    Debug.WriteLine(FileStream1.Read(Array1, 0, CInt(FileInfo1.Length)))
    FileStream1.Close()

    REM Dim String1 As String
    REM Dim ASCIIEncoding1 As New System.Text.ASCIIEncoding()
    REM String1 = ASCIIEncoding1.GetString(Array1)
    [/code]

    [red]Good luck![/red]
    [blue]Hackman[/blue]
Sign In or Register to comment.