Jump to content
  • Advertisement
Sign in to follow this  
baldacim

OpenGL Doubts about strategy of rendering

This topic is 2684 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[color="#888888"][color="#000000"][font="Verdana"][font="verdana, sans-serif"]Hello everyone, I have a great doubt about the best way to render my game.[/font][/font]
[color="#888888"][color="#000000"][font="verdana, sans-serif"] [/font][color="#000000"][font="verdana, sans-serif"]
[/font][color="#000000"][font="Verdana"]I am very new to OpenGL and GLSL therefore want to do things in a simple butefficient. It is a job for learning but have target dates so do not want a more complex structure to the ground. The terrain is quite flat just changing textures.[/font]
[color="#888888"][color="#000000"][font="Verdana"] [/font][color="#000000"][font="Verdana"] [/font][color="#000000"][font="Verdana"][font="verdana, sans-serif"]I want to make my land based on squares 100x100 with texture. But I do not know whether it is better to create several instances of the class doing render terrain in absolute position (without using translate) or have each instance to differentiate the values ??of translation to put into place.

Another doubt is about the method of rendering. In the future I want to use bump mapping with GLSL on the ground and wondered whether it is better to use it for Vertex Array? VBO? Display List? direct rendering?

It is possible to use display list with GLSL?

As are many instances of the class field and its vertices or translations do not change, I do not know if it's good to keep everything in VBO or Vertex Array.

So many doubts sad.gif sorry for that.

Thanks.[/font][/font][font="arial, sans-serif"]
[/font][font="arial, sans-serif"][/font]

Share this post


Link to post
Share on other sites
Advertisement
Definitely forget about display lists and direct rendering, they're old and deprecated methods. Most objects it will be best to use a VBO, though you can use Vertex Array for small independent vertices that change every frame (like a particle emitter).

The rest of your question I don't quite understand, but maybe this is enough help to get you started. What is "several instances of the class" referring to?

Share this post


Link to post
Share on other sites
[font=arial, sans-serif][size=2]I'm sorry for my english.

I meant that I would create a class that represents a unique position from the ground that keeps the vertices, transforms (translate) and texture. So to create the scene I would create an java array list(List<Ground> ground) of class and adding a ground instance of the class for eachposition of my scenario. Something like sprites in isometric games.

I hope I was clearer now.

And thank you for explaining about the methods. I will dedicate myself to learningVBO with JOGL now.

And one more question: I'll have some problem with using GLSL or VBO VertexArray? I still have no idea how to bump map with GLSL and afraid to take issue withthe method of rendering.

Very grateful for the reply, really helped me in making a decision:).[/font]

Share this post


Link to post
Share on other sites
No problem. I'll leave you to explore which method you want to use (instancing a single ground tile versus rendering an array of tiles), I think with either way you should be able to achieve a good result.

I'll have some problem with using GLSL or VBO VertexArray? I still have no idea how to bump map with GLSL and afraid to take issue withthe method of rendering.[/quote]

Nope, you won't have any problem using GLSL with VBOs, they work together perfectly. Shaders are a whole other beast entirely, but when you're ready for them you should be able to integrate them into your VBO renderer without too much trouble.

Share this post


Link to post
Share on other sites
[font=arial, sans-serif][size=2]Thanks again:). I believe my approach is nowhere near the best, but I need to get aresult in short-period hehe.

Is there any limitation on the amount of objects that I can render per frame using VBO or Vertex Array?[/font]

Share this post


Link to post
Share on other sites

[font="arial, sans-serif"]Thanks again:). I believe my approach is nowhere near the best, but I need to get aresult in short-period hehe.

Is there any limitation on the amount of objects that I can render per frame using VBO or Vertex Array?[/font]


There has never been any limitations on number of objects you want to render in any API. In fact, the API doesn't know about your objects. It just renders points and lines and triangles. The more your render, the more time it will take.

Share this post


Link to post
Share on other sites

[font="arial, sans-serif"]Thanks again:). I believe my approach is nowhere near the best, but I need to get aresult in short-period hehe.

Is there any limitation on the amount of objects that I can render per frame using VBO or Vertex Array?[/font]


Generally speaking no, if you have a minimum framerate you need to achieve then there will be a limit based on how complex your objects (and shaders operating on them) are and how powerful the hardware is.

Assuming you keep things simple and only need to send one position (12 bytes for x,y,z) per object to the GPU per frame, at 60 frames per second you'd get a limit of 11.9 million objects per frame (PCI express 2.0 x16 has a 8GB/second bandwidth limit).

Most modern games don't get anywhere close to that limit however as other factors such as GPU speed becomes limiting far faster. (You can in theory hit the bandwidth limit with a modern GPU while drawing for example simple points but with more complex objects and shaders the GPU speed will become the primary limit very quickly)

Share this post


Link to post
Share on other sites
[font=arial, sans-serif][size=2]Oh I understand, thank you for explanations.

Since it stores the VBO vertex in graphics card, I thought it would occupy space and that space would have a limit.[/font]
[font=arial, sans-serif][size=2]
[/font]
[font=arial, sans-serif][size=2][color=#888888][size=2][color=#000000][size=2]As I am novice did not understand yet the theory behind the VBO, it stores thevertices in memory or just sends more efficiently?

[color=#1111CC][/font]

Share this post


Link to post
Share on other sites
Since it stores the VBO vertex in graphics card, I thought it would occupy space and that space would have a limit.[/quote]

In this case the answer is "yes", there is a limit, but because each graphics card has a different amount of memory the limit is variable. It's even more variable when you account for how much memory you might be using for textures, shaders, the framebuffer and other objects. So it depends on your program really. (There's no "special part" of video RAM set aside for VBOs if that's what you mean.)

What happens when that limit is exceeded? In the normal case it should be swapped out to system memory.

What should you do about it? Nothing right now; you'll typically have at least 1 GB of video memory and unless you're making a content-heavy AAA title you won't be under any pressure. So don't worry about memory usage, write your program, don't do anything silly like grab 512 MB for a VBO, and all will be fine. Whatever else you do, don't assume ahead of time that you're going to be under memory pressure and optimize around that - it will only lead to disaster.

Share this post


Link to post
Share on other sites
[font=arial, sans-serif][size=2]Thank you, this thread encouraged me enough to stop thinking about the problemsand move on to implementation. My concern is to maintain 60FPS running the program on a notebook is not very new. My graphics card is an ATI Mobility Radeon2400 so it is not very powerful. But I hope that your dedicated 256mb is enough:).

I was thinking about creating something with GLSL for mapping textures in mysquare. That would be more efficient than simply using the opengl commands?

Sometimes I confuse what can be done in GLSL to improve performance.

Thank you all.[/font]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!