本文整理汇总了Java中com.badlogic.gdx.graphics.glutils.ShaderProgram.getLog方法的典型用法代码示例。如果您正苦于以下问题:Java ShaderProgram.getLog方法的具体用法?Java ShaderProgram.getLog怎么用?Java ShaderProgram.getLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.glutils.ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram.getLog方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CompliantBatch
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/** Constructs a CompliantQuadBatch with a specified capacity and optional default shader.
* @param maxVertices The number of vertices this FlexBatch can batch at once. Maximum of 32767.
* @param generateDefaultShader Whether a default shader should be created. The default shader is owned by the
* CompliantQuadBatch, so it is disposed when the CompliantQuadBatch is disposed. If an alternate shader has been
* applied with {@link #setShader(ShaderProgram)}, the default can be used again by setting the shader to null.
* @param supportPolygons Whether Poly2Ds are supported for drawing. The FlexBatch will not be optimized for
* FixedSizeBatchables. */
public CompliantBatch (Class<T> batchableType, int maxVertices, boolean generateDefaultShader, boolean supportPolygons) {
super(batchableType, maxVertices, supportPolygons ? maxVertices * 2 : 0);
try {
tmp = batchableType.newInstance();
} catch (Exception e) {
throw new IllegalArgumentException("Batchable classes must be public and have an empty constructor.", e);
}
if (generateDefaultShader) {
defaultShader = new ShaderProgram(BatchablePreparation.generateGenericVertexShader(1),
BatchablePreparation.generateGenericFragmentShader(1));
if (defaultShader.isCompiled() == false)
throw new IllegalArgumentException("Error compiling shader: " + defaultShader.getLog());
setShader(defaultShader);
} else {
defaultShader = null;
}
}
示例2: RenderSystem
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public RenderSystem(DecalBatch decalBatch, AssetManager assetManager, float worldDegree, Assets.LevelAssets assets) {
super(Aspect.all(RenderComponent.class, PositionComponent.class));
this.levelAssets = assets;
decalMap = new ObjectMap<>();
uiMap = new ObjectMap<>();
this.decalBatch = decalBatch;
this.assetManager = assetManager;
buffers = new ObjectMap<>();
this.spriteBatch = new SpriteBatch();
this.font = assets.uifont;
font.setColor(Color.BLACK);
this.uiCamera = new OrthographicCamera();
Viewport viewportUi = new FitViewport(levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), uiCamera);
viewportUi.update(viewportUi.getScreenWidth(), viewportUi.getScreenHeight(), true);
stateTime = 0;
this.worldDegree = worldDegree;
gradientShader = new ShaderProgram(Shaders.GradientShader.vertexShader, Shaders.GradientShader.fragmentShader);
if (gradientShader.isCompiled() == false)
throw new IllegalArgumentException("couldn't compile shader: " + gradientShader.getLog());
shaderBatch = new SpriteBatch(10, gradientShader);
}
示例3: init
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void init() {
loadReflection("rnl_phong_m00");
String vert = Gdx.files.internal("Shaders/VS_ShaderPlain.vsh").readString();
String frag = Gdx.files.internal("Shaders/ShaderPlain.fsh").readString();
program = new ShaderProgram(vert, frag);
if (!program.isCompiled()){
throw new GdxRuntimeException(program.getLog());
}
u_worldTrans = program.getUniformLocation("u_worldTrans");
u_projTrans = program.getUniformLocation("u_projTrans");
vLight0 = program.getUniformLocation("vLight0");
albedo = program.getUniformLocation("albedo");
metallic = program.getUniformLocation("metallic");
sCubemapTexture = program.getUniformLocation("sCubemapTexture");
vRoughness = program.getUniformLocation("vRoughness");
ambientOcclusion = program.getUniformLocation("ambientOcclusion");
}
示例4: init
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void init() {
loadReflection("rnl_phong_m00");
String vert = Gdx.files.internal("Shaders/VS_PBR_ShaderTexture.vsh").readString();
String frag = Gdx.files.internal("Shaders/PBR_ShaderTexture.fsh").readString();
program = new ShaderProgram(vert, frag);
if (!program.isCompiled()){
throw new GdxRuntimeException(program.getLog());
}
u_worldTrans = program.getUniformLocation("u_worldTrans");
u_projTrans = program.getUniformLocation("u_projTrans");
vLight0 = program.getUniformLocation("vLight0");
albedoTexture = program.getUniformLocation("albedoTexture");
metallicTexture = program.getUniformLocation("metallicTexture");
sCubemapTexture = program.getUniformLocation("sCubemapTexture");
roughnessTexture = program.getUniformLocation("roughnessTexture");
ambientOcclusionTexture = program.getUniformLocation("ambientOcclusionTexture");
normalTexture = program.getUniformLocation("normalTexture");
heightTexture = program.getUniformLocation("heightTexture");
}
示例5: createShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
* Compiles a new instance of the default shader for this batch and returns it. If compilation
* was unsuccessful, GdxRuntimeException will be thrown.
* @return the default shader
*/
public static ShaderProgram createShader(String vert, String frag) {
ShaderProgram prog = new ShaderProgram(vert, frag);
if (!prog.isCompiled())
throw new GdxRuntimeException("could not compile shader: " + prog.getLog());
if (prog.getLog().length() != 0)
Gdx.app.log("com.mygdx.pmd.desktop.GpuShadows", prog.getLog());
return prog;
}
示例6: createDefaultShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/** Returns a new instance of the default shader used by SpriteBatch for GL2 when no shader is specified. */
static public ShaderProgram createDefaultShader () {
String vertexShader = "attribute vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
+ "attribute vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
+ "attribute vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
+ "uniform mat4 u_projTrans;\n" //
+ "varying vec4 v_color;\n" //
+ "varying vec2 v_texCoords;\n" //
+ "\n" //
+ "void main()\n" //
+ "{\n" //
+ " v_color = " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
+ " v_color.a = v_color.a * (255.0/254.0);\n" //
+ " v_texCoords = " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
+ " gl_Position = u_projTrans * " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
+ "}\n";
String fragmentShader = "#ifdef GL_ES\n" //
+ "#define LOWP lowp\n" //
+ "precision mediump float;\n" //
+ "#else\n" //
+ "#define LOWP \n" //
+ "#endif\n" //
+ "varying LOWP vec4 v_color;\n" //
+ "varying vec2 v_texCoords;\n" //
+ "uniform sampler2D u_texture;\n" //
+ "void main()\n"//
+ "{\n" //
+ " gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" //
+ "}";
ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
if (shader.isCompiled() == false) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
return shader;
}
示例7: create
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
@Override
public void create () {
loadHighScore();
stage = new Stage();
group = new WidgetGroup();
stage.addActor(group);
createToolTip();
createResetButton();
createUndoButton();
batch = new SpriteBatch();
polyBatch = new PolygonSpriteBatch();
HexagonalGridBuilder<TileData> builder = new HexagonalGridBuilder<TileData>()
.setGridHeight(GRID_WIDTH)
.setGridWidth(GRID_HEIGHT)
.setGridLayout(HexagonalGridLayout.HEXAGONAL)
.setOrientation(HexagonOrientation.FLAT_TOP)
.setRadius(Gdx.graphics.getWidth()/16);
grid = builder.build();
initHexData();
initInput();
shapeRenderer = new ShapeRenderer();
shapeRenderer.setAutoShapeType(true);
AssetLoader.load();
String vertexShader = Gdx.files.internal("defaultvertex.vs").readString();
String redShader = Gdx.files.internal("redtrans.fs").readString();
invalidPlacement = new ShaderProgram(vertexShader, redShader);
if (!invalidPlacement.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + invalidPlacement.getLog());
String okShader = Gdx.files.internal("slightlytrans.fs").readString();
okPlacement = new ShaderProgram(vertexShader, okShader);
if (!okPlacement.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + okPlacement.getLog());
initGrid();
menuTextures = new ArrayList<>();
menuTextures.add(AssetLoader.assetManager.get("farm.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("house.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("mine.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("wind.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("factory.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("market.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("bank.png", Texture.class));
menuTextures.add(AssetLoader.assetManager.get("rocket.png", Texture.class));
for(int i = 0; i < START_CLOUDS_COUNT; i++)
{
Coord c = new Coord();
c.x = r.nextInt() % Gdx.graphics.getWidth();
c.y = r.nextInt() % Gdx.graphics.getHeight();
clouds.add(c);
}
}
示例8: LevelSelectScreen
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
public LevelSelectScreen(final Hexpert hexpert)
{
super();
this.totalLevels = hexpert.levelIndex.size();
this.hexpert = hexpert;
this.batch = new SpriteBatch();
this.displayBatch = new SpriteBatch();
this.displayLevelCamera = new OrthographicCamera(Const.WIDTH, Const.HEIGHT);
this.shapeRenderer = new ShapeRenderer();
shapeRenderer.setAutoShapeType(true);
this.objectiveTable = new Table();
objectiveTable.setX(100);
objectiveTable.setY(850);
objectiveTable.defaults().pad(20);
getStage().addActor(objectiveTable);
goalCompleteCount = getGoalCompleteCount();
String vertexShader = Gdx.files.internal("shaders/defaultvertex.vs").readString();
String darkShader = Gdx.files.internal("shaders/darkness.fs").readString();
String lockedShader = Gdx.files.internal("shaders/locked.fs").readString();
shdDark = new ShaderProgram(vertexShader, darkShader);
shdLckd = new ShaderProgram(vertexShader, lockedShader);
if (!shdDark.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + shdDark.getLog());
if (!shdLckd.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + shdLckd.getLog());
getCamera().translate(450, 415);
getCamera().update();
createLevelSelectGrid();
statsTable = new Table();
statsTable.defaults().width(192).height(192);
ImageButton btnGoldHex = new ImageButton(
new TextureRegionDrawable(new TextureRegion((Texture)hexpert.assetManager.get(TextureData.TEXTURE_CORRECT))));
ImageButton btnAchievements = new ImageButton(
new TextureRegionDrawable(new TextureRegion((Texture)hexpert.assetManager.get(TextureData.TEXTURE_ACHIEVEMENTS))));
btnAchievements.addListener(new ClickListener()
{
@Override
public void clicked(InputEvent event, float x, float y) {
if(!hexpert.playServices.isSignedIn())
hexpert.playServices.signIn();
hexpert.playServices.showAchievementsUI();
}
});
lblHexCount = new Label(String.format("x%d", goalCompleteCount), hexpert.getSkin());
statsTable.add(btnGoldHex).width(100).height(100);
statsTable.add(lblHexCount).width(80);
statsTable.add(btnAchievements);
statsTable.row();
lblHighScore = new Label("", hexpert.getSkin());
statsTable.add(lblHighScore).colspan(3);
btnGoldHex.getImageCell().expand().fill();
btnAchievements.getImageCell().expand().fill();
statsTable.setX(1650);
statsTable.setY(885);
getStage().addActor(statsTable);
}
示例9: setGLProgram
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
* Sets the shader program for this node
*
* Since v2.0, each rendering node must set its shader program.
* It should be set in initialize phase.
*
* @param shaderProgram The shader program
*/
public void setGLProgram(ShaderProgram glprogram) {
if (glprogram.isCompiled() == false) {
throw new IllegalArgumentException("Error compiling shader: " + glprogram.getLog());
}
_shaderProgram = glprogram;
}
示例10: compileShader
import com.badlogic.gdx.graphics.glutils.ShaderProgram; //导入方法依赖的package包/类
/**
* Create a shader program from two Strings containing the code for the vertex and fragment shaders
*
* @param vertex - the code of the vertex shader
* @param fragment - the code of the fragment shader
*
* @return a compiled ShaderProgram
*
* @throws IllegalArgumentException if the shader failed to compile
*/
public static ShaderProgram compileShader(String vertex, String fragment) {
ShaderProgram shader = new ShaderProgram(vertex, fragment);
if (!shader.isCompiled()) throw new IllegalArgumentException("Error compiling shader: " + shader.getLog());
return shader;
}