Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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  
  YATQ - Yet Another Texture Question  (Read 1102 times)
0 Members and 1 Guest are viewing this topic.
Offline MickeyB

Senior Devvie

my game will work, my game will work!

« Posted 2005-01-25 15:24:28 »

I am having the same problem that dsellars had on antoher thread.  I have png's that have black background.  I have set black as my clear color and the backgrounds are completely gone (what I want) but the image is transparent.

I am using the testure loader form LWJGL examples with the following line:
BufferedImage tex = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_4BYTE_ABGR);

Anything other that that type_4byte_abgr or type_3byte_bgr will cause the following line to error out with a clas cast exception at the following line:
byte data[] = (byte[]) tex.getRaster().getDataElements(0, 0, tex.getWidth(), tex.getHeight(), null);

my code for transparency is as follows and i have tried with with and without the commented code:
            if(isTransparent()) {
                  GL11.glEnable(GL11.GL_BLEND);                                // Set up blending for transparency
              GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE);  // Blending Function For Translucency Based On Source Alpha Value
              //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

regardless of changes, to have solid images, I must have solid backgrounds.
where is my clubieness at its highest?

EDIT: one note...if I use Fireworks and use a transparent canvas and use GL11.GL_ONE_MINUS_SRC_ALPHA it does what it should, but is this best practice?


Current Project:
Offline dsellars

Junior Devvie

Need to write more games

« Reply #1 - Posted 2005-01-26 07:17:29 »

I got my stuff working in the end (I think as I've not got back to it to play with properly).

I used a modified version of the DevIL code in nehe lesson06 to load the image. (modified to load the alpa chanel)

I used the values that Cas suggested and it worked.  The only thing i can think of is that when I created my png's I created then with a transparent background.

I would have thought that having a black background on the texture will mean it gets drawn.


Offline MickeyB

Senior Devvie

my game will work, my game will work!

« Reply #2 - Posted 2005-01-26 14:44:40 »

Thanks.  I am in the middle of converting all the canvas backgrounds to transparent.   Wink


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

Junior Devvie

Need to write more games

« Reply #3 - Posted 2005-01-27 06:05:24 »

Did you try it with just one sprite to see if it worked first? Grin

Offline MickeyB

Senior Devvie

my game will work, my game will work!

« Reply #4 - Posted 2005-01-27 15:16:45 »

Canvases to transparent does the trick...seeems good enough for now.   Wink

Now back to picking!


Current Project:
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

SHC (29 views)
2015-08-01 03:58:20

Jesse (20 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (22 views)
2015-07-27 15:35:20

Riven (25 views)
2015-07-27 12:26:13

Riven (15 views)
2015-07-27 12:23:39

BurntPizza (37 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (31 views)
2015-07-24 06:06:53

NoxInc (37 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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!