English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. General (http://eab.abime.net/forumdisplay.php?f=37)
-   -   WarpOS MiniGL blues. (http://eab.abime.net/showthread.php?t=71663)

Cowcat 03 December 2013 12:54

WarpOS MiniGL blues.
 
Hello fellow coders:

I've been playing with the old Minigl static lib for months, trying to compile programs like BlitzQuake-GL or whatever GL code related for that Warpos lib. Reading old threads, gl-BQuake on Warpos leads to a crash in some systems (seems to be no problems with Mediator + Voodoo gfx, only on BVision ones). The same happens with vertex array demos from the library. No problem at all with 68k lib.
Depending on the code, you get a full hang or a "memory protection violation - Access 000000CE" exception.
So I tested some Warp3D code and found that if you use a classic function like :

Code:

void DrawThings(vertex  *P,W3D_Texture *tex)
{
void *VertexPointer;
void *TexCoordPointer;
void *ColorPointer;
UWORD stride=sizeof(vertex);
UWORD off_v,off_w;

        VertexPointer=        (void *)&(P->x);
        TexCoordPointer=(void *)&(P->u);
        ColorPointer=        (void *)&(P->RGBA);
        off_v=(UWORD)( (ULONG)&(P->v) - (ULONG)&(P->u));
        off_w=(UWORD)( (ULONG)&(P->w) - (ULONG)&(P->u));
        W3D_VertexPointer(context,VertexPointer,stride,W3D_VERTEX_F_F_F, 0);
        W3D_TexCoordPointer(context,TexCoordPointer,stride,0,off_v,off_w,W3D_TEXCOORD_NORMALIZED);
        W3D_ColorPointer(context,ColorPointer,stride,W3D_COLOR_UBYTE ,W3D_CMODE_RGBA,0);

        W3D_LockHardware(context);               
                W3D_BindTexture(context,0,tex);
                W3D_DrawArray(context,W3D_PRIMITIVE_TRISTRIP,0,4);
        W3D_UnLockHardware(context);
               
}

and if you call it with a NULL parameter instead of a texture pointer (tex), you hang the system. No problem if it is 68k code.
Documentation says that you can "unbind" a texture with W3D_BindTexture(context,0,NULL).

Of course, you can bridge the code checking if a NULL is given to "tex", or do another function for drawing something without textures.

MiniGL lib has nothing like W3D_BindTexture, it changes the "context" of Warp3D directly (if I understand what I read on it). Still the code checks for those NULL parameters, but....

:banghead

Related to that, all code made works on.....Morphos 1.4 powerup :crazy (the old trick to copy all W3D libraries) :D (a better check for unaligned data?)

Any ideas ? Somebody fixed that ? ( proper envs: for W3D?, its W3DPPC.library or W3D_PermediaPPC.library ?, ugly MiniGL ?).

Cheers.

Cowcat 29 December 2013 20:44

UPDATE:

Found the weird thing: In MGLInitContext from context.c , context->w3dContext->TPFlags[0] = W3D_TEXCOORD_NORMALIZED, is what crashed the system. Someway to fix this is giving a "0" value and then on vertexarray.c & vertexelements.c proceed like this:

Code:

vertexarray.c   

at  GLDrawArrays

if(context->Texture2D_State[0] == GL_TRUE)
  {
      Set_W3D_Texture(context->w3dContext, 0, context->w3dTexBuffer[context->CurrentBinding]);
  }
  else
  {
      Set_W3D_Texture(context->w3dContext, 0, NULL);
  }

fix:

if(context->Texture2D_State[0] == GL_TRUE)
  {
      Set_W3D_Texture(context->w3dContext, 0, context->w3dTexBuffer[context->CurrentBinding]);
      context->w3dContext->TPFlags[0] = W3D_TEXCOORD_NORMALIZED;
  }
  else
  {
      Set_W3D_Texture(context->w3dContext, 0, NULL);
      context->w3dContext->TPFlags[0] = 0;
 
  }

same goes for vertexelements.c.

Now all demos like varray.c, etc, work.

But For BlitzQuake it didn't work :laughing


Anyway: I fixed BlitzQuakeWOS :crazy (I was wrong, it wasn't minigl). Recompiled a new version with added code from other quake amiga sources. For those who never could run the original I will post the "updated" version if it is requested.

Happy New Year :xmas

DDNI 29 December 2013 23:08

Excellent. Great to read about more people continuing to work on these things. Thanks and happy new year!

Bamiga2002 29 December 2013 23:15

Please post it! :)
Is there any speed gained using MorphOS 1.4 PUP vs. basic WB 3.9?

Cowcat 29 December 2013 23:35

Thanks mates. On MorphOS 1.4 it gets 2 more frames :spin In fact BlitzQuake Wos original you get one + (3) (its a gcc compiled version, mine is vbcc but the sound it's better)

I used the original Blitz source and used Quake AGA/CGX sources for better sound & tweeks (really a "copy paste" + nightmares i'm not a coder :crazy )

Bamiga2002 30 December 2013 08:42

I'll give it a run :).
Btw. where to get MOS 1.4 PUP? I'd like to try it out.

Cowcat 30 December 2013 09:29

Here: http://powerup.morphos-team.net/ It's a little tricky to work: Basically you make a sfs partition, copy the whole cd in it and edit the boot script. But it is a little tricky to get to run: You need to mod the startup-sequence file in other way than its written. I'll post my own.

Bamiga2002 30 December 2013 11:41

Aah feck! That's why I gave up earlier on this: I don't have a G-Rex, but a Mediator... :banghead

Bamiga2002 30 December 2013 21:36

I tested with my setup (Mediator+Voodoo3) powered with my FullWin-patch running 2 times each exe on "timedemo demo1" and results are:

blitz: 37.7 fps
vbcc: 34.0 fps
vbcc2: 36.8 fps

vbcc2-version gained speed nicely over vbcc-version but lost a little to original blitz-version.

But the main thing is that this works for those that never got it working right? :)

Cowcat 30 December 2013 23:53

To me is like going to Mars (more than 30 fps? :bowdown). I'm on the lower budget = blizzppc 175mhz + bvision (half busted)...:guru

Thanks for testing !!

Bamiga2002 31 December 2013 12:10

Stachu made it happen! Over 2x the mhz of your ppc lol :p ok enough bragging :D
What's wrong with your BVision?
Great to see someone is interested in improving a classic ppc game.

Cowcat 31 December 2013 12:54

I have to try FullWin-Patch. On this subject, I can (most than probably :agree ) mod the code to clear the mouse pointer and remove window border + gadgets. Don't know if I can save CPU cycles, but I would add that as an option . Plus try to gain more optimizations.


Oks, "my bvision": Since I bought it more than a decade ago, I never could play W3D apps on full screen: Major texture problems and funny colors. Probably a low voltage or heat related.
That's why I need to add "the new option" :))

Bamiga2002 07 January 2014 05:55

Maybe you need to adjust the screenmodes, it's made for mediator but maybe create a 15-bit and a 16-bit screenmode and switch between them.
Let me know when you try or have any results :)

Cowcat 07 January 2014 20:04

Unlikely a problem with screenmodes. Switching to a lower resolution WB as FullWin does,aliviates a little, but the problem starts to appear later. The bigger the WorkBench the sooner you start to see "things". It's not only with W3D, it happens when you have diropus in one screen and some text program behind it. I'll post more of those problems on Blizzard PPC Club. :guru

Michael 22 February 2014 17:30

Very nice, finally got this GLQuake brunch working on my BVisionPPC, works perfectly and fast. 20-30 fps in 512x384 mode.

Cowcat 22 February 2014 18:34

Perfect mate. Got the last build (number 4)? Wait for the "5th" update: Made some work on old bugs that crippled all glquakes, more optimizations and kind help & code from MattHey. We try to make the most robust Quake & faster than old gcc one (both for 68k & WOS).

Michael 22 February 2014 18:44

Bummer, I am viewing the wrong thread! Moving to the other one with updates ;-)


All times are GMT +2. The time now is 10:25.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.05450 seconds with 11 queries