question about sending ram->vram each frame

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

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?

If you do not store your vertex attributes in a VBO, the whole data will be moved from the system to the graphics card on every glDraw* call. After everything ordered in the glDraw* call has been rendered, the memory containing the data is immediately freed. The concept of 'frame' does not play into it and it's not really something that makes much sense in the context of modern OpenGL.

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 said repeatedly, static data which is rendered repeated is usually placed in a VBO. Using glRotatef, glTranslatef is no longer used in modern programs. That whole part of the API has been deprecated for good reasons. And while it's unlikely that your programs will stop working (at least on AMD or NVIDIA card) for the foreseeable future, you are artificially locking yourself out of new features, might end up on code paths that are less optimal than using the modern API and you are causing yourself more pain and inconvenience in the future (because the modern API has a bit more initial boilerplate code you need but is far simpler once that initial investment is done).

What you want is to do is use Vertex buffer objects (VBO) They store all your mesh data on the GPU until you explicitly destroy them and then do skeletal animation using the vertex shaders(GPU skinning) that way you only have to send transformation matrices for the bones each frame in order to animate the mesh.

allright this is usefull - i understand that there are two modes one does vram geometry clearing other preserves it

- though as to clearing i do not understand when it clears is it immediate, when some source triangle is just sent thru rendering its source data is freed immediate or this is on some frame basis? (i understand you sy this is more immediate but i do not see it clearly, previously i suspected it was more like glFlush end of the frame)

- also i do not know how to sent the parameters to the whole big set of geometry data residing in vram - say it is by shaders, istn it very unhandy ? if you have scene that

contains a thousand of meshes need a thousand of parameters (position etc).. so

there is a thousand case switch in the shader which is reaching thousand times

to cpu RAM memory to fetch this coordinates?

These days everything is done by shaders, even if you use the fixed function pipeline, The driver provides basic shaders that mimic the way the old fixed functions worked), glTranslate, glRotate etc modify a matrix on the CPU and the driver will pass it to its stock shaders if you issue a draw call without using your own shaders.

This is worth reading: http://classes.soe.ucsc.edu/cmps162/Spring12/s12/labnotes/shaders.html

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Advertisement

These days everything is done by shaders, even if you use the fixed function pipeline, The driver provides basic shaders that mimic the way the old fixed functions worked), glTranslate, glRotate etc modify a matrix on the CPU and the driver will pass it to its stock shaders if you issue a draw call without using your own shaders.

This is worth reading: http://classes.soe.ucsc.edu/cmps162/Spring12/s12/labnotes/shaders.html

well i can say that i am not learning it because i find all this

ugly and i just seem to not like it - though I must say some

game graphics achived by this are quite impressive - maybe i will start some topic on this becaouse Im curious for opinions

if this opinion is only my own


well i can say that i am not learning it because i find all this

ugly and i just seem to not like it - though I must say some

game graphics achived by this are quite impressive - maybe i will start some topic on this becaouse Im curious for opinions

if this opinion is only my own

Well, if you dont like shaders, no one is forcing you, you can still use the old opengl fixed pipeline if you wish.


well, ok

though i am not accustomed to using non frame terminology,

physically you render frames

if you do not use frames concept you mean something like

stream of images that could add to sum up images without any boundaries that it is finished... weird



for example you send buny than little house than some rocket

(to make of an image of bunny house and rocket, imo frame

is needed to say when you got result ready to draw and when

not yet

(so i just doubt if it possible not to use frame concept in ogl, one need to know when frame is ready - and also need some

notion of beggining the frame (need to clear it sometimes) - but do not matter )

I dont see the problem here. In opengl, you (usually) start a drawing a frame using something like glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT), (flags depend on what buffers you use, for example, the depth buffer is not needed in 2d, and you could use the flag GL_STENCIL_BUFFER_BIT to clear the stencil buffer if you're using it), then, you finish drawing by calling SwapBuffers(), which draw the backbuffer to the screen, assuming you're using double buffering., if not, i beleive you should call glFinish() (someone correct me if im wrong on that one).

Like many others have told you before, you usually try to avoid resending the same vertices to opengl every frame, since that's a huge performance hit. However, if you only need to draw a few vertices, that dosen't matter much imo. Also, about that copy in ram, once your done uploading the vbo to the gpu, it's ok to free the memory in ram, you probably (at least, in 99% of the cases) wont need it anymore.

This topic is closed to new replies.

Advertisement