English 中文(简体)
开放式3.3+与光电130代码不相干?
原标题:opengl 3.3+ not compatibily with glsl 130 code?

我的胶合130码在我较为现代的硬件(ATI 5850)上取得了适当进展,而相同的代码则对配备INVIDIA卡的旧膝上型计算机完全罚款。 这里的情况是,我所使用的情况没有变化。 发生的情况是病媒:沉积、col和_对新硬件的适当约束。 似乎我被迫在新硬件上使用更新的冰川(330)。

这里是vert曲的冰川法。 它非常简单和基本。

#version 130

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
uniform mat4 normalMatrix;

in vec4 in_position;
in vec4 in_colour;
in vec3 in_normal;

out vec4 pass_colour;

smooth out vec3 vNormal;

void main()
{
   gl_Position = projectionMatrix * viewMatrix * modelMatrix * in_position;
   vec4 vRes = normalMatrix*vec4(in_normal, 0.0); 
   vNormal = vRes.xyz;
   pass_colour = in_colour;
}

实际情况是:

in vec4 in_position;
in vec4 in_colour;
in vec3 in_normal;

不受约束或不完全约束。 这些价值观被奇地扭曲。 从我的测试来看,所有其他工作都是适当的。 将版本改为330,使用地点关键词确定问题,但这也使该守则与开放式的较老的趋同不相符合。

此处是用于具体说明这些地点的准则的样本。

该方案:

glBindAttribLocation(LD_standard_program, 0, "in_position");
glBindAttribLocation(LD_standard_program, 1, "in_colour");
glBindAttribLocation(LD_standard_program, 2, "in_normal");

以后的数据本身:

--- code to buffer vertex data
glEnableVertexAttribArray(0);
glVertexAttribPointer((GLuint) 0, 4, GL_FLOAT, GL_FALSE, 0, 0);
--- code to buffer colour data
glEnableVertexAttribArray(1);
glVertexAttribPointer((GLuint) 1, 4, GL_FLOAT, GL_FALSE, 0, 0);
--- code to buffer normal data
glEnableVertexAttribArray(2);
glVertexAttribPointer((GLuint) 2, 3, GL_FLOAT, GL_FALSE, 0, 0);

我的问题是:是否应该落后? 我开始担心的是,我不得不书写一版的开张,使我的节目用不同的硬件进行。 由于这些属性具有很强的基本功能,我怀疑这在《公约》的实施中是一个ug。

问题回答

你们是否在冰川链路前 calling光。 在获得胜利后,电离效应才会产生任何效果,因为vert外特性只在冰川链路上被分配。

在GLSL 3.30+中,在GLSL代码中,可以较好地计算归属指数:

layout(location=0) in vec4 in_position;
layout(location=1) in vec4 in_colour;
layout(location=2) in vec3 in_normal;  

Edit: oh, I skipped the part Youtries programout keyword have been.





相关问题
OpenGL 3D Selection

I am trying to create a 3D robot that should perform certain actions when certain body parts are clicked. I have successfully (sort of) implemented picking in that if you click on any x-plane part, it ...

CVDisplayLink instead of NSTimer

I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note https://developer.apple.com/library/archive/qa/qa1385/_index.html Is it ...

Can the iPhone simulator handle PVR textures?

I have a really weird problem with PVR textures on the iPhone simulator- the framerate falls through the floor on the iPhone simulator, but on the iPhone itself it works just fine. Has anyone had any ...

Calculate fps (frames per second) for iphone app

I am using an opengl es iphone application. What is the most accurate way to calculate the frames per second of my application for performance tuning?

Java - Zoom / 3D Data Visualization Libraries

What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java? I d like to be able to do some prototyping of creating new types of interfaces for navigating within data and ...

FLTK in Cygwin using Eclipse (Linking errors)

I have this assignment due that requires the usage of FLTK. The code is given to us and it should compile straight off of the bat, but I am having linking errors and do not know which other libraries ...

热门标签