Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (767)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (854)
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  
  how to divide a triangle into smaller triangles  (Read 2774 times)
0 Members and 1 Guest are viewing this topic.
Offline deepthought
« Posted 2010-11-04 12:23:02 »

i'm using lwjgl for a game,  and i'm gonna put all the textures into one big giant textures so i can render it all with 1 vertex array. the problem, though, is that i can't use GL_repeat. So, how do i divide a triangle into smaller triangles that'll fit. then i've got to do the same thing with the texcoords.

Mad Scientist
Offline lhkbob

JGO Knight

Medals: 32

« Reply #1 - Posted 2010-11-04 13:03:12 »

Why can't you use GL_REPEAT? Is the only reason you need to split triangles so you can get the effect of a repeated texture?

Offline princec

« JGO Spiffy Duke »

Medals: 1053
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #2 - Posted 2010-11-04 13:06:17 »

And why do you want to render it all with one vertex array?

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ryanm

Senior Devvie

Projects: 1
Exp: 15 years

Used to be bleb

« Reply #3 - Posted 2010-11-04 13:25:29 »

If I was in your shoes, I'd want to know for sure that the benefits of fewer texture binds outweighed the work of splitting up your geometry. I'd be very surprised if the benefit was significant enough to merit the programming time needed.
Offline princec

« JGO Spiffy Duke »

Medals: 1053
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #4 - Posted 2010-11-04 13:29:55 »

Texture binding isn't the great expense it once was either... GL drivers these days are super pipelined command queues. You set up tons of little batches of stuff asychronously on the CPU, and the GPU starts slurping the commands off the queue before you've even finished. If you're lucky you can keep them both busy but anything made in the last 3-4 years you'll have to try pretty hard with an indie effort to max either of them out...

Cas Smiley

Offline deepthought
« Reply #5 - Posted 2010-11-04 22:55:19 »

uh... hahaha you haven't seen the computers at my high school. also, i figure itl,, help with lighting when i get into shaders. i'm gonna create a type of light that uses part of a texture as the light color. quite useful for making projections. and, i figure that rendering with 1 vertex array is simpler for me than using a separate vertex array for each texture.

Mad Scientist
Offline Riven

« JGO Overlord »

Medals: 1356
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #6 - Posted 2010-11-05 00:47:32 »

It's simply not simpler.

Stop wasting your time, and do it the easy way, make it work first.

Premature optimization is the square root of all evil.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline ewjordan

Junior Devvie

« Reply #7 - Posted 2010-11-05 16:33:18 »

Premature optimization is the (1.0f / fastInverseSqrt()) of all evil.

public static double fastInverseSqrt(double x){
    double xhalf = 0.5 * x;
    long i = Double.doubleToRawLongBits(x);
    i = 0x5FE6EB50C7B537AAL - (i>>1);
    x = Double.longBitsToDouble(i);
    x = x * (1.5 - xhalf*x*x);
    return x;

Fixed that up for you, should run a lot faster now.

At least that's what this awesome article about software rendering in C from the late 90s told me, and if it works in C, it must work even better in Java, since Java's so slow! I herd that the guy that made Doom invented it. Smiley
Pages: [1]
  ignore  |  Print  

EgonOlsen (1328 views)
2018-06-10 19:43:48

EgonOlsen (1205 views)
2018-06-10 19:43:44

EgonOlsen (929 views)
2018-06-10 19:43:20

DesertCoockie (1330 views)
2018-05-13 18:23:11

nelsongames (1110 views)
2018-04-24 18:15:36

nelsongames (1359 views)
2018-04-24 18:14:32

ivj94 (2093 views)
2018-03-24 14:47:39

ivj94 (1251 views)
2018-03-24 14:46:31

ivj94 (2249 views)
2018-03-24 14:43:53

Solater (803 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!