- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在一个带有分块系统的 block 世界上工作,我遇到了一个 VBO 的错误。我的立方体世界似乎会生成随机顶点,但仅限于 Radeon HD 6670。我现在想知道这是否是我的代码、LWJGL、OpenGL、6670 或其驱动程序出现问题,如果这是我可以自己修复的问题.我有一些屏幕截图,但没有一个能正常工作。我在装有 NVidia 卡的笔记本电脑上对其进行了测试,它运行得非常好,我目前正在尝试在 Intel HD 3000 上对其进行测试。谁能告诉我我可能做错了什么?它应该生成一个覆盖 16 * 16 * 16 立方体网格的正方形面。
编辑:它似乎也不适用于 HD 3000,但在 Nvidia 卡上一切正常。
以下是屏幕截图:http://imgur.com/a/Q30Y3
下面是创建 VBO 并呈现它的代码:
private void updateChunkVertexArray()
{
thisVertices.clear();
GL15.glDeleteBuffers(thisVBOID);
GL15.glDeleteBuffers(thisTexID);
FloatBuffer bufferedTex = BufferUtils
.createFloatBuffer(buffer.size() * 8 * 6);
thisTexID = VBOHandler.createVBO();
thisVBOID = VBOHandler.createVBO();
for (int i = 0; i < buffer.size(); i++)
{
Vector4f thisVec = buffer.get(i);
float x = (thisVec.getX() + offsetX);
float y = (thisVec.getY() + offsetY);
float z = (thisVec.getZ() + offsetZ);
float posx = 1.0f * size + x * 0.25f;
float posy = 1.0f * size + y * 0.25f;
float posz = 1.0f * size + z * 0.25f;
float negx = -1.0f * size + x * 0.25f;
float negy = -1.0f * size + y * 0.25f;
float negz = -1.0f * size + z * 0.25f;
if (world.getBlock(x, y, z + 1f) == 0)
{
bufferedTex.put(texCoords);
float[ ] frontFace =
{
// Front Face
negx, negy, posz, // Bottom Left
posx, negy, posz, // Bottom Right
posx, posy, posz, // Top Right Of
negx, posy, posz
};
for (int t = 0; t < frontFace.length; t++)
{
thisVertices.add(Float.valueOf(frontFace[t]));
}
//bufferedVertices.put(frontFace);
}
if (world.getBlock(x, y, z - 1f) == 0)
{
bufferedTex.put(texCoords);
float[ ] backFace =
{
// Back Face
negx, negy, negz, // Bottom Left
negx, posy, negz, // Bottom Right
posx, posy, negz, // Top Right Of
posx, negy, negz
};
for (int t = 0; t < backFace.length; t++)
{
thisVertices.add(Float.valueOf(backFace[t]));
}
//bufferedVertices.put(backFace);
}
if (world.getBlock(x, y + 1f, z) == 0)
{
bufferedTex.put(texCoords);
float[ ] topFace =
{
// Top Face
negx, posy, negz, // Bottom Left
negx, posy, posz, // Bottom Right
posx, posy, posz, // Top Right Of
posx, posy, negz
};
for (int t = 0; t < topFace.length; t++)
{
thisVertices.add(Float.valueOf(topFace[t]));
}
//bufferedVertices.put(topFace);
}
if (world.getBlock(x, y - 1f, z) == 0)
{
bufferedTex.put(texCoords);
float[ ] bottomFace =
{
// Bottom Face
negx, negy, negz, // Bottom Left
posx, negy, negz, // Bottom Right
posx, negy, posz, // Top Right Of
negx, negy, posz
};
for (int t = 0; t < bottomFace.length; t++)
{
thisVertices.add(Float.valueOf(bottomFace[t]));
}
//bufferedVertices.put(bottomFace);
}
if (world.getBlock(x + 1f, y, z) == 0)
{
bufferedTex.put(texCoords);
float[ ] rightFace =
{
// right Face
posx, negy, negz, // Bottom Left
posx, posy, negz, // Bottom Right
posx, posy, posz, // Top Right Of
posx, negy, posz
};
for (int t = 0; t < rightFace.length; t++)
{
thisVertices.add(Float.valueOf(rightFace[t]));
}
//bufferedVertices.put(rightFace);
}
if (world.getBlock(x - 1f, y, z) == 0)
{
bufferedTex.put(texCoords);
float[ ] leftFace =
{
// left Face
negx, negy, negz, // Bottom Left
negx, negy, posz, // Bottom Right
negx, posy, posz, // Top Right Of
negx, posy, negz
};
for (int t = 0; t < leftFace.length; t++)
{
thisVertices.add(Float.valueOf(leftFace[t]));
}
//bufferedVertices.put(leftFace);
}
}
float[ ] tempVertices = new float[thisVertices.size()];
for (int i = 0; i < thisVertices.size(); i++)
{
Float f = thisVertices.get(i);
tempVertices[i] = Float.valueOf(f);
}
FloatBuffer bufferedVertices = BufferUtils
.createFloatBuffer(thisVertices.size());
bufferedVertices.put(tempVertices);
bufferedVertices.flip();
bufferedTex.flip();
VBOHandler.bufferData(thisVBOID, bufferedVertices);
VBOHandler.bufferData(thisTexID, bufferedTex);
//And now the rendering code...
public void renderChunk()
{
//GL11.glCallList(chunkDisplayList);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, thisVBOID);
GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, thisTexID);
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
GL11.glDrawArrays(GL11.GL_QUADS, 0, thisVertices.size());
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); // deactivate vertex array
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
// bind with 0 for normal pointers
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
}
最佳答案
您的显卡未正确安装。这发生在我身上很多次。我把我的卡拿出来放回去,然后一切正常。 :)
关于java - LWJGL VBO 在 Radeon HD 6670 上生成看似随机的顶点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17007046/
我在深度测试方面遇到了一个非常奇怪的问题。我在 Windows 上的 OpenGL 3.3 核心配置文件上下文中渲染一个简单的网格,启用深度测试并将 glDepthFunc 设置为 GL_LESS。在
我正计划深入研究 OpenCL,并且一直在阅读(仅是表面知识)OpenCL 可以做什么,但有几个问题。 假设我有一台 AMD Radeon 7750,我有另一台配备 AMD Radeon 5870 的
我正计划深入研究 OpenCL,并且一直在阅读(仅是表面知识)OpenCL 可以做什么,但有几个问题。 假设我有一台 AMD Radeon 7750,我有另一台配备 AMD Radeon 5870 的
当我尝试使用 CopyResource 命令将渲染的纹理复制到背景纹理中供以后使用时,我得到了奇怪的结果。这是什么结果: 我没有收到任何 dx11 警告或错误。这也只会在使用 ATI Radeon 卡
由于 Pytorch 发布了 ROCm 版本,这使我能够使用 nvidias 以外的其他 gpu,我如何在 python 中选择我的 radeon gpu 作为设备?显然,像 device = tor
我最近购买了配备 Radeon 445 GPU 的 2016 年末 MacBook Pro,但现在我遇到了内核功能问题,而这些内核功能在 iOS 和 El Capitan 上都运行良好,配备了 Nvi
Radeon 即将发布带有 DisplayPort 的视频卡。我需要做的不是使用主机内存 (RAM),而是想读取从 Pegasus R6(直接连接 RAID 设备)直接传输到视频卡的数据。也许在主机上
我正在尝试编译 dolphin ,任天堂模拟器。我下载了主干,它编译得很好,但它不会链接。相反,我收到此错误: Linking CXX shared library ../../../Binaries
我想用我的显卡做计算,因为 CPU 等太慢了。我知道使用 NVidia 卡(CUDA 等)是可能的,但我找不到任何关于在我的笔记本电脑中使用 ATI Mobility Radeon HD 5850 显
在我的应用程序中,我显示了所有可用的 OpenCL 设备,以便用户可以选择他想要执行计算的设备。我在笔记本电脑上得到的结果让我感到困惑。 以下是产生这些结果的代码的摘录: //CL_DEVICE_TY
我在一个带有分块系统的 block 世界上工作,我遇到了一个 VBO 的错误。我的立方体世界似乎会生成随机顶点,但仅限于 Radeon HD 6670。我现在想知道这是否是我的代码、LWJGL、Ope
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我想在 MacBook Pro 的 docker 容器内运行支持 GPU 的应用程序 (Gazebo)。 通过我的研究,在我看来,大约一年前,Docker 发布了一个适用于 MacOS 的原生 Doc
我是一名优秀的程序员,十分优秀!