Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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  
  Slick2D OpenGL Alpha Map problems  (Read 2699 times)
0 Members and 1 Guest are viewing this topic.
Offline Kronos

Junior Devvie


Medals: 1



« Posted 2013-06-15 11:38:29 »

Hello Smiley

I want to create a dark room and light the way of the character. But this code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
         g.clearAlphaMap();
         
         GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
         g.setDrawMode(Graphics.MODE_ALPHA_MAP);
         character.getAlphaMap().drawCentered(activeProt.x, activeProt.y);
         
         GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_DST_ALPHA);
         g.setColor(Color.darkGray);
         g.fillRect(0, 0, 750, 450);
         
         g.setDrawMode(Graphics.MODE_NORMAL);


does not work. This snippet is in the render method. Before this code snippet there are only items and animations drawn. And a g.resetTransform();

I already put the first part "g.clearAlphaMap()" at the beginning of the render Method. But then there is a grey box.

I tested the alpha mapping in a test project, only containing of a background image and the alphamap png. That worked as expected.
What is wrong? Please help me Smiley
Offline Kronos

Junior Devvie


Medals: 1



« Reply #1 - Posted 2013-06-15 16:57:19 »

Shame on me.... found the mistake somewhere else. This code above is good Smiley

thanks though for reading Wink
Offline wessles

JGO Wizard


Medals: 74
Projects: 4
Exp: 4 years


Radirius Software


« Reply #2 - Posted 2013-06-17 21:42:09 »

2 4 things:
Think before you post.
Think harder before you post.
Think 10x harder than before you thought harder before you posted
Slick is a little outdated, and I see that you are just using lwjgl at this point. Here is some advice: If you know how to use those commands, slick2d is not for you. Go to libgdx. You will not regret it.

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

JGO Knight


Medals: 35
Projects: 2


Zero but not.


« Reply #3 - Posted 2013-06-17 22:11:36 »

2 4 things:
Think before you post.
Think harder before you post.
Think 10x harder than before you thought harder before you posted

Sometimes when you post, and you come to explain your problem, you start to see what you have done wrong.
No-one's time was wasted here, through posting he came up with his own answer. I don't see why he shouldn't have posted this. It didn't harm anyone.

Slick is a little outdated, and I see that you are just using lwjgl at this point. Here is some advice: If you know how to use those commands, slick2d is not for you. Go to libgdx. You will not regret it.

Considering he is working with Alpha maps, I think he is a considerable way through his project. By switching to libgdx, he would not only have to go through the process of learning it, but also going through all his code and re-doing everything. When you add all that time together, it would probably not justify switching to libgdx.
Offline wessles

JGO Wizard


Medals: 74
Projects: 4
Exp: 4 years


Radirius Software


« Reply #4 - Posted 2013-06-17 22:38:04 »

Sometimes when you post, and you come to explain your problem, you start to see what you have done wrong.
No-one's time was wasted here, through posting he came up with his own answer. I don't see why he shouldn't have posted this. It didn't harm anyone.
Touche. Just for further reference. Sorry.

Considering he is working with Alpha maps, I think he is a considerable way through his project. By switching to libgdx, he would not only have to go through the process of learning it, but also going through all his code and re-doing everything. When you add all that time together, it would probably not justify switching to libgdx.
Again, just for future reference, when he can switch. None the less, good point.

Offline opiop65

JGO Kernel


Medals: 159
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #5 - Posted 2013-06-18 02:57:56 »

2 4 things:
Think before you post.
Think harder before you post.
Think 10x harder than before you thought harder before you posted
Slick is a little outdated, and I see that you are just using lwjgl at this point. Here is some advice: If you know how to use those commands, slick2d is not for you. Go to libgdx. You will not regret it.
1. No
2. No
3. No
4. No

I say no to 4 because building your own framework may be harder, but you learn how to actually use core OpenGL. Do you know what all those functions in LibGDX do (or how they basically work)? If you don't, I would recommend strongly that you learn plain OpenGL and then use frameworks that build on top of it. What happens if LibGDX dies someday and there are no other libraries for Java and LWJGL? Well, you're screwed because you have no idea how to use basic LWJGL. I think ignorance of the OpenGL language would be solved partially if new people to the library would learn how to use OpenGL first before moving onto Slick2D, LibGDX etc...

Also, don't tell him to think harder. Everyone makes mistakes and he even admitted it. You are quite the newbie here too, don't go around telling others what to do.

Offline nhydock

Junior Devvie


Medals: 4
Projects: 2



« Reply #6 - Posted 2013-06-18 04:02:18 »

2 4 things:
Think before you post.
Think harder before you post.
Think 10x harder than before you thought harder before you posted
Slick is a little outdated, and I see that you are just using lwjgl at this point. Here is some advice: If you know how to use those commands, slick2d is not for you. Go to libgdx. You will not regret it.
1. No
2. No
3. No
4. No

I say no to 4 because building your own framework may be harder, but you learn how to actually use core OpenGL. Do you know what all those functions in LibGDX do (or how they basically work)? If you don't, I would recommend strongly that you learn plain OpenGL and then use frameworks that build on top of it. What happens if LibGDX dies someday and there are no other libraries for Java and LWJGL? Well, you're screwed because you have no idea how to use basic LWJGL. I think ignorance of the OpenGL language would be solved partially if new people to the library would learn how to use OpenGL first before moving onto Slick2D, LibGDX etc...

Also, don't tell him to think harder. Everyone makes mistakes and he even admitted it. You are quite the newbie here too, don't go around telling others what to do.

Learning straight OpenGL takes a bit of work, but it really is worth it.  Have to admit, though, it took a little bit of stumbling to get used to OpenGL ES 2.0 and its shader reliance after only being used to OpenGL 1.4 for so long.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 138
Projects: 4
Exp: 3 years



« Reply #7 - Posted 2013-06-18 05:29:29 »

2 4 things:
Think before you post.
Think harder before you post.
Think 10x harder than before you thought harder before you posted
http://www.java-gaming.org/topics/slick2d-mouse-position-is-off/29876/msg/275108/view.html - Answered self on same day
http://www.java-gaming.org/topics/strange-camera-detection/29809/msg/274368/view.html - Answered self on same day
http://www.java-gaming.org/topics/get-angle-direction-from-vector2f/29871/msg/275046/view.html - Failed to read api
You're one to talk. Most of your posts would have been solved easily after "thinking harder."

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.

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (24 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (69 views)
2014-11-07 19:57:14
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!