1 | <HTML> |
---|
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
3 | <!-- Created on , 12 2006 by texi2html 1.64 --> |
---|
4 | <!-- |
---|
5 | Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) |
---|
6 | Karl Berry <karl@freefriends.org> |
---|
7 | Olaf Bachmann <obachman@mathematik.uni-kl.de> |
---|
8 | and many others. |
---|
9 | Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de> |
---|
10 | Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> |
---|
11 | |
---|
12 | --> |
---|
13 | <HEAD> |
---|
14 | <TITLE>OGRE Manual v1.2.0 ('Dagon'): The IndexData class</TITLE> |
---|
15 | |
---|
16 | <META NAME="description" CONTENT="OGRE Manual v1.2.0 ('Dagon'): The IndexData class"> |
---|
17 | <META NAME="keywords" CONTENT="OGRE Manual v1.2.0 ('Dagon'): The IndexData class"> |
---|
18 | <META NAME="resource-type" CONTENT="document"> |
---|
19 | <META NAME="distribution" CONTENT="global"> |
---|
20 | <META NAME="Generator" CONTENT="texi2html 1.64"> |
---|
21 | <LINK TYPE="text/css" rel="stylesheet" href="../style.css"> |
---|
22 | </HEAD> |
---|
23 | |
---|
24 | <BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> |
---|
25 | |
---|
26 | <A NAME="SEC246"></A> |
---|
27 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
28 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_52.html#SEC245"> < </A>]</TD> |
---|
29 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_52.html#SEC245"> Up </A>]</TD> |
---|
30 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_54.html#SEC248"> > </A>]</TD> |
---|
31 | <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD> |
---|
32 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
33 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
34 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD> |
---|
35 | </TR></TABLE> |
---|
36 | <HR SIZE=1> |
---|
37 | <H3> 5.7.1 The IndexData class </H3> |
---|
38 | <!--docid::SEC246::--> |
---|
39 | This class summarises the information required to use a set of indexes to render geometry. It's members are as follows: |
---|
40 | <DL COMPACT> |
---|
41 | <DT>indexStart |
---|
42 | <DD>The first index used by this piece of geometry; this can be useful for sharing a single index buffer among several geometry pieces. |
---|
43 | <DT>indexCount |
---|
44 | <DD>The number of indexes used by this particular renderable. |
---|
45 | <DT>indexBuffer |
---|
46 | <DD>The index buffer which is used to source the indexes. |
---|
47 | </DL> |
---|
48 | <P> |
---|
49 | |
---|
50 | <A NAME="SEC247"></A> |
---|
51 | <H3> Creating an Index Buffer </H3> |
---|
52 | <!--docid::SEC247::--> |
---|
53 | Index buffers are created using See section <A HREF="manual_42.html#SEC231">5.1 The Hardware Buffer Manager</A> just like vertex buffers, here's how: |
---|
54 | <TABLE><tr><td> </td><td class=example><pre>HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton(). |
---|
55 | createIndexBuffer( |
---|
56 | HardwareIndexBuffer::IT_16BIT, // type of index |
---|
57 | numIndexes, // number of indexes |
---|
58 | HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage |
---|
59 | false); // no shadow buffer |
---|
60 | </pre></td></tr></table>Once again, notice that the return type is a class rather than a pointer; this is reference counted so that the buffer is automatically destroyed when no more references are made to it. The parameters to the index buffer creation are: |
---|
61 | <DL COMPACT> |
---|
62 | <DT>indexType |
---|
63 | <DD>There are 2 types of index; 16-bit and 32-bit. They both perform the same way, except that the latter can address larger vertex buffers. If your buffer includes more than 65526 vertices, then you will need to use 32-bit indexes. Note that you should only use 32-bit indexes when you need to, since they incur more overhead than 16-bit vertices, and are not supported on some older hardware. |
---|
64 | <DT>numIndexes |
---|
65 | <DD>The number of indexes in the buffer. As with vertex buffers, you should consider whether you can use a shared index buffer which is used by multiple pieces of geometry, since there can be performance advantages to switching index buffers less often. |
---|
66 | <DT>usage |
---|
67 | <DD>This tells the system how you intend to use the buffer. See section <A HREF="manual_43.html#SEC232">5.2 Buffer Usage</A> |
---|
68 | <DT>useShadowBuffer |
---|
69 | <DD>Tells the system whether you want this buffer backed by a system-memory copy. See section <A HREF="manual_44.html#SEC233">5.3 Shadow Buffers</A> |
---|
70 | </DL> |
---|
71 | <P> |
---|
72 | |
---|
73 | <A NAME="Updating Index Buffers"></A> |
---|
74 | <HR SIZE=1> |
---|
75 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
76 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_52.html#SEC245"> < </A>]</TD> |
---|
77 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_52.html#SEC245"> Up </A>]</TD> |
---|
78 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_54.html#SEC248"> > </A>]</TD> |
---|
79 | <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD> |
---|
80 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
81 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
82 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD> |
---|
83 | </TR></TABLE> |
---|
84 | <BR> |
---|
85 | <FONT SIZE="-1"> |
---|
86 | This document was generated |
---|
87 | by <I>Steve Streeting</I> on <I>, 12 2006</I> |
---|
88 | using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html |
---|
89 | "><I>texi2html</I></A> |
---|
90 | |
---|
91 | </BODY> |
---|
92 | </HTML> |
---|