PDA

View Full Version : Some questions, not newbies ones i think...



TheDD
06-22-2001, 03:19 PM
Well, i would like to create a game. The first thing i'm gonna do is to code the renderer (in OpenGL of course). So i'm asking some question before starting to code something.

My objectif is to code in the same way as Quake 3. Why? Because John Carmack is a god to me. So i already know that my main function is gonna be glDrawElements(...). BUT i don't know very much about shaders.

* There are shaders in Q3, but are they the same as pixel shader/vertex shader? Are shaders some kind of graphic assembler?

* It seems to me that locking VA don't accelerate rendering, am i wrong?

* What is the RANGE extension about?

* This is not an ogl question but does anybody have some sources about rigid corpses collisions?

Well, that's all for now. This is not well written but i'm not english so please be cool.

Thanks
TheDD

ffish
06-22-2001, 05:55 PM
(i) Don't know much about Q3, but the DirectX vertex/pixel shaders have equivalent functionality to the nVidia vertex programs, texture shaders and register combiners. If you use these extensions, be aware that not only are they nVidia specific, but GeForce3 specific (in hardware) == no portability. These wouldn't be the shaders used in Q3 since it came out well before GeForce3.

(ii) CVA's may or may not accelerate rendering according to the driver implementation although it's a safe bet they do. CVA's guarantee to the driver that you won't be changing the data in the arrays while they are locked so the driver can perform certain optimisations on them.

(iii) Do you mean vertex array range (VAR)? It's another method of improving vertex array performance, also nVidia specific on GeForce hardware. It should offer performance benefits over CVA's under most circumstances.

(iv) Not me.

Lastly, I'd advise you not to code in a certain way just because someone else did unless you know _why_ they did it and you can see it's the best method for you. It's true JC is a great programmer (duh!) and does really good things for OpenGL and hardware in general, but what was good for him might not be good for you. For example, if you have a lot of static geometry in your scenes, it might be best to render it in a display list. Look into different rendering methods and do some benchmarking before you decide what is right for you. Also, if you want to create a portable game, beware of proprietary extensions. I use them all the time and love them, but I don't need to ensure portability for my purposes.

Hope that helps.

DFrey
06-22-2001, 08:21 PM
To just clarify the answer to your first question, Quake3's shaders are in no way related to vertex shaders or pixel shaders. However that being said, Quake3's shaders do encompass to a limited extent some attributes of vertex shaders. But Q3 does not itself use vertex shaders. It only uses the shaders to formulate multipass and/or multitexture methods for drawing surfaces of varying types. And goes beyond vertex shaders by assigning game attributes to surfaces and volumes.

TheDD
06-24-2001, 08:22 AM
Ok, thanks guys but:

* "but the DirectX vertex/pixel shaders have equivalent functionality to the nVidia vertex programs, texture shaders and register combiners" is a little short for my brain, could you explain a little more about those please?

* Display list are better for static geometry (ffish)? For a map, geometry is static but you don't render all. You select with bsp/pvs, octree, ... So display lists can't be used, no?

* Thanks for tricks on portability (range...).

* Anyone for rigid corpses collsion source code ? uh? ... 8-(

TheDD

ffish
06-24-2001, 05:00 PM
Vertex and pixel shaders are a DirectX 8 feature. Those words don't exists in OpenGL. You get all the same effects and more under OpenGL using vertex programs and texture shaders and register combiners. Look up the specifications and the various presentations explaining how they work on nVidia's developer site. The presentations have some good examples of what can be achieved using the various extensions.

Regarding display lists, if you are using an octree you could have each node of the octree as a display list so you could only call the lists you need. Again, it's something for you to look into. There is no one method that is always the best.

One more thing to think about regarding vertex arrays or triangle strips or any type of multiple polygon code is that it is probably going to be faster to sort by texture and other polygon attributes to minimise your calls to glBindTexture and minimise state changes. Some people on this board have so many texture and state changes that they find it just as fast if not faster to use plain old GL_TRIANGLES.

Hope that helps.