Motherboard Forums

Thread Tools Display Modes

arrays of floats or array of structures for opengl ?

Skybuck Flying
Posts: n/a
      10-01-2009, 09:58 AM

I am "researching" vertex buffer objects...

I am wondering how to combine positions with texture coordinates.

It seems there are two possibilities:

array of position;
array of texture_coordinate;


array of structure;

Which this document shows:

The opengl doc mentions "stride".

Confusion would be with the possibility of memory being in system memory or
video memory... the programmer don't know...

Maybe the graphic cards has an internal format for verteces ? Does it use
arrays or does it use structures ?

In other words:

What would be the best memory layout for performance ?

Strides would add gaps... so I am thinking... maybe array of floats is
better ?!?

This is one of those things that must be decided upon perform starting to
code a lot of stuff... because it would require significant code changes in
the future if one has to switch.

For now I am still in experimenting phase

Though even for me doing a benchmark would require extra programming time ?!


Reply With Quote
Skybuck Flying
Posts: n/a
      10-01-2009, 10:23 AM
This document is nice:

It mentions something interesting:

"Depth testing is expensive..."

I am not sure if this includes verteces going out of view or so... in 2d

Maybe depth testing is not required to make verteces go out of view by the z
value as I was planning to do...

Actually this is probably not an issue at all anymore... since each verteces
will be determined after each round or so ?!

But not completely sure.

So interesting read anyway.


Reply With Quote
Skybuck Flying
Posts: n/a
      10-01-2009, 10:39 AM
This sux:

Once again, for certain architectures, this may be the best format for
specifying geometry. The only way
to know is to conduct a benchmark case

Would be nice if opengl/drivers had some hints for the programmer for a
change !


Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Structures with variable length array known at compile time aravind Embedded 4 09-16-2008 02:29 AM
inizializing static const structures Mastupristi Embedded 12 01-26-2005 08:05 PM
Alignment errors when using floats and/or doubles Embedded 1 01-24-2005 03:10 PM
Unions and Structures Seeps Embedded 12 01-09-2004 08:04 PM
Re: State Machine Design - Menu structures Kenneth Seefried Embedded 0 06-24-2003 02:43 AM

All times are GMT. The time now is 10:04 PM.

Welcome to Motherboard Point