Advertisement

Tutorial 22 - Solar System -VB

Started by October 18, 2003 02:07 PM
2 comments, last by Falke 21 years, 4 months ago
Hi! I wanted to make a solar system with 5 planets and 27 different textures (so i can say that in this solarsystem planet 1 has texture 5 and in the next planet 1 has textur 20 e.g.) i used code from following link: http://planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=47711 Now if i add some texture i can''t assign a texture, can somebody help me? Falke
Elaborate. I cannot quite understand what your problem is.
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
Advertisement
I got your email but I couldn''t understand the problem either.
"I can only show you the door, your the one who has to walk through it." -Morpheus
i modified following:
''Texture variables...
Global TArray(0 To 35) As Long, TArray2(0 To 35) As Long, Bdata() As Byte '' I want to add 27 textures in a "buffer" so i can change the texture e.g. when i click on the planet, but he doesn''t change the texture....

in the initGL i added following:

Dim strName As String
Dim i As Long
For i = 1 To 27
strName = Format(i, "00")
If Len(strName) = 1 Then
strName = "0" & strName
End If
LoadBMP App.Path & "\Bilder\Planet_" & strName & ".bmp"
wglMakeCurrent hDC1, hglRC1
glBindTexture GL_TEXTURE_2D, TArray(i + 8)
glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR
glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR
glTexImage2D GL_TEXTURE_2D, 0, 3, Binfo.bmiHeader.biWidth, Binfo.bmiHeader.biHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, Bdata(0)
wglMakeCurrent hDC2, hglRC2
glBindTexture GL_TEXTURE_2D, TArray2(i + 8)
glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR
glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR
glTexImage2D GL_TEXTURE_2D, 0, 3, Binfo.bmiHeader.biWidth, Binfo.bmiHeader.biHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, Bdata(0)
DeleteObject hBitmap: Erase Bdata
Next i

So the textures are in the TArray()

but if i want to assign during runtime the texture will not be assigned

in sub Render_glView1
i only changed e.g. line:

glPushMatrix
glColor3f 0.7!, 0.7!, 0.7!
glRotatef Rev(planet1), 0, 1, 0: glTranslatef 10!, 0!, 0! ''Position around Sun
glRotatef Rot(planet1), 0!, 1!, 0! ''Rotation around centre
glRotatef -90, 1!, 0!, 0! ''upright the Texture

glLoadName planet1 '' planet1 ''(planet1 + .Planet(1).PlanetTyp) ''planet1

glBindTexture GL_TEXTURE_2D, TArray(10): gluSphere QObj, 1, 30, 20
'' glBindTexture GL_TEXTURE_2D, TArray(planet1): gluSphere QObj, 1, 30, 20

glPopMatrix

but he doesn''t load Texture 10 to the planet

I don''t know why

Falke

This topic is closed to new replies.

Advertisement