ubi44
New Member
Posts: 32
|
Post by ubi44 on Mar 1, 2024 11:28:06 GMT
First try: Real 3D texture with triangles, Pros: 1 single texture, Cons: low framerate trianglec2.bas (25.54 KB) Second try: 3D Texture Quad, Pros: 1Only Texture, Cons: Framerate and Warp! cubes3D4.bas (15.72 KB) Third Try: _maptriangle 3D, Pros: High Framerate, Cons: Texture update every frame trianglecMaptriangle.bas (29.31 KB) (Line 117): Why one 3D _maptriangle over another 3D _maptriangle Doesn't Work!!
|
|
|
Post by bplus on Mar 1, 2024 11:38:07 GMT
ubi44 I am guessing you know allot more about _GL... stuff than I. Did you learn just by playing around and checking Wiki allot or some other way?
|
|
ubi44
New Member
Posts: 32
|
Post by ubi44 on Mar 1, 2024 12:15:53 GMT
I'm just learning by playing with the instructions, but I didn't understand the wiki with the addition of sub _GL! I have to understand because we can make shadows etc... But for an animated texture my work with _maptriangle and without sub _GL is good 4800fps on core i9 10900k!
|
|
Aaditya Parashar
Junior Member
Just somebody with an abnormal coding routine.
Posts: 95
|
Post by Aaditya Parashar on Mar 1, 2024 12:47:14 GMT
Fourth Try Btw if u want to see _MapTraingle Mycraft by GalleonScreen _NewImage(640, 480, 32)
TEXTUREFILE$ = Command$(1) If TEXTUREFILE$ = "" Then Print "No Texture Supplied": Print "Drop Texture On Exe File": End
Dim Shared As Single Vertices(1 To 3, 1 To 24), TexCoords(1 To 2, 1 To 24) For I = 1 To 24 Read Vertices(1, I), Vertices(2, I), Vertices(3, I), TexCoords(1, I), TexCoords(2, I) Next I
_GLRender _Only allowGL = -1
Do _Limit 1 'No effect on GL Loop Until Inp(&H60) = 1 System
'+X Data 1,1,1,0,0: Data 1,1,0,1,0: Data 1,0,0,1,1: Data 1,0,1,0,1 '-X Data 0,0,0,0,1: Data 0,1,0,0,0: Data 0,1,1,1,0: Data 0,0,1,1,1 '+Y Data 0,1,0,0,0: Data 1,1,0,1,0: Data 1,1,1,1,1: Data 0,1,1,0,1 '-Y Data 0,0,0,0,0: Data 1,0,0,1,0: Data 1,0,1,1,1: Data 0,0,1,0,1 '+Z Data 0,0,1,0,1: Data 1,0,1,1,1: Data 1,1,1,1,0: Data 0,1,1,0,0 '-Z Data 0,0,0,0,1: Data 1,0,0,1,1: Data 1,1,0,1,0: Data 0,1,0,0,0
Sub _GL Shared allowGL As _Bit Static FirstRun As _Bit Static angle As Integer Static aspectRatio As Single If FirstRun = 0 Then FirstRun = -1 aspectRatio = _Width / _Height Dim m As _MEM Shared TEXTUREFILE$ IMAGE& = _LoadImage(TEXTUREFILE$, 32) Static As Long TEXTURE _glGenTextures 1, _Offset(TEXTURE): _glBindTexture _GL_TEXTURE_2D, TEXTURE m = _MemImage(IMAGE&) _glTexImage2D _GL_TEXTURE_2D, 0, _GL_RGBA, _Width(IMAGE&), _Height(IMAGE&), 0, _GL_BGRA_EXT, _GL_UNSIGNED_BYTE, m.OFFSET _MemFree m: _FreeImage IMAGE& _glTexParameteri _GL_TEXTURE_2D, _GL_TEXTURE_MIN_FILTER, _GL_LINEAR _glTexParameteri _GL_TEXTURE_2D, _GL_TEXTURE_MAG_FILTER, _GL_NEAREST _glBlendFunc _GL_SRC_ALPHA, _GL_ONE_MINUS_SRC_ALPHA End If _glViewport 0, 0, _Width - 1, _Height - 1
_glClear _GL_DEPTH_BUFFER_BIT
angle = (angle Mod 360) + 1
_glEnable _GL_BLEND _glEnable _GL_DEPTH_TEST
_glTranslatef 0, 0, -3 _glRotatef -angle, 1, 0, 0: _glRotatef angle, 0, 1, 0: _glRotatef angle / 2, 0, 0, 1
_glMatrixMode _GL_PROJECTION _glLoadIdentity
_gluPerspective 90, aspectRatio, 0.1, 64
_glMatrixMode _GL_MODELVIEW
_glEnable _GL_TEXTURE_2D _glBindTexture _GL_TEXTURE_2D, TEXTURE _glEnableClientState _GL_VERTEX_ARRAY _glEnableClientState _GL_TEXTURE_COORD_ARRAY _glVertexPointer 3, _GL_FLOAT, 0, _Offset(Vertices()) _glTexCoordPointer 2, _GL_FLOAT, 0, _Offset(TexCoords()) _glDrawArrays _GL_QUADS, 0, 24 _glDisableClientState _GL_VERTEX_ARRAY _glDisableClientState _GL_TEXTURE_COORD_ARRAY _glDisable _GL_TEXTURE_2D _glDisable _GL_DEPTH_TEST _glDisable _GL_BLEND _glFlush _Display End Sub Just wanted to be active in forums. Pros: High Framerate, Cons: Only 60 FPS
|
|
ubi44
New Member
Posts: 32
|
Post by ubi44 on Mar 1, 2024 18:39:51 GMT
my work doesn't use sub GL and I find that maptriangle is sufficient even if I have to redraw the texture every frame.
My question is whether multiple 3d _maptriangle can overlap.. in my example with -maptriangle the 2D overlaps with the 3D but not the 3D on 3D... Otherwise with certainty, I can't compete with Galleon
|
|
Aaditya Parashar
Junior Member
Just somebody with an abnormal coding routine.
Posts: 95
|
Post by Aaditya Parashar on Mar 2, 2024 4:35:11 GMT
I don't think _MapTriangle 3D can overlap, because we have to place them 0.1 units away, which can just be viewed from the side though. So it won't be a good idea. The other thing you can do is overlap the textures first, and then use _MapTriangle 3D, this way it will draw only one overlapped triangle. There are no other ways I can think of overlapping. If you wanna see how I used _MapTriangle, maybe you could get what you need, just head on to the drawcube sub: 230726.zip (5.67 KB) I made this as a minecraft clone a while ago when I used _MapTriangle 3D, but it just drops framerate.
|
|