Simple Vertex Buffer example

Problems building or running the engine, queries about how to use features etc.
Post Reply
kejzman
Gnoblar
Posts: 1
Joined: Sat Aug 02, 2008 5:18 pm

Simple Vertex Buffer example

Post by kejzman »

Hi... I'm new in OGRE.

How I can do this in OGRE in the simplest way ?

In OpenGL I do:

Init Vertex Buffer:

Code: Select all

glGenBuffersARB(1, &vertexBuffer);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertexData), vertexData, GL_STATIC_DRAW_ARB);
vertexData is array of my hex grid...

Draw:

Code: Select all

glEnableClientState(GL_VERTEX_ARRAY);
    
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexBuffer);   
glVertexPointer(2, GL_FLOAT, 0, 0);                                    
            	
for (int x = 0; x < MapSize*MapSize; x++)
{
    glBindTexture(GL_TEXTURE_2D, hextex[Hex[x].TexID]);

    glDrawArrays(GL_QUADS, x*4, 4);   
}  // Draw each hex with invidual texture... (interlaced quads)
        
glDisableClientState( GL_VERTEX_ARRAY ); 
In OpenGL it very simple... How do this same in OGRE ? A short example code would be nice.

Maybe is better way to render 40x40 map of hexes ?

Thanks
User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

Post by manowar »

Maybe you could try to use a ManualObject ?
User avatar
vitefalcon
Orc
Posts: 438
Joined: Tue Sep 18, 2007 5:28 pm
Location: Seattle, USA
x 13

Post by vitefalcon »

Try looking at this wiki article
Image
Post Reply