Archived

This topic is now archived and is closed to further replies.

Waldoo

Load image, Visual Basic

Recommended Posts

Waldoo    122
I downloaded Lesson 18 conversion by The Gilb. I tried to modify bmpdata = loadbmp (app.path & "wall.bmp") to bmpdata = form3.picture1.picture to get wall.bmp image from picture box directly. It won''t work. Any suggestion please Waldoo

Share this post


Link to post
Share on other sites
VisualB4BigD    122
As I understand it, your trying to get one picture from a picture box into another picture box. If I''m correct you should just be able to

Picture1.Picture = Picture2.Picture

Try that, see if that works.


I sure hope this world isn''t one big joke, because I don''t get it.

Share this post


Link to post
Share on other sites
Waldoo    122
Yes it would work but its for texture map in opengl. I should''ve posted a paragraph of code here:

Private Sub LoadGLTextures()
Dim bmpdata() As Byte
Dim width As GLsizei, height As GLsizei
Dim Pic As Picture

bmpdata = form3.picture1.picture

''
'' !!! WARNING !!!
''
'' These values are hard-coded, but only because I couldn''t find a gracious way
'' of returning the width and height of the bitmap from the LoadBMP function
'' whilst still keeping NeHe compliant When loading your own bitmaps you can find
'' their width and height in the LoadBMP function as bmInfo.biWidth / biHeight
''
width = 64
height = 64

glGenTextures 3, texture(0)

glBindTexture glTexture2D, texture(0)
glTexParameteri glTexture2D, tpnTextureMagFilter, GL_NEAREST
glTexParameteri glTexture2D, tpnTextureMinFilter, GL_NEAREST
glTexImage2D glTexture2D, 0, 3, width, height, 0, tiBGRExt, GL_UNSIGNED_BYTE, bmpdata(0)

glBindTexture glTexture2D, texture(1)
glTexParameteri glTexture2D, tpnTextureMagFilter, GL_LINEAR
glTexParameteri glTexture2D, tpnTextureMinFilter, GL_LINEAR
glTexImage2D glTexture2D, 0, 3, width, height, 0, tiBGRExt, GL_UNSIGNED_BYTE, bmpdata(0)

glBindTexture glTexture2D, texture(2)
glTexParameteri glTexture2D, tpnTextureMagFilter, GL_LINEAR
glTexParameteri glTexture2D, tpnTextureMinFilter, GL_LINEAR_MIPMAP_NEAREST
gluBuild2DMipmaps glTexture2D, 3, width, height, tiBGRExt, GL_UNSIGNED_BYTE, VarPtr(bmpdata(0))

Erase bmpdata
End Sub

Share this post


Link to post
Share on other sites
TeraByte    122
quote:
Original post by Waldoo
Yes it would work but its for texture map in opengl. I should''ve posted a paragraph of code here:

Private Sub LoadGLTextures()
Dim bmpdata() As Byte
Dim width As GLsizei, height As GLsizei
Dim Pic As Picture

bmpdata = form3.picture1.picture



Umm... is bmpdata a dynamic array?
Dim bmpdata() As Byte
And when you use can you use it without specifying an index?
I use a lot of Visual BASIC but have not used OpenGL with it (im working my way through NeHe''s c++ tutorials)
And finally, is the data for a bitmap Byte data (as in the VB Byte data type)?

Anyhows, thats the part of the code i did not understand, maybe me pointing it out will help you maybe not...

Share this post


Link to post
Share on other sites
Laz    608
quote:
Original post by Waldoo
I downloaded Lesson 18 conversion by The Gilb. I tried to modify bmpdata = loadbmp (app.path & "wall.bmp") to bmpdata = form3.picture1.picture to get wall.bmp image from picture box directly. It won''t work. Any suggestion please

Waldoo



I don''t know if your problem is fuces yet, or if you have tried this, but to load a bitmap in vb, you have to have loadbmp()... so try loadbmp(form3.picture1.picture);

Share this post


Link to post
Share on other sites
TheGilb    372
*sigh* Amateurs...

I''ll tell you why it doesn''t work! It doesn''t work because it doesn''t make sense for a start! How can you set an array of bytes to a VB picturebox object? The point of my code was to remove the dependancy on the picturebox ActiveX control.

Delete picturebox. That''s right delete it. You done deleting it? Good! Ugh - ugly bulky ActiveX controls... My lovely port uses not a single ActiveX control and DAMNIT KEEP IT THAT WAY please :D

Ok now stop trying to use ActiveX controls. Forget Visual Basic even -has- ActiveX controls. When I code in VB I dont even have the toolbar visible! Gives me more desk space to work with and stops me from thinking of those controls too much Now, welcome to the real world of game coding! Welcome welcome welcome! I''m sure you will find the difference both pleasing and enjoyable :D



-------- E y e .Scream Software --------
----------------------------------------
                                  /-\
    http://www.eyescream.cjb.net | * |
                                  \-/
----------------------------------------

Share this post


Link to post
Share on other sites
Waldoo    122
I have been trying to capture screen and put it on opengl 3D object as a texture map.

I deleted all activex controls and found a variable and code where screen capture code sends bmp image to picturebox. I modified bmpdata = LoadBMP (app.path & "\data\wall.bmp") to :

1. bmpdata = loadbmp(screencapture1) <-- it won''t work, it is a private function and variable, it receives screen capture image from CaptureWindows(hWndCapture, false, xpos, yos, hsize,wsize) and it sends the image to picture box.
2. bmpdata = loadbmp(form3.image2.picture) <-- it does work but picture isnt clear like it only picked up some pixels.

Any suggestion?

Waldoo

Share this post


Link to post
Share on other sites