Tweaking NUI

Immortius

Lead Software Architect
Contributor
Architecture
GUI
drawTextInternal --> crop; renderer.drawText(); reset crop;
drawTextureInternal -> crop; renderer.drawTexture(); reset crop;
crop -> renderer.crop()
This is fine.

drawTextureInternal is only cropping for one specific case of ScaleMode. It seems to me that it should crop for all of them. This was also the only place we conditionally cropped based on equality to the state crop state, so I'd say we should drop the condition as noted above.

drawTextInternal crops differently based on the font mesh. This is the only reason why we need to pass the cropRegion to the renderer as a method argument. I would suggest that you cache the crop parameters in renderer.crop() and retrieve it for cropping fonts, but I don't want to push my luck. :) In any case it shouldn't hurt to do the textureMat crop change before and after calling drawText and provides consistency. Perhaps textureMat croppingBoundaries should only be set on a call to renderer.drawTexture() from cached crop values like I suggested for fonts, but now we're moving into my area of opengl ignorance.
Changing cropping regions is moderately expensive, so should be avoided when possible. Scale fit and stretch never exceed the draw region, and tiled shouldn't depending on implementation (which will change to some like the cached text system in the future). Scale fill also could be implemented without cropping. All of this is low level renderer logic though, so should be handled there.

I'm fine with the renderer managing crop region.

What does the color argument do for textures? I looked at uitexture_vert.glsl, and after reading the docs for gl_FrontColor, I still don't understand what it is supposed to do, or how to provide the equivalent in drawing an awt bitmap.
The main handling is in the fragment shader. Effectively it tints the texture - commonly it is used with greyscale textures to allow them to have any color. An example is the current text rendering, although this will be changing.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
Changing cropping regions is moderately expensive, so should be avoided when possible. Scale fit and stretch never exceed the draw region, and tiled shouldn't depending on implementation (which will change to some like the cached text system in the future). Scale fill also could be implemented without cropping. All of this is low level renderer logic though, so should be handled there.
I thought this might be the case. If the lwjgl renderer crop method just records the crop rect, and only sets it when necessary, this should provide a great improvement over the current implementation since textureMat.setFloat is currently getting called by a lot of code, but seems like it is only needed when rendering a specific kind of texture.

Effectively it tints the texture - commonly it is used with greyscale textures to allow them to have any color. An example is the current text rendering, although this will be changing.
Do you know what formula is used? texturePoint.r() * color.r(), repeated for bga, or something along those lines? Or maybe Math.max(texturePoint.r(), color.r()). Since we're not using it for anything yet (font color is handled differently in awt) it's not a big deal, but I'd like to implement it if it's something simple.
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
It is as you guess - multiplying each of the color values (represented as floats between 0 and 1).
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
It doesn't look like we have any notification when a screen is removed/closed/popped.

For zones, I need to set the blockSelection.shouldRender = false for the current zone when the screen is closed.
 
Top