Forumchem - Forum with AI(ALICE BOT & HAL9000) and TTS

More dificult for us, more easy for you
It is currently Thu Mar 28, 2024 8:08 am

All times are UTC





Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 
Author Message
 Post subject: index buffer help
PostPosted: Thu Nov 07, 2013 11:26 pm 
Offline
User avatar

Joined: Fri Apr 03, 2009 1:31 am
Posts: 1357
This is where the index (element in OpenGL) buffer comes in.


The element buffer has numbers that index your vertices.


E.g. 0 would be the first vertex, 1 the second, and so on.


So with an element buffer, to form the triangles needed for the rectangle, we need to send these indices: [0, 1, 2, 0, 2, 3]. If you replace the numbers with the genuine vertices they index, you will see you get the original six vertices to form the triangles.


 


Indexing reduces memory and bandwidth (except for very uncommon worst case scenarios), which in turn help rendering speed.


 


Most file formats (to which you export from Blender, 3ds Max, etc.) support indexing, but there are two variants of indexing for file formats.


In modeling tools (and in fact, in your OpenGL code too!), a "vertex" isnt a position, its a combination of a position, a normal vector, a color, a texture coordinate, and so on.


Every one of these things is called a vertex attribute, and is only one part of the whole vertex.


OpenGL (and Direct3D) only allow 1D indexing, or in other words - you have one index that points to all the vertex attributes.


 


For example, if you have an array of vertex positions and another array of vertex normals, then index 0 would be the first position and the first normal.


 


This might seem definite, but some file formats dont actually store their data this way.


In most cases, a model doesnt actually need the same amount of positions, normals, and so on.


If there are many vertices that have the same normal, the file might store only one normal, and let them all share it.


You then have different indices for each vertex attribute, which you cant directly use for rendering.


In this case, you will have to "flatten" the arrays and fill them up with all the shared data.


 


This can be seen in the completely obsolete, bad format *.OBJ (its the most terrible format in existence, but for some justification its used everywhere).







Edited by Chananya Freiman, 12 July 2013 - 06:43 AM.















Source



Top
 Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: fukgolmuetoeg4 and 1 guest


 
Search for:
 
Jump to:  

cron
Click me:
Powered by phpBB © 2000, 2002, 2005, 2007, 2008, 2009 phpBB Group
Chronicles phpBB3 theme by Jakob Persson. Stone textures by Patty Herford.
With special thanks to RuneVillage

This site have 4 type of tecnology in order to convert text to speech. By default you use the vozme tecnology. In order to know the other you need to sign for.


- Privacy Policy -