Libgdx madness again..

Sooooo I switched from rendering by specifying int points in texture to specifying floats in TextureRegion.
This is what I ran into at SpriteBatch.draw(TextureRegion, … , …);

[quote]Draws a rectangle with the texture coordinates rotated 90 degrees. The bottom left corner at x,y and stretching the region to cover the given width and height. The rectangle is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY.
[/quote]
Any reason why would they rotate it 90 degrees? Because this is only causing problems for me… Why do they need to rotate it 90 degrees?

Then just use the draw(…) method that doesn’t rotate 90deg… :clue:


public void draw(TextureRegion region,
        float x,
        float y,
        float originX,
        float originY,
        float width,
        float height,
        float scaleX,
        float scaleY,
        float rotation,
-        boolean clockwise
)

Ow sorry… I kinda looked at all methods that accept TexReg, but somehow I saw that all the one that have TexReg are rotated by 90… My bad here… Sorry…

Uhm,… I’m starting to find another problem really annoying. Its as if LIBgdx remakes your shader from the ground up. If some variables don’t influence the output of the shader, seems like it Libgdx doesn’t put that variable into shader program.

It is just really annoying. If I have a uniform variable which doesn’t influence the output of the shader and I try to set it, I always get an error from Libgdx that such uniform doesn’t exist, even though it does in my shader code…

Is there a way around this?

are you using spritebatch?
if you use spritebatch you have to use a shader that is compatible to default spriteBatch-shader.

That’s not caused by Libgdx, it’s caused by the shader compiler in your gpu driver.

Hmmmm. Let me explain my “problem” more.

When i try to do setUniform(getUniformLocation(“uniformname”)) it works. When I do setUniform(“uniformname”) it doesnt work. Does this mean Libgdx does those 2 operations differently? :stuck_out_tongue:

I don’t know what libgdx does, but the unused uniform will be removed by the shader compiler. Have you checked what getUniformLocation actually returns? Most likely 0…

glGetUniformLocation():

"This function returns -1 if name does not correspond to an active uniform variable in program, if name starts with the reserved prefix “gl_”, or if name is associated with an atomic counter or a named uniform block.