Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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 1460 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.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
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?

Online princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 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 Member


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.
Online princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 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.

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
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 Member





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

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

1  
2  
3  
4  
5  
6  
7  
8  
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  
 
 
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.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (39 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (36 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!