MP3D Engine Alpha 33
Re: MP3D Engine Alpha 32
Yea, where is MPZ anyway?
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 32
Hi N_Gnom,
i have testet it and the 4.22 lib version works fine with PB 4.31. I will make an update of the lib installer with a new lib version vor 4.24/4.31. I need the time for tests with these new versions and they will have some bugfixings...
Greetings Michael
i have testet it and the 4.22 lib version works fine with PB 4.31. I will make an update of the lib installer with a new lib version vor 4.24/4.31. I need the time for tests with these new versions and they will have some bugfixings...
Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
Re: MP3D Engine Alpha 32
you mean 5.31
i don´t need an installer.
only a working mp3d.
can you post the mp3d that should work.
i don´t need an installer.
only a working mp3d.
can you post the mp3d that should work.
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: MP3D Engine Alpha 32
N_Gnom wrote: i don´t need an installer.
only a working mp3d.

Re: MP3D Engine Alpha 32
well, a working mp3d lib.
Running with PB 5.31
I wouldn´t test all available mp3d´s.
Running with PB 5.31
I wouldn´t test all available mp3d´s.
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
MP_MoveEntity(camera,x,y,z) bug
Here it is a sample to show a MP_MoveEntity(camera,x,y,z) bug.
The issue is that when you use the MP_EntityLookAt(camera,x,y,z) then the space parameters of MP_MoveEntity(camera,x,y,z) result in a mess.
The issue is that when you use the MP_EntityLookAt(camera,x,y,z) then the space parameters of MP_MoveEntity(camera,x,y,z) result in a mess.
Code: Select all
MP_Graphics3D(640,480,0,3)
camera=MP_CreateCamera()
;MP_EntityLookAt(camera,0,0,3) ; <- Un-remark this line to see a MP_MoveEntity(camera) bug!
light=MP_CreateLight(1)
mesh=MP_CreateCube()
MP_PositionEntity(Mesh,0,0,3)
While MP_KeyUp(#PB_Key_Escape) And WindowEvent()<>#PB_Event_CloseWindow
If MP_KeyDown(#PB_Key_Right):MP_MoveEntity(camera,0.01,0,0)
ElseIf MP_KeyDown(#PB_Key_Left):MP_MoveEntity(camera,-0.01,0,0)
ElseIf MP_KeyDown(#PB_Key_Up):MP_MoveEntity(camera,0,0.01,0)
ElseIf MP_KeyDown(#PB_Key_Down):MP_MoveEntity(camera,0,-0.01,0)
ElseIf MP_KeyDown(#PB_Key_A):MP_MoveEntity(camera,0,0,0.01)
ElseIf MP_KeyDown(#PB_Key_Z):MP_MoveEntity(camera,0,0,-0.01)
EndIf
MP_RenderWorld()
MP_Flip()
Wend
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 32
Hi to all,
@N_Gnom the following lib works with PB 5.24 (x86) and PB 5.3.1 (x86)
http://www.flasharts.de/mpz/mp33_beta/d ... ibrary.zip
@Psychophanta
I dont think it is a bug. This is the solution of the mathematical calculation of the Camera lookat function. In this case the Pitch/Yaw of the camera is turning about 90 degrees. I show you what i mean with a demo code. But dont forget. If you moving or turning the camera you have a other look position and teh space ccord are changing (you have a different "relative" space position).
P.S: If you have better source code of a camera lookat funktion, i can implement this in my engine
Greetings Michael
@N_Gnom the following lib works with PB 5.24 (x86) and PB 5.3.1 (x86)
http://www.flasharts.de/mpz/mp33_beta/d ... ibrary.zip
@Psychophanta
I dont think it is a bug. This is the solution of the mathematical calculation of the Camera lookat function. In this case the Pitch/Yaw of the camera is turning about 90 degrees. I show you what i mean with a demo code. But dont forget. If you moving or turning the camera you have a other look position and teh space ccord are changing (you have a different "relative" space position).
P.S: If you have better source code of a camera lookat funktion, i can implement this in my engine

Greetings Michael
Code: Select all
MP_Graphics3D(640,480,0,3)
camera=MP_CreateCamera()
MP_PositionEntity(camera,0,0,0)
Debug "Camera Pitch/Yaw/Roll"
Debug MP_EntityGetPitch(camera)
Debug MP_EntityGetYaw(camera)
Debug MP_EntityGetRoll(camera)
MP_EntityLookAt(camera,0,0,3) ; <- Un-remark this line to see what happens
Debug "Camera Pitch/Yaw/Roll after lookat"
Debug MP_EntityGetPitch(camera)
Debug MP_EntityGetYaw(camera)
Debug MP_EntityGetRoll(camera)
MP_TurnEntity(camera, -90, -90,0) ; Now you turn the camera back to 0, but the relative space coords are different too...
light=MP_CreateLight(1)
mesh=MP_CreateCube()
MP_PositionEntity(Mesh,0,0,3)
While MP_KeyUp(#PB_Key_Escape) And WindowEvent()<>#PB_Event_CloseWindow
If MP_KeyDown(#PB_Key_Right):MP_MoveEntity(camera,0.01,0,0)
ElseIf MP_KeyDown(#PB_Key_Left):MP_MoveEntity(camera,-0.01,0,0)
ElseIf MP_KeyDown(#PB_Key_Up):MP_MoveEntity(camera,0,0.01,0)
ElseIf MP_KeyDown(#PB_Key_Down):MP_MoveEntity(camera,0,-0.01,0)
ElseIf MP_KeyDown(#PB_Key_A):MP_MoveEntity(camera,0,0,0.01)
ElseIf MP_KeyDown(#PB_Key_Z):MP_MoveEntity(camera,0,0,-0.01)
EndIf
MP_RenderWorld()
MP_Flip()
Wend
Working on - MP3D Library - PB 5.73 version ready for download
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: MP3D Engine Alpha 32
Sorry, as anyone can see, a Camera that is pointing to any point in space, if no moved from its current position and if "pitched" 90 degrees up and "yawed" 90 degrees right, then there is not possible that that camera continues pointing to the same point.
Re: MP3D Engine Alpha 32
yes thats what i thought too.
forget to post....smile.
forget to post....smile.
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: MP3D Engine Alpha 32
Hi all!
Need a tip to build a cube with a different texture for each face (6 different textures in total).
I am not able to perform it using MP3D neither other engines.
Any help?
Need a tip to build a cube with a different texture for each face (6 different textures in total).
I am not able to perform it using MP3D neither other engines.

Any help?
Re: MP3D Engine Alpha 32
I´m not sure if mp3d can load .b3d with textures per surface.
What kind of 3d modeller app did you use?
AC3D or UU3d can do this.
And of course apps like 3ds max too.
In b3d surfaces are similar to groups in any kind of 3d app.
If you want you can send me the 6 textures and i make an .b3d cube with these textures.
But you have to test if mp3d can load this correctly.
What kind of 3d modeller app did you use?
AC3D or UU3d can do this.
And of course apps like 3ds max too.
In b3d surfaces are similar to groups in any kind of 3d app.
If you want you can send me the 6 textures and i make an .b3d cube with these textures.
But you have to test if mp3d can load this correctly.
Re: MP3D Engine Alpha 32
@Psychophanta
it is possible with opengl, i have used the plan used by JHPJHP in his example pb_gl_photo_cube.pb inside the "PureBasic Interface to OpenCV" which are announced here http://www.purebasic.fr/english/viewtop ... 70#p448121
the credit also to Shardik look his cube textured with one picture http://purebasic.fr/english/viewtopic.p ... 30#p446600 and the credit also to luis who published the first textured cube in the "Simple Windowed OpenGL Framework-for OpenGL beginners" http://www.purebasic.fr/english/viewtopic.php?t=28835
the following example needs BMP pictures numbered from 0 to 5 or adapt the code as necessary
the JHPJHP example works with jpg pictures.
you can download the code with the bmp pictures from here (click the bottom smaller button and not the big one)
http://www.2shared.com/file/b1pw7Clo/CubeGL.html
it is possible with opengl, i have used the plan used by JHPJHP in his example pb_gl_photo_cube.pb inside the "PureBasic Interface to OpenCV" which are announced here http://www.purebasic.fr/english/viewtop ... 70#p448121
the credit also to Shardik look his cube textured with one picture http://purebasic.fr/english/viewtopic.p ... 30#p446600 and the credit also to luis who published the first textured cube in the "Simple Windowed OpenGL Framework-for OpenGL beginners" http://www.purebasic.fr/english/viewtopic.php?t=28835
the following example needs BMP pictures numbered from 0 to 5 or adapt the code as necessary
the JHPJHP example works with jpg pictures.
you can download the code with the bmp pictures from here (click the bottom smaller button and not the big one)
http://www.2shared.com/file/b1pw7Clo/CubeGL.html

Code: Select all
UsePNGImageDecoder()
Define Direction.I
Define ImageSize.I
OpenWindow(0, 200, 100, 400, 320, "Multi Textured OpenGL Cube demo")
SetWindowColor(0, 0)
OpenGLGadget(0, 0, 0, WindowWidth(0) , WindowHeight(0))
For i=0 To 5
LoadImage(i, Str(i)+".bmp")
Next
Direction = -1
Dim *image(5)
Dim *imageHeader(5)
For i=0 To 5
If ReadFile(0, Str(i)+".bmp") = 0
MessageRequester("Error", "Loading of texture image failed!")
End
EndIf
*imageHeader(i) = AllocateMemory(54)
ReadData(0, *imageHeader(i), MemorySize(*imageHeader(i)))
ImageSize = PeekL(*imageHeader(i) + 34)
FreeMemory(*imageHeader(i))
*image(i) = AllocateMemory(ImageSize)
ReadData(0, *image(i), ImageSize)
Next
CloseFile(0)
Dim texturePTR(5)
glGenTextures_(6, @texturePTR())
For i = 0 To 5
glBindTexture_(#GL_TEXTURE_2D, texturePTR(i))
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MIN_FILTER, #GL_NEAREST)
glTexParameteri_(#GL_TEXTURE_2D, #GL_TEXTURE_MAG_FILTER, #GL_NEAREST)
;gluBuild2DMipmaps_(#GL_TEXTURE_2D, 3, 512, 512, #GL_BGR_EXT, #GL_UNSIGNED_BYTE, *image(i))
glTexImage2D_(#GL_TEXTURE_2D, 0, 3, ImageWidth(i), ImageHeight(i), 0, #GL_BGR_EXT, #GL_UNSIGNED_BYTE, *image(i))
FreeMemory(*image(i))
Next
;glMatrixMode_(#GL_PROJECTION)
gluPerspective_(30.0, Abs(WindowWidth(0) / WindowHeight(0)), 0.1, 500.0)
Repeat
xRotation.f + 1.5
yRotation.f - 2.5
zRotation.f + 3.5
glMatrixMode_(#GL_MODELVIEW)
glEnable_(#GL_CULL_FACE)
glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
glLoadIdentity_()
glTranslatef_(0, 0, -7.5)
glRotatef_(xRotation, 1, 0, 0)
glRotatef_(yRotation, 0, 1, 0)
glRotatef_(zRotation, 0, 0, 1)
glEnable_(#GL_TEXTURE_2D)
glBindTexture_(#GL_TEXTURE_2D, texturePTR(0))
glBegin_(#GL_QUADS)
glTexCoord2f_(1, 1) : glVertex3f_(1, 1, -1)
glTexCoord2f_(0, 1) : glVertex3f_(-1, 1, -1)
glTexCoord2f_(0, 0) : glVertex3f_(-1, 1, 1)
glTexCoord2f_(1, 0) : glVertex3f_(1, 1, 1)
glEnd_()
glBindTexture_(#GL_TEXTURE_2D, texturePTR(1))
glBegin_(#GL_QUADS)
glTexCoord2f_(1, 1) : glVertex3f_(-1, 1, 1)
glTexCoord2f_(0, 1) : glVertex3f_(-1, 1, -1)
glTexCoord2f_(0, 0) : glVertex3f_(-1, -1, -1)
glTexCoord2f_(1, 0) : glVertex3f_(-1, -1, 1)
glEnd_()
glBindTexture_(#GL_TEXTURE_2D, texturePTR(2))
glBegin_(#GL_QUADS)
glTexCoord2f_(1, 1) : glVertex3f_(1, 1, 1)
glTexCoord2f_(0, 1) : glVertex3f_(-1, 1, 1)
glTexCoord2f_(0, 0) : glVertex3f_(-1, -1, 1)
glTexCoord2f_(1, 0) : glVertex3f_(1, -1, 1)
glEnd_()
glBindTexture_(#GL_TEXTURE_2D, texturePTR(3))
glBegin_(#GL_QUADS)
glTexCoord2f_(1, 1) : glVertex3f_(-1, 1, -1)
glTexCoord2f_(0, 1) : glVertex3f_(1, 1, -1)
glTexCoord2f_(0, 0) : glVertex3f_(1, -1, -1)
glTexCoord2f_(1, 0) : glVertex3f_(-1, -1, -1)
glEnd_()
glBindTexture_(#GL_TEXTURE_2D, texturePTR(4))
glBegin_(#GL_QUADS)
glTexCoord2f_(1, 1) : glVertex3f_(1, 1, -1)
glTexCoord2f_(0, 1) : glVertex3f_(1, 1, 1)
glTexCoord2f_(0, 0) : glVertex3f_(1, -1, 1)
glTexCoord2f_(1, 0) : glVertex3f_(1, -1, -1)
glEnd_()
glBindTexture_(#GL_TEXTURE_2D, texturePTR(5))
glBegin_(#GL_QUADS)
glTexCoord2f_(1, 1) : glVertex3f_(1, -1, 1)
glTexCoord2f_(0, 1) : glVertex3f_(-1, -1, 1)
glTexCoord2f_(0, 0) : glVertex3f_(-1, -1, -1)
glTexCoord2f_(1, 0) : glVertex3f_(1, -1, -1)
glEnd_()
SetGadgetAttribute(0, #PB_OpenGL_FlipBuffers, #True)
Until WindowEvent() = #PB_Event_CloseWindow
glDeleteTextures_(6, @texturePTR())
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: MP3D Engine Alpha 32
Thanks for your answers.
@applepi, I didn't get it to work, sorry.
I got it to work with DM3D, again! Thanks anyway.
@applepi, I didn't get it to work, sorry.
I got it to work with DM3D, again! Thanks anyway.
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: MP3D Engine Alpha 32
Hi,
i am sorry but what is the problem ?!?
1) In the Demo MP_Texturkoordinaten_Änderung_6_Seiten.pb you have a cube with one image but 6 different sides

2) You can create a mesh with 6 image for every cube side and can load it in mp3d as directx file or b3d file
3) You can create every 6 side of a cube as two triangles and add to each side a image as surface. I dont have a demo now but it is possible, mp3d has functions for surfaces and can add triangles. I will make a little demo to show what i mean...
i am working on a new lib and the new lib has for example
MP_CreateCubeTexture(Size(,Miplevel)) -> Create empty six side cube texture
MP_CopyTexturetoCubeTexture (Texture,Texture2[,side]) -> copy a texture to all or one side of a cube textur
coming soon, i will make some tests an a working demo
Greetings Michael
i am sorry but what is the problem ?!?
1) In the Demo MP_Texturkoordinaten_Änderung_6_Seiten.pb you have a cube with one image but 6 different sides

2) You can create a mesh with 6 image for every cube side and can load it in mp3d as directx file or b3d file
3) You can create every 6 side of a cube as two triangles and add to each side a image as surface. I dont have a demo now but it is possible, mp3d has functions for surfaces and can add triangles. I will make a little demo to show what i mean...
i am working on a new lib and the new lib has for example
MP_CreateCubeTexture(Size(,Miplevel)) -> Create empty six side cube texture
MP_CopyTexturetoCubeTexture (Texture,Texture2[,side]) -> copy a texture to all or one side of a cube textur
coming soon, i will make some tests an a working demo
Greetings Michael
Working on - MP3D Library - PB 5.73 version ready for download
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Re: MP3D Engine Alpha 32
Many thanks MPZ, I already watched that elegant example which shows what i want to do, even i have to join several image-textures in une.
This example was useful to me, because i based my code on it.
The fact is that this project was started with a different 3D engine and there is hard to migrate all the code now...
This example was useful to me, because i based my code on it.

The fact is that this project was started with a different 3D engine and there is hard to migrate all the code now...