Forum

Doom 3 engine release and game code

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.

Moderator: InsideQC Admins

Re: Doom 3 engine release and game code

Postby revelator » Sat Nov 26, 2011 10:45 pm

hmm with all the different types and methods out there for doing the same thing without copying there part i wonder ... so the khronos group's own example for doing it might actually tread on copyrighted grounds :mrgreen:

had to do some guess work with your codepiece as the qglStencilOpSeparate seems to be an ATI extention i tried with standard two sided stencil but it needs some work.

Code: Select all
   
        if (external)
   {
      glDepthFunc (GL_LEQUAL);
      glEnable (GL_STENCIL_TEST_TWO_SIDE_EXT);

      // view outside the shadow volume
      qglActiveStencilFaceEXT(GL_BACK);
      qglStencilOp(GL_KEEP, tr.stencilIncr, tr.stencilIncr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_BACK_SIDED );

      qglActiveStencilFaceEXT(GL_FRONT);
      qglStencilOp(GL_KEEP, tr.stencilDecr, tr.stencilDecr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_FRONT_SIDED );

      RB_DrawShadowElementsWithCounters (tri, numIndexes);

      glDisable (GL_STENCIL_TEST_TWO_SIDE_EXT);
   }
   else
   {
      glDepthFunc (GL_GEQUAL);
      glEnable (GL_STENCIL_TEST_TWO_SIDE_EXT);

      // view inside the shadow volume
      qglActiveStencilFaceEXT(GL_BACK);
      qglStencilOp(GL_KEEP, tr.stencilDecr, tr.stencilDecr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_FRONT_SIDED );

      qglActiveStencilFaceEXT(GL_FRONT);
      qglStencilOp(GL_KEEP, tr.stencilIncr, tr.stencilIncr);
      qglStencilFunc(GL_ALWAYS, 0, ~0);

      // does the same as the GL_TwoSidedStencil functions part when checking for cull face.
      GL_Cull( CT_BACK_SIDED );

      RB_DrawShadowElementsWithCounters (tri, numIndexes);

      glDisable (GL_STENCIL_TEST_TWO_SIDE_EXT);
   }


its CT_TWO_SIDED when comming in here so face culling is off untill it hits this function.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby revelator » Sat Nov 26, 2011 10:47 pm

hehe that might come in handy :)
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby mh » Sun Nov 27, 2011 1:02 am

reckless wrote:qglStencilOpSeparate seems to be an ATI extention

Not if you've got OpenGL 2.0 or better, it's not even an extension in this case. You can just get the function pointer and use it.

Code: Select all
glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) GLimp_ExtensionPointer ("glStencilOpSeparate");

if (glStencilOpSeparate)
{
    // do stuff...
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Doom 3 engine release and game code

Postby revelator » Sun Nov 27, 2011 2:53 am

ok game crashes when using this atm which is imo weird since my card is opengl 4.1 capable :/ ill try again tomorrow.

the twosided version works but produces huge shadows (i think i need to turn of the last part of the old stencil code whoops).

ongoing work on widescreen formats and doing away with low res modes like 320x200 (heh ye its actually possible). lowest supported res will be 800x600 and upto the largest supported resolution today.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby leileilol » Sun Nov 27, 2011 4:15 am

I don't see the point of dropping low res. The FX5200 actually benefits alot from 320x240 in idtech4...
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Doom 3 engine release and game code

Postby r00k » Sun Nov 27, 2011 6:04 am

Damn AND i just gave my fx5200 to the garbage man to use as a wedge to get the dumpster door open! Grr....
that card sucks more arse than a liposuction machine!
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Re: Doom 3 engine release and game code

Postby leileilol » Sun Nov 27, 2011 7:04 am

Don't underestimate the large amount of self-entitled openBSD/freeBSD users that can't get a proper accelerated driver or even use modern video hardware
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Doom 3 engine release and game code

Postby Barnes » Sun Nov 27, 2011 10:18 am

mh wrote:Not if you've got OpenGL 2.0 or better, it's not even an extension in this case.


qglDisable(GL_CULL_FACE);

qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);

RB_DrawShadowElementsWithCounters (tri, numIndexes);

qglEnable(GL_CULL_FACE);
User avatar
Barnes
 
Posts: 226
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow

Re: Doom 3 engine release and game code

Postby goldenboy » Sun Nov 27, 2011 11:33 am

There are downsides to ripping out stuff that was originally there for a reason.

For example the built-in editor's functionality is much better than standard Radiant. Anyone who makes Doom3 maps is going to use that editor. To be clear, GTK/Netradiant do NOT make the built in editor obsolete. If you rip it out, perhaps consider releasing a standalone Doom3 editor?

And why should people not run Doom3 in 640x480 windowed?
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: Doom 3 engine release and game code

Postby mh » Sun Nov 27, 2011 12:21 pm

Barnes wrote:
mh wrote:Not if you've got OpenGL 2.0 or better, it's not even an extension in this case.


qglDisable(GL_CULL_FACE);

qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);

RB_DrawShadowElementsWithCounters (tri, numIndexes);

qglEnable(GL_CULL_FACE);

That's the one. :D

The original used standard depth pass for cases where the view wasn't inside the volume (so that it could skip drawing the caps) so you need a test for that too, and you also need to flip the front and back faces if it's a mirror view.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Doom 3 engine release and game code

Postby Barnes » Sun Nov 27, 2011 12:32 pm

a schematic representation of the z-fail volumes (with caps) :)
z-pass (w/o caps) if i current remember

qglStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
qglStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT);
User avatar
Barnes
 
Posts: 226
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow

Re: Doom 3 engine release and game code

Postby New Horizon » Sun Nov 27, 2011 1:03 pm

goldenboy wrote:There are downsides to ripping out stuff that was originally there for a reason.

For example the built-in editor's functionality is much better than standard Radiant. Anyone who makes Doom3 maps is going to use that editor. To be clear, GTK/Netradiant do NOT make the built in editor obsolete. If you rip it out, perhaps consider releasing a standalone Doom3 editor?

And why should people not run Doom3 in 640x480 windowed?


I know quite a few mappers have used our Dark Radiant to build D3 maps rather than D3Edit, but then again Dark Radiant has been heavily rewritten compared to what it was when we started working with the old GTK Radiant source code. It's a completely different beast now.
New Horizon
 
Posts: 6
Joined: Sat Nov 26, 2011 3:24 am

Re: Doom 3 engine release and game code

Postby revelator » Sun Nov 27, 2011 2:39 pm

Code: Select all
   if (external)
   {
      qglDepthFunc (GL_LEQUAL);

      // view outside the shadow volume
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, GL_KEEP, tr.stencilIncr);
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, GL_KEEP, tr.stencilDecr);

      RB_DrawShadowElementsWithCounters (tri, numIndexes);
   }
   else
   {
      qglDepthFunc (GL_GEQUAL);

      // view inside the shadow volume
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_FRONT : GL_BACK, GL_KEEP, GL_KEEP, tr.stencilDecr);
      qglStencilOpSeparate (backEnd.viewDef->isMirror ? GL_BACK : GL_FRONT, GL_KEEP, GL_KEEP, tr.stencilIncr);

      RB_DrawShadowElementsWithCounters (tri, numIndexes);
   }


was the latest i tried before going to bed.

in regards to ripping out low res modes i could easily leave them in but i doubted anyone with recent hardware would see them as anything but an annoyance if thats not the case ill just leave them and then addd high res modes.
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Doom 3 engine release and game code

Postby toneddu2000 » Sun Nov 27, 2011 7:01 pm

Is already possible to compile doom3 under Linux? And if yes, how? Little tutorial for newbiez? t*h*a*n*k*s! :)
Meadow Fun!! - my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1352
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Doom 3 engine release and game code

Postby mh » Sun Nov 27, 2011 7:48 pm

Instructions are in the Readme. I can't say any more as I don't use Linux.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

PreviousNext

Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest