Skip to main content
GameDev.net gamedev.net
🔒 Locked

retrieving rendered data

Started by MindCode May 21, 2003 at 4:47 PM 6 replies 300+ views
Original Post
MindCode
MindCode
I was reading about the OpenGL feedback mode, and I began to think of something. Feedback mode only stores data converted to 2d screen coordinates, right? Is there a way to get the 3d coordinates? So I would be able to render a model, and then get the 3d informtion about the model?
That's just my understanding; I could be wrong.
Jeffno10
Jeffno10
If you have the 2D data, including the x, y and SCREEN DEPTH coordinate, you can convert back to 3D using gluunproject, i believe...

I don''t know exactly what the opengl feedback mode tells you, though...
Lev Povalahev
Lev Povalahev
The question is _why_ do you need transformed 3d data? Feedback mode is done in software and even if it wouldn''t, reading back from the card would be painfully slow - much slower than simply transforming the data yourself.
MindCode
MindCode
The idea is to render an arbitrary model using an arbitrary organization and to have a uniform formating no matter how it was rendered. Yes, it will be slow. It need not be fast since I''ll only be doing it once on export of the data.
That's just my understanding; I could be wrong.
outRider
outRider
quote:

Feedback mode only stores data converted to 2d screen coordinates, right? Is there a way to get the 3d coordinates?



Aren't the 3D coordinates what you pass to gl to be transformed in the first place? Explain exactly what you want to end up with a little better, and explain arbitrary organization...

If you want to render something from a BSP tree and end up with just triangle lists for example, you need not use gl at all...

------------
- outRider -

[edited by - outRider on May 22, 2003 3:00:33 PM]
MindCode
MindCode
Well I had an idea about a program I could write which would convert many different kinds of 3d file formats into some custom format. The problem is that I don't have the time to learn a bunch of different formats. There does exist libraries to load and view pretty much any file type with OpenGL, so I figured that I could make short work of this task. Instead of reading through all these loaders and finding out how to extract the information from each one, I could simply use the render that comes with them (which uses OpenGL) and extract the data about their rendering through feedback mode, and then use that data to reconstruct the 3d model in whatever format I wish.

I figured that this way it would be an easy task to write import code for different formats because it would basically be done for me (since they all have OpenGL rendering code). I would never have to touch the original code to get it to work. Not to mention that I could use add-on libraries like gle32 (or the glu/glut 3d primitives) for flawless integration without lifting a finger.

[edit]

Of course feedback mode does not return data on culled polygons. Is there any way of disabling culling?

[edited by - MindCode on May 22, 2003 4:00:48 PM]
That's just my understanding; I could be wrong.
outRider
outRider
Two steps...

Have a look at opengl32.dll on your machine and see what functions it exports. You''ll see stuff like glVertex* and glDrawElements and whatever. You''ll have to create a dll that exports the same functions, but when the renderers in the loaders make calls to various drawing functions, you just grab the data and do what you will with it.

Of course this means that you will have to deal with all possible drawing commands the loaders might use: immediate mode, vertex arrays, display lists, VAOs and VAR/Fence, etc. Calls that pass info you don''t need (like glEnable()s and whatever) you have to export, but you can just stub them.

The second part is making an app that loads the data with the loaders then draws them. You''ll want to put your custom dll in the same directory as the app, since you don''t want it overwriting the one in the system directory.

You''ll probably have to tweak your dll each time you want to support a new loader, since there are a lot of different ways to render something. It''s not as hassle free as you might think.

------------
- outRider -
MindCode
MindCode
Well that''s extreme. I was hoping for something where I could use it alongside OpenGL. I tried making and "OpenGL-ish" language but it was a pretty messed up experience.
That's just my understanding; I could be wrong.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.