Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (613)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
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  
  libdgx - Shaperenderer - Opacity  (Read 2514 times)
0 Members and 1 Guest are viewing this topic.
Offline Phibedy

Senior Devvie

Medals: 9

« Posted 2012-12-31 08:31:53 »

Hi, I am wondering about the Shaperenderer:
          shapeRenderer.setColor(0, 0, 0.4f, 0.3f);
          shapeRenderer.setColor(1, 1, 0, 0.3f);

Normally I would use the spritebatch for drawing, but this time I just want to draw a circle that contains another circle with a different color. In addition the one on the bottom shouldshow through the other. I just don't get it who to enable the alpha-"function" / if you google it, it always shows articles about the spritebatcher.
I thought
would manage it, but "glEnable(GL10.GL_BLEND)" throws nullpointer..
I am new to opengl-fun and that's absolutely confusing me, I just don't get what I am doing wrong  Roll Eyes
thx for help and patience Smiley
Offline Nate

« JGO Bitwise Duke »

Medals: 165
Projects: 4
Exp: 14 years

Esoteric Software

« Reply #1 - Posted 2012-12-31 09:14:05 »


But note you should end any begins before doing more drawing if you change blending.

Offline Phibedy

Senior Devvie

Medals: 9

« Reply #2 - Posted 2012-12-31 09:21:53 »

4, 1, 1, 1);;;

I don't think that I am drawing sth at the moment or do I missunderstand it?
best regards

edit: Got it, although shaderrenderer uses gl10 I have to modify gl20  persecutioncomplex
Does someone know why?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2012-12-31 15:42:49 »

edit: Got it, although shaderrenderer uses gl10 I have to modify gl20  persecutioncomplex
Does someone know why?

My only guess would be you enabled gl2 in the config (@launcher)

Also keep in mind shapeRenderer is slow and only for debug stuff - an unfortunate reality, you kinda have to do this stuff yourself if you need it (drawline, drawrect, fillCircle, whatever) - I do it with stretched images

Offline davedes
« Reply #4 - Posted 2012-12-31 15:54:49 »

You should use or for functions that are shared by both GL10 and GL20. That way your code is independent of GL version. Smiley If useGL20 is true, then Gdx.gl10 will return null.

Of course, it doesn't matter if you use GL10 or GL20 for static constants (like GL_BLEND), since those will never be null.

As said, ShapeRenderer is not the fastest, but it will probably do fine for most purposes. Another downside is that it relies on hardware anti-aliasing; it varies from device to device, and some don't support it at all.

Also note that if you need lines or rectangles, you can use a regular SpriteBatch; see here.

If you need better performance (i.e. Android), you should look into using images, or if you fancy something slightly more advanced, read up on shaders. Smiley

Offline Phibedy

Senior Devvie

Medals: 9

« Reply #5 - Posted 2012-12-31 17:27:44 »

thx for explanation Smiley
The shaperenderer is just for prealpha-test-debugging-version. In the future I am not sure if I will use spritebatches or shaders. Spritebatches are very easy to use Cheesy
I already did that tut, but I think I have to read more about shaders if I want to use them  Grin
Especially because from es 1.0 to 2.0 are some creepy changes and at the moment I often confuse the functions and wonder about the result Grin
I just started learning opengl and maybe I did to big steps so I might haven't understood everything I thought I understood  Roll Eyes
best regards
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Coldstream24 (14 views)
2015-09-03 00:41:28

Andrew_3ds (24 views)
2015-09-01 19:08:10

afikri (16 views)
2015-08-31 09:30:22

afikri (24 views)
2015-08-31 09:30:07

afikri (12 views)
2015-08-31 09:27:24

afikri (16 views)
2015-08-31 09:26:40

Roquen (23 views)
2015-08-29 11:30:54

GamerC4 (34 views)
2015-08-22 20:38:50

GamerC4 (31 views)
2015-08-22 20:37:18

GamerC4 (37 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

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