LWJGL Forum

Programming => OpenGL => Topic started by: benowar on November 28, 2005, 15:31:15

Title: Howto let a GL_QUAD look like an Oval Form?
Post by: benowar on November 28, 2005, 15:31:15
Hi,

I use a simple GL_QUADS with a texture which uses an oval shape. Take a look at this shot: http://www.rssowl.org/shot.png

The blue quad in front uses the texture and as you can see, the corners overlap, which makes it look a bit ugly.

Is it somehow possible to let the corners be completly transparent? The texture itself is transparent on the corners. But as soon as I set a Color to the quad, the borders show with that color as well.

Thanks,
Ben
Title: Howto let a GL_QUAD look like an Oval Form?
Post by: CaseyB on November 28, 2005, 16:11:30
You can use glColor4f() to set the color for the quad.  The first 3 float values are the color and the last is the transparency.  You can set it to be completely transparent.  If you want the semi-transparent look in the center you can make that part of the texture.
Title: Howto let a GL_QUAD look like an Oval Form?
Post by: benowar on November 28, 2005, 17:41:45
Yes I am already using glColor4f, but I think its not helping in this case. As soon as I set the quad to be completly transparent, the Texture itself is no longer showing. Is there any way to let glColor4f not affect the Texture?

Ben
Title: hmmmmm...
Post by: Fool Running on November 28, 2005, 18:20:18
Some code would help...
Without code; a couple ideas:
Make sure you have the correct texture blending mode set to allow what you are trying to do (sorry, but I don't remember it at the moment :roll: . GL_MODULATE maybe?)
Make sure you have blending enabled (I assume you do since you can see through the texture :lol: )
Make sure you are making the texture with GL_RGBA and not just GL_RGB.
Check the texture load code and make sure you are setting the red, green, blue, and alpha chanels into the right places in the texture data (i.e. make sure it is stored red, then green, then blue, then alpha)

Does the texture work if you just put it on a quad without the glColor4f()?
If your texture has the alpha in it then glColor4f(r, g, b, 1.0f) should do it (That is the way I do it, I think :roll: )...
Title: Howto let a GL_QUAD look like an Oval Form?
Post by: benowar on November 28, 2005, 20:28:37
Hat sich erledigt! Nachdem ich einfach mal ganz genau auf GL11.glEnable(GL11.GL_TEXTURE_2D); aufgepasst habe und nur an den stellen enable wo auch wirklich gebraucht, klappts nun!

Thx,
Ben
Title: Howto let a GL_QUAD look like an Oval Form?
Post by: CaseyB on November 28, 2005, 20:58:07
Cool!  :D
It's weird that that would cause the trouble you were seeing though!  :?
Title: Howto let a GL_QUAD look like an Oval Form?
Post by: benowar on November 29, 2005, 09:12:07
Oh sorry for my german  :oops:

I just placed some enable / disable GL11.GL_TEXTURE_2D around my various objects that I render and its working now. I even got some strange problems where showing a texture resulted in other Objects completly getting invisible, but that seems to be fixed now as well.

ben
Title: hmmmmm...
Post by: Fool Running on November 29, 2005, 14:08:12
Quote from: "CaseyB"Cool!  :D
It's weird that that would cause the trouble you were seeing though!  :?
I second the thought!  :wink: That's a really weird thing to do to fix it.  :lol: