Fixed type of GLBeginEndAdapter::MultiTexCoord*() and VertexAttrib*(), and fixed the internal offsets used in MultiTexCoord so it properly used the mapping texture_unit = target - GL_TEXTURE0
This commit is contained in:
@@ -77,41 +77,41 @@ class OSG_EXPORT GLBeginEndAdapter
|
||||
|
||||
void Normal3fv(const GLfloat* n) { Normal3f(n[0], n[1], n[2]); }
|
||||
|
||||
void TexCoord1f(GLfloat x) { MultiTexCoord4f(0, x, 0.0f, 0.0f, 1.0f); }
|
||||
void TexCoord1fv(const GLfloat* tc) { MultiTexCoord4f(0, tc[0], 0.0f, 0.0f, 1.0f); }
|
||||
void TexCoord1f(GLfloat x) { MultiTexCoord4f(GL_TEXTURE0, x, 0.0f, 0.0f, 1.0f); }
|
||||
void TexCoord1fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], 0.0f, 0.0f, 1.0f); }
|
||||
|
||||
void TexCoord2f(GLfloat x, GLfloat y) { MultiTexCoord4f(0, x, y, 0.0f, 1.0f); }
|
||||
void TexCoord2fv(const GLfloat* tc) { MultiTexCoord4f(0, tc[0], tc[1], 0.0f, 1.0f); }
|
||||
void TexCoord2f(GLfloat x, GLfloat y) { MultiTexCoord4f(GL_TEXTURE0, x, y, 0.0f, 1.0f); }
|
||||
void TexCoord2fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], tc[1], 0.0f, 1.0f); }
|
||||
|
||||
void TexCoord3f(GLfloat x, GLfloat y, GLfloat z) { MultiTexCoord4f(0, x, y, z, 1.0f); }
|
||||
void TexCoord3fv(const GLfloat* tc) { MultiTexCoord4f(0, tc[0], tc[1], tc[2], 1.0f); }
|
||||
void TexCoord3f(GLfloat x, GLfloat y, GLfloat z) { MultiTexCoord4f(GL_TEXTURE0, x, y, z, 1.0f); }
|
||||
void TexCoord3fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], tc[1], tc[2], 1.0f); }
|
||||
|
||||
void TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { MultiTexCoord4f(0, x, y, z, w); }
|
||||
void TexCoord4fv(const GLfloat* tc) { MultiTexCoord4f(0, tc[0], tc[1], tc[2], tc[3]); }
|
||||
void TexCoord4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { MultiTexCoord4f(GL_TEXTURE0, x, y, z, w); }
|
||||
void TexCoord4fv(const GLfloat* tc) { MultiTexCoord4f(GL_TEXTURE0, tc[0], tc[1], tc[2], tc[3]); }
|
||||
|
||||
void MultiTexCoord1f(unsigned int unit, GLfloat x) { MultiTexCoord4f(unit, x, 0.0f, 0.0f, 1.0f); }
|
||||
void MultiTexCoord1fv(unsigned int unit, const GLfloat* tc) { MultiTexCoord4f(unit, tc[0], 0.0f, 0.0f, 1.0f); }
|
||||
void MultiTexCoord1f(GLenum target, GLfloat x) { MultiTexCoord4f(target, x, 0.0f, 0.0f, 1.0f); }
|
||||
void MultiTexCoord1fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0], 0.0f, 0.0f, 1.0f); }
|
||||
|
||||
void MultiTexCoord2f(unsigned int unit, GLfloat x, GLfloat y) { MultiTexCoord4f(unit, x, y, 0.0f, 1.0f); }
|
||||
void MultiTexCoord2fv(unsigned int unit, const GLfloat* tc) { MultiTexCoord4f(unit, tc[0],tc[1], 0.0f, 1.0f); }
|
||||
void MultiTexCoord2f(GLenum target, GLfloat x, GLfloat y) { MultiTexCoord4f(target, x, y, 0.0f, 1.0f); }
|
||||
void MultiTexCoord2fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0],tc[1], 0.0f, 1.0f); }
|
||||
|
||||
void MultiTexCoord3f(unsigned int unit, GLfloat x, GLfloat y, GLfloat z) {MultiTexCoord4f(unit, x, y, z, 1.0f); }
|
||||
void MultiTexCoord3fv(unsigned int unit, const GLfloat* tc) { MultiTexCoord4f(unit, tc[0], tc[1], tc[2], 1.0f); }
|
||||
void MultiTexCoord3f(GLenum target, GLfloat x, GLfloat y, GLfloat z) {MultiTexCoord4f(target, x, y, z, 1.0f); }
|
||||
void MultiTexCoord3fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0], tc[1], tc[2], 1.0f); }
|
||||
|
||||
void MultiTexCoord4f(unsigned int unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void MultiTexCoord4fv(unsigned int unit, const GLfloat* tc) { MultiTexCoord4f(unit, tc[0], tc[1], tc[2], tc[3]); }
|
||||
void MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void MultiTexCoord4fv(GLenum target, const GLfloat* tc) { MultiTexCoord4f(target, tc[0], tc[1], tc[2], tc[3]); }
|
||||
|
||||
void VertexAttrib1f(unsigned int unit, GLfloat x) { VertexAttrib4f(unit, x, 0.0f, 0.0f, 0.0f); }
|
||||
void VertexAttrib1fv(unsigned int unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], 0.0f, 0.0f, 0.0f); }
|
||||
void VertexAttrib1f(GLuint unit, GLfloat x) { VertexAttrib4f(unit, x, 0.0f, 0.0f, 0.0f); }
|
||||
void VertexAttrib1fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], 0.0f, 0.0f, 0.0f); }
|
||||
|
||||
void VertexAttrib2f(unsigned int unit, GLfloat x, GLfloat y) { VertexAttrib4f(unit, x, y, 0.0f, 0.0f); }
|
||||
void VertexAttrib2fv(unsigned int unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0],tc[1], 0.0f, 0.0f); }
|
||||
void VertexAttrib2f(GLuint unit, GLfloat x, GLfloat y) { VertexAttrib4f(unit, x, y, 0.0f, 0.0f); }
|
||||
void VertexAttrib2fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0],tc[1], 0.0f, 0.0f); }
|
||||
|
||||
void VertexAttrib3f(unsigned int unit, GLfloat x, GLfloat y, GLfloat z) {VertexAttrib4f(unit, x, y, z, 0.0f); }
|
||||
void VertexAttrib3fv(unsigned int unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], tc[1], tc[2], 0.0f); }
|
||||
void VertexAttrib3f(GLuint unit, GLfloat x, GLfloat y, GLfloat z) {VertexAttrib4f(unit, x, y, z, 0.0f); }
|
||||
void VertexAttrib3fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], tc[1], tc[2], 0.0f); }
|
||||
|
||||
void VertexAttrib4f(unsigned int unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void VertexAttrib4fv(unsigned int unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], tc[1], tc[2], tc[3]); }
|
||||
void VertexAttrib4f(GLuint unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void VertexAttrib4fv(GLuint unit, const GLfloat* tc) { VertexAttrib4f(unit, tc[0], tc[1], tc[2], tc[3]); }
|
||||
|
||||
void Begin(GLenum mode);
|
||||
void End();
|
||||
|
||||
@@ -520,10 +520,10 @@ void ArrayDispatchers::assignVertexAttribDispatchers(unsigned int unit)
|
||||
{
|
||||
_vertexAttribDispatchers.push_back(new AttributeDispatchMap(_glBeginEndAdapter));
|
||||
AttributeDispatchMap& texCoordDispatcher = *_vertexAttribDispatchers[i];
|
||||
texCoordDispatcher.targetAssign<unsigned int, GLfloat>(i, Array::FloatArrayType, extensions->_glVertexAttrib1fv, 1);
|
||||
texCoordDispatcher.targetAssign<unsigned int, GLfloat>(i, Array::Vec2ArrayType, extensions->_glVertexAttrib2fv, 2);
|
||||
texCoordDispatcher.targetAssign<unsigned int, GLfloat>(i, Array::Vec3ArrayType, extensions->_glVertexAttrib3fv, 3);
|
||||
texCoordDispatcher.targetAssign<unsigned int, GLfloat>(i, Array::Vec4ArrayType, extensions->_glVertexAttrib4fv, 4);
|
||||
texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::FloatArrayType, extensions->_glVertexAttrib1fv, 1);
|
||||
texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec2ArrayType, extensions->_glVertexAttrib2fv, 2);
|
||||
texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec3ArrayType, extensions->_glVertexAttrib3fv, 3);
|
||||
texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec4ArrayType, extensions->_glVertexAttrib4fv, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,10 @@ void GLBeginEndAdapter::Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble
|
||||
_matrixStack.back().preMultRotate(Quat(DegreesToRadians(angle), Vec3d(x,y,z)));
|
||||
}
|
||||
|
||||
void GLBeginEndAdapter::MultiTexCoord4f(unsigned int unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
void GLBeginEndAdapter::MultiTexCoord4f(GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
{
|
||||
unsigned int unit = static_cast<unsigned int>(target-GL_TEXTURE0);
|
||||
|
||||
if (unit>=_texCoordAssignedList.size()) _texCoordAssignedList.resize(unit+1, false);
|
||||
if (unit>=_texCoordList.size()) _texCoordList.resize(unit+1, osg::Vec4(0.0f,0.0f,0.0f,0.0f));
|
||||
|
||||
@@ -106,7 +108,7 @@ void GLBeginEndAdapter::MultiTexCoord4f(unsigned int unit, GLfloat x, GLfloat y,
|
||||
_texCoordList[unit].set(x,y,z,w);
|
||||
}
|
||||
|
||||
void GLBeginEndAdapter::VertexAttrib4f(unsigned int unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
void GLBeginEndAdapter::VertexAttrib4f(GLuint unit, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
|
||||
{
|
||||
if (unit>=_vertexAttribAssignedList.size()) _vertexAttribAssignedList.resize(unit+1, false);
|
||||
if (unit>=_vertexAttribList.size()) _vertexAttribList.resize(unit+1, osg::Vec4(0.0f,0.0f,0.0f,0.0f));
|
||||
|
||||
Reference in New Issue
Block a user