1

Is it possible create 4 million cubes with a frame rate of 35 fps with java Opengl like minecraft? If it's possible how can I do that? And could you give me some examples of source?

user1491548
  • 111
  • 1
  • 9
  • you know it depends on your graphics card. with display lists I can render 1.2 million polygons on 30 fps, and i got GeForce 6150SE. – MoonBun Jul 02 '12 at 10:23
  • I use a glcalllist() and with a for loop I draw the 3D cubes. My graphics card is a GeForce GT540M. – user1491548 Jul 02 '12 at 11:44
  • What research have you done into this matter? Have you tried to create the cubes and see what happens? SO is not the place to ask others to write code for you. If you go try some things out and then get stuck, we'd be glad to take a look at the questions you come up with at that time. Maybe you HAVE already done research--but if so you didn't tell us about it. Please edit anything you've tried into your question so we can see the work you've done already and proceed from there. :) – WendiKidd Jul 03 '12 at 01:14

4 Answers4

1

ArdorCraftAPI test with JogAmp's Ardor3D Continuation

Hi

I already do so in this project that uses JogAmp's Ardor3D Continuation with JOGL. I published some instructions on it here, look at the subsection containing the examples.

N.B: The original code written by MrCoder uses an abandoned and unmaintained version of Ardor3D with the renderer based on your favourite library.

gouessej
  • 3,640
  • 3
  • 33
  • 67
0

In this case java is not the bottleneck if you properly preload your coordinate and texture data (preferably using a flyweight object pool) and avoid the use of "new" inside of loops.

There are ways of optimizing the number of drawn cubes. Just avoid drawing far objects like in most modern FPS games, using fog to conceal half finished shapes. The smaller your cubes, the harder they are to see and the nearer you can avoid drawing them. Also try falling back to display lists if your vbo gets too big.

nurettin
  • 11,090
  • 5
  • 65
  • 85
  • So the gluPerspective() and fog will actually do? what are the differences between the two? Sorry my stupid questions but I'm some kind of noob – user1491548 Jul 02 '12 at 11:48
  • What is VBO's? I don't use the "new" inside loops but use loops to call the different cubes. Is this right or should I make something different? – user1491548 Jul 02 '12 at 12:09
  • Don't use display lists even on old hardware because their support isn't really good with numerous drivers. If your VBO becomes too big, just make smaller ones, look at GL_MAX_ELEMENTS_VERTICES except if you use OpenGL ES 2 and later. nurettin mentions contribution culling ("Just avoid drawing far objects"). – gouessej Nov 30 '14 at 10:36
0

Take a look at instanced rendering. Make sure you don't call OpenGL methods in some kind of loop, because that will kill your performance. If you don't want to use instanced rendering, use display lists (you won't be able to modify it though).

Oskar
  • 1,321
  • 9
  • 19
0

I'm doing something similar right now in jogl.
I'm sure you've already done it (in the 2 years you've had) but for onlookers and lurkers:

1.) VBOs (vertex buffer objects) is much better than immediate mode/display lists
2.) Custom Shaders (vertex and fragment)
3.) Instanced Rendering (which I'm trying to figure out right now)

Here are some useful links to other peoples opinion on faster multi-rendering:

http://sol.gfxile.net/cubes.html
http://www.opengl.org/wiki/Vertex_Rendering#Multi-Draw

Nate Schultz
  • 181
  • 1
  • 14