question about sending ram->vram each frame

Started by
21 comments, last by Vortez 10 years, 3 months ago

I am only slightly experienced in opengl (i am mostly doing

2d on blitter stuff) and i would like to clear some things with it,

maybe some will help me to clarify..

As i understand you need to transfer (ram -> vram upload)

two kinds of data :

- geometry data

- texture data

as i understand texture data you only upload mostly once (at app startup) not each frame (except if you got not sufficient vram then you could destroy

some upload some other, it is switch texture set for example between

game chapters,.. but in general you do not do it on perframe basis) [is this correct?]

- also if you need tochange texture data you usually change it on vram side

by shaders.. [is this correct?]

more confused i am with dealing with geometry data :

here i am not sure but it seem to me that geometry data is in

generall uploaded on perframe basis (it is you send heavy thousands of triangles each frame with cpu to gpu side - then after every frame

the vram set of it is destroyed/cleared (which opengl call clears it?

i do not know the thing here..) for example even if you have vertex

array you need to send it (ram->vram) each frame

is this correct or not? are there some mechanism that prevents

the uploaed geometry arrays on vram side and allow only for

manipulating them there? (for example heavy mesh is being uploaded to

vram and it stays there for hundreds of frames you can only send some

parameters like modifile position matrixes for each mesh nodes not whole

mesh data? could someone clear the thing?

Advertisement

You should not be resending identical data. Create a VBO once and reuse it.

Yes, you use translation/rotation matrices.

You can even interpolate animation with a single mesh plus several skeletal keyframe matrices.

No answers? this seem to be fundamental and important topics, important to get answer..

You already got the answer. You pass vertices once. As a general rule, they don't ever change.

If you moved your vertices, they'd accumulate FP math errors and your model would stop being the model you think it is.

You also got an example of how you avoid resending data using matrices in the answer. You were even told to look up more information by looking into skeletal keyframe animation. While 3TATUK2 obviously dumbed the animation explanation down, you should know enough from the explanation to effectively google about animation.

To help understand animation better, maybe you can think of a simpler animation where you pass 2 vertices into the vertex shader and a time variable. You use the time variable to do a linear interpolation on the two vertices to calculate the vertex you actually want to work on in the shader. Note that this is not matrices, but hopefully it gets you thinking about how you can deform a vertex in the shader to work on a calculated vertex instead of a directly specified one.

Technically, most of the answers to your question depend on what you are doing - but for efficiency, it's better to limit transfering from client to server (or vice versa) as much as possible.

Really, I suggest going through some tutorials, look up "modern OpenGL tutorials" or similar. Make sure the tutorials are "modern" or at least version 3 or later. For example, this one http://www.opengl-tutorial.org/ seems good, I believe it was one of the tutorials I skimmed through it when moving from XNA to OpenGL a year or two ago and found it helpful.

After you get the basics, going through the OpengGL wiki is helpful on the nuts & bolts aspects of OpenGL.

Technically, most of the answers to your question depend on what you are doing - but for efficiency, it's better to limit transfering from client to server (or vice versa) as much as possible.

Really, I suggest going through some tutorials, look up "modern OpenGL tutorials" or similar. Make sure the tutorials are "modern" or at least version 3 or later. For example, this one http://www.opengl-tutorial.org/ seems good, I believe it was one of the tutorials I skimmed through it when moving from XNA to OpenGL a year or two ago and found it helpful.

After you get the basics, going through the OpengGL wiki is helpful on the nuts & bolts aspects of OpenGL.

maybe it may seem strange but i got not to much time for learning opengl - i just need some answers like here

(Im doing 2d blitter graphics for over a year not touching

ogl)

cannot them be just answered, they are quite simple?

Technically, most of the answers to your question depend on what you are doing - but for efficiency, it's better to limit transfering from client to server (or vice versa) as much as possible.

Really, I suggest going through some tutorials, look up "modern OpenGL tutorials" or similar. Make sure the tutorials are "modern" or at least version 3 or later. For example, this one http://www.opengl-tutorial.org/ seems good, I believe it was one of the tutorials I skimmed through it when moving from XNA to OpenGL a year or two ago and found it helpful.

After you get the basics, going through the OpengGL wiki is helpful on the nuts & bolts aspects of OpenGL.

I was only using some basic opengl, when i was drawing

some basic opengl i sent a full vertex array each frame..

so what with that .. there is a way of sending all meshes

at app startup and then sending only position matrices each frame?

as to this post of 3tatuk2 it was zero helpfull (belive me

i know what im saying ;\)

there is also subquestion of deleting the geometry data

- if i upload a large vertex geometry in the frame and it resides in vram then it seem that before sendoing it next frame some api call deletes the prevoius in the vram.. is this true? what api call this is?

as to moving the vertices i do not want to move the vertices by updating the vertex array but just use glRotate glTranslate but then it is again whole vertex array sending (uploading)... is this correct way of writing programs or this is bad way at all?

as to this post of 3tatuk2 it was zero helpfull (belive me
i know what im saying ;\)


No, you don't. Creating a VBO and putting the vertex/index data in there (just like 3TATUK2 said) is the exact way you avoid uploading the identical data to the graphics card every frame.

The first Google result for 'VBO' is even this Wikipedia page which, while not perfect, gives a very decent introduction to the concept.

If someone tells you how to do something (transfer data only once to GPU using OpenGL in this case), you can safely assume it is possible. You seem upset that nobody explicitly said it is possible, but I'm not sure what other conclusion could be reached. It is the reason I did not reply to the original post. I felt I could add nothing of value beyond what 3tatuk2 said.

You can load your textures and vertices (meshes, whatever) at application startup. You can also do it when loading a level (that's what all those loading screens in AAA games are doing). You can also do it in between every frame. You can even reload every model, then call a single draw of a single triangle, then reload every model again. Performance will definitely vary with each of those options.

When you are programming, the computer does whatever you tell it to do.

Ok, Ill try. Fir;

>> there is a way of sending all meshes at app startup and then sending only position matrices each frame?<<
Yes
>>if i upload a large vertex geometry in the frame and it resides in vram then it seem that before sendoing it next frame some api call deletes the prevoius in the vram.. is this true? what api call this is?<<
Immediate mode?
>>as to moving the vertices i do not want to move the vertices by updating the vertex array but just use glRotate glTranslate but then it is again whole vertex array sending (uploading)..<<

You can use glRotate/glTranslate without uploading the whole array using VBOs as everyone has been telling you.

>>. is this correct way of writing programs or this is bad way at all?<<

I believe its deprecated and you should use your own matrices. However, it does still work with glTranslate etc.

This topic is closed to new replies.

Advertisement