Made trunk sync with commit r11019 and commit r11020
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@11021 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
84aa234446
commit
5d02fe1c20
@ -153,6 +153,11 @@ public class OGLESShaderRenderer implements Renderer {
|
|||||||
|
|
||||||
powerVr = GLES20.glGetString(GLES20.GL_RENDERER).contains("PowerVR");
|
powerVr = GLES20.glGetString(GLES20.GL_RENDERER).contains("PowerVR");
|
||||||
|
|
||||||
|
|
||||||
|
//workaround, always assume we support GLSL100
|
||||||
|
//some cards just don't report this correctly
|
||||||
|
caps.add(Caps.GLSL100);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Fix issue in TestRenderToMemory when GL_FRONT is the main
|
// Fix issue in TestRenderToMemory when GL_FRONT is the main
|
||||||
// buffer being used.
|
// buffer being used.
|
||||||
@ -2302,7 +2307,7 @@ public class OGLESShaderRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexBuffer indices = null;
|
VertexBuffer indices;
|
||||||
if (mesh.getNumLodLevels() > 0) {
|
if (mesh.getNumLodLevels() > 0) {
|
||||||
indices = mesh.getLodLevel(lod);
|
indices = mesh.getLodLevel(lod);
|
||||||
} else {
|
} else {
|
||||||
@ -2319,7 +2324,7 @@ public class OGLESShaderRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderMeshDefault(Mesh mesh, int lod, int count) {
|
private void renderMeshDefault(Mesh mesh, int lod, int count) {
|
||||||
VertexBuffer indices = null;
|
VertexBuffer indices;
|
||||||
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
|
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
|
||||||
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
|
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
|
||||||
updateBufferData(interleavedData);
|
updateBufferData(interleavedData);
|
||||||
|
@ -893,12 +893,6 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
|||||||
// When choosing technique, we choose one that
|
// When choosing technique, we choose one that
|
||||||
// supports all the caps.
|
// supports all the caps.
|
||||||
EnumSet<Caps> rendererCaps = renderManager.getRenderer().getCaps();
|
EnumSet<Caps> rendererCaps = renderManager.getRenderer().getCaps();
|
||||||
|
|
||||||
//workaround, always assume we support GLSL100
|
|
||||||
//some cards just don't report this correctly
|
|
||||||
if( rendererCaps.contains(Caps.GLSL100) == false )
|
|
||||||
rendererCaps.add(Caps.GLSL100);
|
|
||||||
|
|
||||||
if (tech == null) {
|
if (tech == null) {
|
||||||
|
|
||||||
if (name.equals("Default")) {
|
if (name.equals("Default")) {
|
||||||
|
@ -138,6 +138,10 @@ public class JoglGL1Renderer implements GL1Renderer {
|
|||||||
gl12 = true;
|
gl12 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//workaround, always assume we support GLSL100
|
||||||
|
//some cards just don't report this correctly
|
||||||
|
caps.add(Caps.GLSL100);
|
||||||
|
|
||||||
// Default values for certain GL state.
|
// Default values for certain GL state.
|
||||||
gl.getGL2ES1().glShadeModel(GLLightingFunc.GL_SMOOTH);
|
gl.getGL2ES1().glShadeModel(GLLightingFunc.GL_SMOOTH);
|
||||||
gl.getGL2().glColorMaterial(GL.GL_FRONT_AND_BACK, GLLightingFunc.GL_DIFFUSE);
|
gl.getGL2().glColorMaterial(GL.GL_FRONT_AND_BACK, GLLightingFunc.GL_DIFFUSE);
|
||||||
@ -1136,7 +1140,7 @@ public class JoglGL1Renderer implements GL1Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderMeshDefault(Mesh mesh, int lod, int count) {
|
private void renderMeshDefault(Mesh mesh, int lod, int count) {
|
||||||
VertexBuffer indices = null;
|
VertexBuffer indices;
|
||||||
|
|
||||||
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
|
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
|
||||||
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
|
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
|
||||||
|
@ -164,6 +164,10 @@ public class JoglRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//workaround, always assume we support GLSL100
|
||||||
|
//some cards just don't report this correctly
|
||||||
|
caps.add(Caps.GLSL100);
|
||||||
|
|
||||||
String versionStr = null;
|
String versionStr = null;
|
||||||
if (caps.contains(Caps.OpenGL20) || gl.isGL2ES2()) {
|
if (caps.contains(Caps.OpenGL20) || gl.isGL2ES2()) {
|
||||||
versionStr = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION);
|
versionStr = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION);
|
||||||
|
@ -102,6 +102,10 @@ public class LwjglGL1Renderer implements GL1Renderer {
|
|||||||
gl12 = true;
|
gl12 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//workaround, always assume we support GLSL100
|
||||||
|
//some cards just don't report this correctly
|
||||||
|
caps.add(Caps.GLSL100);
|
||||||
|
|
||||||
// Default values for certain GL state.
|
// Default values for certain GL state.
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||||
@ -1077,7 +1081,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderMeshDefault(Mesh mesh, int lod, int count) {
|
private void renderMeshDefault(Mesh mesh, int lod, int count) {
|
||||||
VertexBuffer indices = null;
|
VertexBuffer indices;
|
||||||
|
|
||||||
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
|
VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
|
||||||
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
|
if (interleavedData != null && interleavedData.isUpdateNeeded()) {
|
||||||
|
@ -55,7 +55,9 @@ import com.jme3.texture.Texture;
|
|||||||
import com.jme3.texture.Texture.WrapAxis;
|
import com.jme3.texture.Texture.WrapAxis;
|
||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
import com.jme3.util.ListMap;
|
import com.jme3.util.ListMap;
|
||||||
|
import com.jme3.util.NativeObject;
|
||||||
import com.jme3.util.NativeObjectManager;
|
import com.jme3.util.NativeObjectManager;
|
||||||
|
import com.jme3.util.SafeArrayList;
|
||||||
import java.nio.*;
|
import java.nio.*;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -156,7 +158,11 @@ public class LwjglRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//workaround, always assume we support GLSL100
|
||||||
|
//some cards just don't report this correctly
|
||||||
|
caps.add(Caps.GLSL100);
|
||||||
|
|
||||||
String versionStr = null;
|
String versionStr = null;
|
||||||
if (ctxCaps.OpenGL20) {
|
if (ctxCaps.OpenGL20) {
|
||||||
versionStr = glGetString(GL_SHADING_LANGUAGE_VERSION);
|
versionStr = glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||||
@ -480,7 +486,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state.isDepthTest() && !context.depthTestEnabled) {
|
if (state.isDepthTest() && !context.depthTestEnabled) {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthFunc(convertTestFunction(context.depthFunc));
|
glDepthFunc(convertTestFunction(context.depthFunc));
|
||||||
context.depthTestEnabled = true;
|
context.depthTestEnabled = true;
|
||||||
} else if (!state.isDepthTest() && context.depthTestEnabled) {
|
} else if (!state.isDepthTest() && context.depthTestEnabled) {
|
||||||
@ -501,9 +507,9 @@ public class LwjglRenderer implements Renderer {
|
|||||||
context.alphaTestEnabled = false;
|
context.alphaTestEnabled = false;
|
||||||
}
|
}
|
||||||
if (state.getAlphaFallOff() != context.alphaTestFallOff) {
|
if (state.getAlphaFallOff() != context.alphaTestFallOff) {
|
||||||
glAlphaFunc(convertTestFunction(context.alphaFunc), context.alphaTestFallOff);
|
glAlphaFunc(convertTestFunction(context.alphaFunc), context.alphaTestFallOff);
|
||||||
context.alphaTestFallOff = state.getAlphaFallOff();
|
context.alphaTestFallOff = state.getAlphaFallOff();
|
||||||
}
|
}
|
||||||
if (state.getAlphaFunc() != context.alphaFunc) {
|
if (state.getAlphaFunc() != context.alphaFunc) {
|
||||||
glAlphaFunc(convertTestFunction(state.getAlphaFunc()), context.alphaTestFallOff);
|
glAlphaFunc(convertTestFunction(state.getAlphaFunc()), context.alphaTestFallOff);
|
||||||
context.alphaFunc = state.getAlphaFunc();
|
context.alphaFunc = state.getAlphaFunc();
|
||||||
@ -1766,7 +1772,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
if (context.pointSprite) {
|
if (context.pointSprite) {
|
||||||
return; // Attempt to fix glTexParameter crash for some ATI GPUs
|
return; // Attempt to fix glTexParameter crash for some ATI GPUs
|
||||||
}
|
}
|
||||||
|
|
||||||
// repeat modes
|
// repeat modes
|
||||||
switch (tex.getType()) {
|
switch (tex.getType()) {
|
||||||
case ThreeDimensional:
|
case ThreeDimensional:
|
||||||
@ -1787,7 +1793,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
// R to Texture compare mode
|
// R to Texture compare mode
|
||||||
if (tex.getShadowCompareMode() != Texture.ShadowCompareMode.Off) {
|
if (tex.getShadowCompareMode() != Texture.ShadowCompareMode.Off) {
|
||||||
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
|
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
|
||||||
glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY);
|
glTexParameteri(target, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY);
|
||||||
if (tex.getShadowCompareMode() == Texture.ShadowCompareMode.GreaterOrEqual) {
|
if (tex.getShadowCompareMode() == Texture.ShadowCompareMode.GreaterOrEqual) {
|
||||||
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_GEQUAL);
|
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_GEQUAL);
|
||||||
} else {
|
} else {
|
||||||
@ -1795,7 +1801,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//restoring default value
|
//restoring default value
|
||||||
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||||
}
|
}
|
||||||
tex.compareModeUpdated();
|
tex.compareModeUpdated();
|
||||||
}
|
}
|
||||||
@ -1803,7 +1809,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Uploads the given image to the GL driver.
|
* Uploads the given image to the GL driver.
|
||||||
*
|
*
|
||||||
* @param img The image to upload
|
* @param img The image to upload
|
||||||
* @param type How the data in the image argument should be interpreted.
|
* @param type How the data in the image argument should be interpreted.
|
||||||
* @param unit The texture slot to be used to upload the image, not important
|
* @param unit The texture slot to be used to upload the image, not important
|
||||||
@ -1820,7 +1826,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
statistics.onNewTexture();
|
statistics.onNewTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
// bind texture
|
// bind texture
|
||||||
int target = convertTextureType(type, img.getMultiSamples(), -1);
|
int target = convertTextureType(type, img.getMultiSamples(), -1);
|
||||||
if (context.boundTextureUnit != unit) {
|
if (context.boundTextureUnit != unit) {
|
||||||
glActiveTexture(GL_TEXTURE0 + unit);
|
glActiveTexture(GL_TEXTURE0 + unit);
|
||||||
@ -1877,7 +1883,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
throw new RendererException("Multisample textures not supported by graphics hardware");
|
throw new RendererException("Multisample textures not supported by graphics hardware");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == GL_TEXTURE_CUBE_MAP) {
|
if (target == GL_TEXTURE_CUBE_MAP) {
|
||||||
// Check max texture size before upload
|
// Check max texture size before upload
|
||||||
if (img.getWidth() > maxCubeTexSize || img.getHeight() > maxCubeTexSize) {
|
if (img.getWidth() > maxCubeTexSize || img.getHeight() > maxCubeTexSize) {
|
||||||
@ -1903,12 +1909,12 @@ public class LwjglRenderer implements Renderer {
|
|||||||
if (!caps.contains(Caps.TextureArray)) {
|
if (!caps.contains(Caps.TextureArray)) {
|
||||||
throw new RendererException("Texture arrays not supported by graphics hardware");
|
throw new RendererException("Texture arrays not supported by graphics hardware");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ByteBuffer> data = img.getData();
|
List<ByteBuffer> data = img.getData();
|
||||||
|
|
||||||
// -1 index specifies prepare data for 2D Array
|
// -1 index specifies prepare data for 2D Array
|
||||||
TextureUtil.uploadTexture(img, target, -1, 0);
|
TextureUtil.uploadTexture(img, target, -1, 0);
|
||||||
|
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
// upload each slice of 2D array in turn
|
// upload each slice of 2D array in turn
|
||||||
// this time with the appropriate index
|
// this time with the appropriate index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user