Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Triangles or quads  (Read 1044 times)
0 Members and 1 Guest are viewing this topic.
Offline steg90

Senior Member


Medals: 1



« Posted 2013-04-26 12:11:11 »

Hi,

I've been coding a voxel engine for a couple of months and got it using some standard optimization techniques ( frustum culling, only draw blocks that have no neighboring blocks, only draw faces that can be seen).  Now, was wondering, should I change my rendering of blocks to use triangles as opposed to quads?  I've read that triangles are quicker as the GPU doesn't have to do any vertex conversion  as opposed to splitting quad up into triangles?

Any advice is appreciated,
Thanks,
Steve
Offline princec

JGO Kernel


Medals: 342
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2013-04-26 12:36:55 »

Always use triangles.

Cas Smiley

Offline steg90

Senior Member


Medals: 1



« Reply #2 - Posted 2013-04-26 12:51:58 »

Thanks for that, and is the reason down to speed - I also know quads are supported in OpenGL 3.x

Thanks

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline davedes
« Reply #3 - Posted 2013-04-26 16:26:04 »

Quads are deprecated in GL3+. Almost all drivers will convert to triangles anyways. Just get used to working with triangles, and use index buffers for shared vertices.

They probably won't provide a huge performance boost compared to things like VBOs/VAOs/instanced draw calls/etc.

Offline steg90

Senior Member


Medals: 1



« Reply #4 - Posted 2013-04-26 17:10:56 »

Thanks,

I'm using display lists, guess should convert these this to VBO and then use triangle primitives?

Offline davedes
« Reply #5 - Posted 2013-04-26 17:44:31 »

My suggestion would be to learn the programmable pipeline. (Display lists are also deprecated.)

But if you don't want to learn GL3+, then you can stick with fixed-function and quads.

Offline steg90

Senior Member


Medals: 1



« Reply #6 - Posted 2013-04-26 19:40:01 »

Hi,

I'm ok with shaders etc, come from Direct3D 10.  OpenGL I've been messing with for around 6 weeks, but started with fixed pipeline, immediate mode then display lists.

Think will convert to VBO's and triangles as a first go.  Any good lwjgl tutorials on VBO's or any place, I've looked at nehe's.

Thanks
Offline theagentd
« Reply #7 - Posted 2013-04-26 20:37:42 »

Almost all drivers will convert to triangles anyways.
They have to be split into two triangles. It's possible to construct a non-planar quad that isn't even flat, and together with the limited precision of floating point positions it's pretty safe to assume that the 4 vertices won't lie exactly on the same plane after perspective transformation (I'm talking 3D here). Plus, hardware interpolators only interpolate vertex attributes between the 3 corners of a triangle.

To draw quads use indexed rendering. Use 4 vertices and 6 indices to form 2 triangles using the 4 vertices. That's what OpenGL does when you render a quad with GL_QUADS under the hood anyway so performance is identical to using GL_QUADS. Quads are also not supported at all on OpenGL ES so it's a good idea to avoid quads if you have any plan at all to develop for OpenGL 3+ or OpenGL ES.

Myomyomyo.
Offline Vermeer

JGO Coder


Medals: 16



« Reply #8 - Posted 2013-04-26 20:53:14 »

This is great for vbo's

http://www.java-gaming.org/index.php?topic=24272.0

And I used this:



http://www.lwjgl.org/wiki/index.php?title=Using_Vertex_Buffer_Objects_(VBO)
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (35 views)
2014-07-24 01:59:36

Riven (33 views)
2014-07-23 21:16:32

Riven (21 views)
2014-07-23 21:07:15

Riven (24 views)
2014-07-23 20:56:16

ctomni231 (55 views)
2014-07-18 06:55:21

Zero Volt (47 views)
2014-07-17 23:47:54

danieldean (38 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!