Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Surface properties & batching  (Read 637 times)
0 Members and 1 Guest are viewing this topic.
Online Orangy Tang

JGO Kernel
*****

Posts: 2960
Medals: 37


Monkey for a head


« on: 2003-11-22 08:29:34 »

I've been managing without any textures and such, but now i'd like to add them. My main problem is how to batch them up correctly without too many problems.

I've got a Shader object associated with every drawable chuck. For now this only contains a texture to use, I'm going to assume that it'll need at least:
2 textures to use, maybe some texture combine mode.
Alpha test on/off, test mode, test value.
Transparency on/off and maybe a blending mode.

Now for rendering at the moment I fill a single big vertex buffer with all objects in view, and an asssociated index buffer. I then use this to render the entire visible scene once per light (via vertex arrays).

However if i have multiple surface settings, this needs to be broken down somewhat. Obviously I need a draw call for each shader, which means i need a unique index buffer for each. And i need to group my shaders together (probably get away with only sorting by textures and transparency). Whats the best way of doing this? Can I perhaps abuse a hash map or tree map for doing this for me?

Any suggestions appreciated Smiley

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.091 seconds with 20 queries.