Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  Tiling Textures  (Read 1260 times)
0 Members and 1 Guest are viewing this topic.
Offline Mr_Ridd

Senior Newbie




Java games rock!


« Posted 2004-01-15 06:06:11 »

Howzit

Say I have 4 textures and I have a quad. What I want to do is put all 4 textures on the same quad at different locations, so it will look like one big picture. How do I do that?

Shot
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2004-01-15 06:16:58 »

Hmm... you just take 4 quads Smiley

弾幕 ☆ @mahonnaiseblog
Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2004-01-15 06:37:31 »

Or you create an image that contains your four textures and apply it as a texture.

Kev

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

Senior Newbie




Java games rock!


« Reply #3 - Posted 2004-01-15 06:41:02 »

I want to put them on the same quad.
Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2004-01-15 06:48:26 »

Or actually, could you multitexture it and use a different set of coordinates for each texture and GL_CLAMP it to the edges?

Kev

Offline Mr_Ridd

Senior Newbie




Java games rock!


« Reply #5 - Posted 2004-01-15 06:56:56 »

That's what I want to do. How do I do that?
Offline tom
« Reply #6 - Posted 2004-01-15 08:57:24 »

Nehe lesson 22 is about multitexturing.
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=22

Although it's about 100 times as difficult to implement as just using 4 quads  Wink

Offline Mr_Ridd

Senior Newbie




Java games rock!


« Reply #7 - Posted 2004-01-15 09:11:44 »

Let me tell you what I want to do.

I'm writing a game that has a scrolling background but the background is different, i.e. think of StarCraft

There was a post a while ago that asked if he should import a huge image or smaller ones.

If I import a huge image it's going to lag my PC because it will will be about 16000 pixels each way, x, y. If I can make smaller images say of 1024 pixels and then place them where I need them there won't be such a lot of drain.

Otherwise I have to keep track of where the different quads are.

Offline aldacron

Senior Member


Medals: 9
Exp: 16 years


Java games rock!


« Reply #8 - Posted 2004-01-15 09:41:33 »

Assuming you render with an orthographic projection, then tracking the quads is no different the tracking individual images with a 2D API.  You can set up the ortho projection so that (0,0) corresponds to the upper left corner of the screen. Then you just handle map drawing the same as you would with a 2D API, but instead of blitting an image you render a textured quad. You'll need to keep track of which coordinates in the world coordinate system are currently at the upper left corner of the screen, then translate that to an index in a map array (or whatever data structure you use). There's a wealth of info available on the net showing how to do that.

That is all assuming an ortho projection, but if you are using a perspective projection it could be a bit more complex. Either way, using one big quad with several textures scattered about it is not the way to go.
Offline Mr_Ridd

Senior Newbie




Java games rock!


« Reply #9 - Posted 2004-01-15 09:55:19 »

I'm using glPerspective.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline aldacron

Senior Member


Medals: 9
Exp: 16 years


Java games rock!


« Reply #10 - Posted 2004-01-15 12:19:16 »

Then I guess now the question is what sort of game are you making? When you said 'scrolling background' I assumed it was a 2D game using OpenGL for rendering. Is that the case? Or are you using 3D geometry?

Even if it is a 3D enviroment, you can still use ortho projection to draw the background and switch to perspective to draw your objects on top of it.
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.

BurntPizza (22 views)
2014-09-19 03:14:18

Dwinin (35 views)
2014-09-12 09:08:26

Norakomi (63 views)
2014-09-10 13:57:51

TehJavaDev (90 views)
2014-09-10 06:39:09

Tekkerue (44 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (48 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (37 views)
2014-09-07 01:10:19
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!