It is currently Sat Aug 22, 2020 4:16 am


All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: OPENGL and Polyvox's scope/responsibility
PostPosted: Sun Mar 15, 2009 10:40 am 

Joined: Thu Feb 26, 2009 7:58 pm
Posts: 26
Currently I am working with the OPENGLExample for PolyVox. I am aware that this is currently just a basic example (even if you can do a lot already).
I am wondering about your plans. I would like to understand, if PolyVox is intended to handle textures, materials etc. or if the user of PolyVox has to take care of that(if yes I'd like a hint or two how to begin)?
Will your example contain a camera (movable)? Because I need to know, what I need to add to make the tests visually nice looking and how to take a closer look. :-)

Will PolyVox contain an exporter to use the modeled objects in ... lets say Thermite?


Kind regards
J.

Btw. I'd appreciate a hyperlink back to the Thermite homepage on the pages of the forum.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Sun Mar 15, 2009 10:46 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
joschka12 wrote:
Currently I am working with the OPENGLExample for PolyVox. I am aware that this is currently just a basic example (even if you can do a lot already).


Actually I've been working on it quite a lot over the past few days. I have updated it so that it is much faster, includes lighting, and also shows how to make different colour voxels. The code is getting complicated but I will comment and simplify it as I progress.

I would like to make sure that this example runs on as many graphics cards as possible, so would you mind testing it for me as I know you have an older machine? You can try compiling from source, or you can grab a prebuilt version here:

http://www.david-williams.info/linked_f ... 032008.zip

The console in the background should print out the frame rate - I would be interested in what you get.

joschka12 wrote:
I would like to understand, if PolyVox is intended to handle textures, materials etc. or if the user of PolyVox has to take care of that(if yes I'd like a hint or two how to begin)?


Mostly it is down to the application - this allows applications to have maximum flexibility about how they render the surface. The only thing that PolyVox does is to provide a material ID for each vertex it generates. This is simply an integer (well it's actually a float, but I will change it to an integer) which tells you which voxel a vertex came from. In the new OpenGL Example there is some code like this:

Code:
GLfloat red = 0.0f;
GLfloat green = 0.0f;
GLfloat blue = 0.0f;

uint8 material = vertex.getMaterial() + 0.5;

switch(material)
{
case 1:
   red = 1.0;
   green = 0.0;
   blue = 0.0;
   break;
case 2:
   red = 0.0;
   green = 1.0;
   blue = 0.0;
   break;
case 3:
   red = 0.0;
   green = 0.0;
   blue = 1.0;
   break;
case 4:
   red = 1.0;
   green = 1.0;
   blue = 0.0;
   break;
case 5:
   red = 1.0;
   green = 0.0;
   blue = 1.0;
   break;
}


This chooses a color for OpenGL to render, based on the voxel that the vertex came from.

joschka12 wrote:
Will your example contain a camera (movable)? Because I need to know, what I need to add to make the tests visually nice looking and how to take a closer look. :-)


I have added rotation, and will probably add a zoom function as well.

joschka12 wrote:
Will PolyVox contain an exporter to use the modeled objects in ... lets say Thermite?


I think that it will be possible for the PolyVox OpenGL example to load volumes which were created for Thermite. However, they won't look exactly the same as I'm not planning to add support for texturing to the OpenGL example (just because I want to keep things simple).

joschka12 wrote:
Btw. I'd appreciate a hyperlink back to the Thermite homepage on the pages of the forum.


Maybe... I will change it if I can work out how :-)


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Mon Mar 16, 2009 8:08 am 

Joined: Thu Feb 26, 2009 7:58 pm
Posts: 26
Hello again,

after checking out the new SVN repository which compiled more conveniently and nicely (thanks for creating the build_all cmake), all I saw was just a failed application. It started worked for a second or two and the it failed. "we are sorry ...".
Then reading your reply again I found a pre-build version there and downloaded it hoping for a different result but was disappointed, again it failed.
I shut down all applications running to free as much memory as possible, but still the same.

If there is anything I may send you for further clarification please let me know.


Kind regards
J.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Mon Mar 16, 2009 9:26 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hmmm... interesting. I have created another new build - can you try this one?

https://dl.getdropbox.com/u/546021/Open ... 032009.zip

If it works it will be slow, but I'm more interested in whether it runs at all...

Also, you know the very old version of Thermite which worked for you? I would like you to try running that again. When it starts up you should see an option screen where you can choose which render system to use (the options should be OpenGL and Direct3D). Does it work in OpenGL mode, or did you only test Direct3D? It sould be great if you could see if they both run.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Tue Mar 17, 2009 7:40 am 

Joined: Thu Feb 26, 2009 7:58 pm
Posts: 26
Hello,

thanks for the immediate support. It works now. Please see the screen shot with the fps rates as inquired.

The very old application, I ran with OpenGL (the screen was 90° rotated and had a very funny scale and mouse reaction) and it worked.

May I ask you what you changed to understand what I need to do to build it successfully? (Well, if its just my outdated and simple graphics card which causes the problems, I think it may not be worth considering it)

Thank you very much
J.


Attachments:
aScreenshot.png
aScreenshot.png [ 110.09 KiB | Viewed 5636 times ]
Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Tue Mar 17, 2009 9:57 am 

Joined: Thu Feb 26, 2009 7:58 pm
Posts: 26
Hello,

after getting the new sources from svn (just main.cpp) and builing it, it started. But the frame rate is lower than using the version you posted. Maybe there is a difference. I post a screenshot as prove.

Kind regards,

J.


Attachments:
aScreenshot2.png
aScreenshot2.png [ 78.84 KiB | Viewed 5631 times ]
Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Tue Mar 17, 2009 12:33 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Great, I'm glad we're making progress :-) So what's going on?

Well, OpenGL has two main modes of operation. The first is known as 'Immediate Mode' - this is supported by all graphics cards and has been around for 20 years or so. In this mode the CPU will send the triangles to the graphics card every frame (which is slow). It is 'traditional' OpenGL but I believe it's been deprecated now and will be removed at some point in the future. It looks somthing like this:

Code:
glBegin(GL_TRIANGLES);
   glVertex3f(...);
   glVertex3f(...);
   glVertex3f(...);
glEnd();


The other, most modern approach is to use 'Vertex Buffer Objects'. In this case, the data is loaded into the graphics card memory only once, and then each frame the CPU sends a command to say 'draw the data'. This is much faster than sending all the data every frame but is only supported on more recent cards (maybe the last 5 years?).

There are other approaches which come in between these two (display lists, vertex arrays, etc) but we won't worry about them for now.

I wrote the OpenGL example to use Vertex Buffer Objects to make it as fast as possible, but when you told me didn't run on your system I assumed this was the problem. So I added a define called 'USE_OPENGL_VERTEX_BUFFER_OBJECTS'. When this is defined the Vertex Buffer Objects are used, and when it is not defined then immediate mode is used. That's why the example now runs for you - it's using immediate mode.

But it's interesting that the old Thermite demo works when using the OpenGL render system. I had assumed that Ogre was using Vertex Buffer Objects and therefore wouldn't work. But maybe Ogre has a fallback to use a diffreent approach if Vertex Buffer Objects aren't available, or maybe it is just better at detecting them.

To get a proper answer it would be useful to know exactly what your graphics card is capable of. There is a tool called GLView which you can get here: http://www.realtech-vr.com/glview/download.html

If you don't mind, it would be great is you could install and run this. There is then a button at the top which you can use to save your graphics card capabilities to an .XML file. If you send me this I will take a look.

Also, it would be great if you can make sure you have the most recent drivers installed. That can sometimes make a difference.

As for the speed difference between your version and mine - did you build in Debug mode or Release mode? There is a drop down menu in the Visual Studio toolbar.

Also, you might notice a few missing polygons and some flickering. I get this too - there is a bug somewhere that I have to fix...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Tue Mar 17, 2009 3:43 pm 

Joined: Thu Feb 26, 2009 7:58 pm
Posts: 26
Hello, we are living in a box :-)

do I recall correctly that you want to create an editor to create voxel scenes? Would this be the place to do what I am currently doing with the OpenGL Example?

Kind Regards
J.

BTW: the lines at the bottom of the box are not modeled they appear just like that and they are definitely no shadows.


Attachments:
aScreenshot3.png
aScreenshot3.png [ 61.06 KiB | Viewed 5623 times ]
Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Wed Mar 18, 2009 6:43 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hey, that's cool! I really like what you are doing with this :-) Don't worry about the dark lines at the bottom of the box, that was just a bug which has since been fixed. They should go away if you update.

Regarding an editor - yes, it would be a good thing to have. I haven't decided exactly what my plans are here. One option would be to have an editor built directly into Thermite. This would be useful as it would use the Thermite material (textures, etc) and might also allow the placing of other objects in the world which are not related to PolyVox. The other option would be to have a seperate standalone editor for PolyVox. This would have the advantage that it would be useful for all PolyVox projects (not just Thermite) and would also be conceptually simpler. It might even be worth having both editors as they will be intended for slightly different purposes. At any rate, I don't expect to work on an editor for quite a long time, so you would be welcome to try it yourself.

As for the Vertex Buffer Object support on your laptop, it looks like does support them but using a pre-standard interface. The feature should be called 'GL_vertex_buffer_object', but your card calls it 'GL_ARB_vertex_buffer_object', which is what it was called before it was standardised. There may be other old variants of this feature as well - but I don't really have time to add support for all of them (plus I can't easily test). But if you want to improve the framerate on your laptop, you could look into this.

And for the crash on your desktop PC, did you copy accross the GLUT .dll as well? You should be able to place it in the folder with the .exe and PolyVox .dlls...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: OPENGL and Polyvox's scope/responsibility
PostPosted: Thu Mar 19, 2009 3:21 pm 

Joined: Thu Feb 26, 2009 7:58 pm
Posts: 26
David, regarding the crash I have verified both systems.
Neither of them stores the GLUT.dll but both store the GLUT32.DLL.

And it still does not work.

Frankly I am a bit lost.

Kind regards
J.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net