[android-developers] Re: Static vs Dynamic vertex buffers?

2012-08-23 Thread Braindrool

>
> Just a side note that the .obj decoder obviously isn't complete. Just 
> waiting for an answer first. Thought I'd point out the obvious.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Static vs Dynamic vertex buffers?

2012-08-24 Thread Steven Jackson
You should use a static buffer if you will not be updating the 
vertex/attribute values and a dynamic buffer if you will be updating them. 
I'm not sure how your model loader is giving you back data, but you should 
get a handle for the vbo back when you create the buffer.

On Wednesday, August 22, 2012 9:20:54 PM UTC-5, Braindrool wrote:
>
> I'm fairly new to OpenGL in general, and I was wondering how one might 
> correctly use the vertex / index / color buffer. I created a simple .obj 
> model decoder, but then another problem is here.
>
> Problem #1: Model can not be found.
>
> Problem #2: If I load all models into the vertex buffer, how would I 
> correctly get the offset? Or would that be where dynamic comes in?
>
> The location of the models folder / file:
>
> 
>
>
> Code:
>
> package com.braindrool.aftermath;
>>
>>
>>> import java.io.BufferedReader;
>>
>> import java.io.FileNotFoundException;
>>
>> import java.io.FileReader;
>>
>> import java.io.IOException;
>>
>> import java.util.Scanner;
>>
>>
>>> public class ModelLoader {
>>
>>
>>> float[] vertices = null;
>>
>> short[] indices = null;
>>
>>
>>> void loadModel(String name) {
>>
>>
>>> int i = 0;
>>
>>
>>> System.out.println("Loading model " + name);
>>
>>
>>> try {
>>
>>
>>> Scanner scanner = new Scanner(new BufferedReader(new FileReader(
>>
>> "models/" + name)));
>>
>>  while (scanner.hasNext()) {
>>
>> System.out.println(scanner.next());
>>
>> }
>>
>>
>>> if (!scanner.hasNext()) {
>>
>> System.out.println("Done!");
>>
>> scanner.close();
>>
>> }
>>
>>
>>> } catch (FileNotFoundException e) {
>>
>> System.out.println("Model not found");
>>
>> } catch (IOException e) {
>>
>> System.out.println("ModelLoader IO Exception");
>>
>> }
>>
>>
>>> }
>>
>> }
>>
>>  
> ~Braindrool
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Static vs Dynamic vertex buffers?

2012-08-24 Thread Fabien R
On 23/08/2012 23:32, Braindrool wrote:
>   
>> Just a side note that the .obj decoder obviously isn't complete. Just 
>> waiting for an answer first. Thought I'd point out the obvious.
>>
>> 
>   
You may have a look at min3d to see how the OBJ decoding is performed.
-
Fabien

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Static vs Dynamic vertex buffers?

2012-08-24 Thread Braindrool
Eh, I believe I know what I'm doing. I've been programming for years. But I 
have very little experience with 3D and OpenGL in general.

On Friday, August 24, 2012 2:46:20 AM UTC-5, Fabien R wrote:
>
> On 23/08/2012 23:32, Braindrool wrote: 
> >   
> >> Just a side note that the .obj decoder obviously isn't complete. Just 
> >> waiting for an answer first. Thought I'd point out the obvious. 
> >> 
> >> 
> >   
> You may have a look at min3d to see how the OBJ decoding is performed. 
> - 
> Fabien 
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Static vs Dynamic vertex buffers?

2012-08-24 Thread Braindrool

>
> Eh, I believe I know what I'm doing. I've been programming for years. But 
> I have very little experience with 3D and OpenGL in general.
>

And a question still remains. How would I get the correct offset for the 
buffers? I've read plenty of tutorials on how to use the buffer, but they 
only use 1 object. Would I just have to record how many bytes it puts in?

>
> On Friday, August 24, 2012 2:46:20 AM UTC-5, Fabien R wrote:
>>
>> On 23/08/2012 23:32, Braindrool wrote: 
>> >   
>> >> Just a side note that the .obj decoder obviously isn't complete. Just 
>> >> waiting for an answer first. Thought I'd point out the obvious. 
>> >> 
>> >> 
>> >   
>> You may have a look at min3d to see how the OBJ decoding is performed. 
>> - 
>> Fabien 
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Static vs Dynamic vertex buffers?

2012-08-25 Thread Digipom
I think it doesn't hurt to try that. WIth an index buffer you can just pass 
in the offset to glDrawElements (You'll need to target API 9 or higher to 
get the right method).

On Friday, August 24, 2012 6:17:29 PM UTC-4, Braindrool wrote:
>
> Eh, I believe I know what I'm doing. I've been programming for years. But 
>> I have very little experience with 3D and OpenGL in general.
>>
>
> And a question still remains. How would I get the correct offset for the 
> buffers? I've read plenty of tutorials on how to use the buffer, but they 
> only use 1 object. Would I just have to record how many bytes it puts in?
>
>>
>> On Friday, August 24, 2012 2:46:20 AM UTC-5, Fabien R wrote:
>>>
>>> On 23/08/2012 23:32, Braindrool wrote: 
>>> >   
>>> >> Just a side note that the .obj decoder obviously isn't complete. Just 
>>> >> waiting for an answer first. Thought I'd point out the obvious. 
>>> >> 
>>> >> 
>>> >   
>>> You may have a look at min3d to see how the OBJ decoding is performed. 
>>> - 
>>> Fabien 
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en