implement setter for texture coord 2 (u,v) vertex attribute so it can be used by FreeGLUT

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1570 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-04-01 12:01:17 +00:00
parent 1af0007c38
commit 67cd64fd7a
7 changed files with 23 additions and 4 deletions

View File

@ -239,6 +239,7 @@ FGAPI void FGAPIENTRY glutInitWarningFunc( void (* callback)( const char *fmt
/* OpenGL >= 2.0 support */ /* OpenGL >= 2.0 support */
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib); FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib); FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
FGAPI void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib);
/* Mobile platforms lifecycle */ /* Mobile platforms lifecycle */
FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)()); FGAPI void FGAPIENTRY glutInitContextFunc(void (* callback)());

View File

@ -205,6 +205,9 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
CHECK_NAME(glutInitContextFunc) CHECK_NAME(glutInitContextFunc)
CHECK_NAME(glutPauseFunc) CHECK_NAME(glutPauseFunc)
CHECK_NAME(glutResumeFunc) CHECK_NAME(glutResumeFunc)
CHECK_NAME(glutSetVertexAttribCoord3)
CHECK_NAME(glutSetVertexAttribNormal)
CHECK_NAME(glutSetVertexAttribTexCoord2)
#undef CHECK_NAME #undef CHECK_NAME
return NULL; return NULL;

View File

@ -186,7 +186,7 @@ void fghDrawGeometrySolid(GLfloat *vertices, GLfloat *normals, GLfloat *textcs,
{ {
GLint attribute_v_coord = fgStructure.CurrentWindow->Window.attribute_v_coord; GLint attribute_v_coord = fgStructure.CurrentWindow->Window.attribute_v_coord;
GLint attribute_v_normal = fgStructure.CurrentWindow->Window.attribute_v_normal; GLint attribute_v_normal = fgStructure.CurrentWindow->Window.attribute_v_normal;
GLint attribute_v_texture = -1; // TODO!!! GLint attribute_v_texture = fgStructure.CurrentWindow->Window.attribute_v_texture;
if (fgStructure.CurrentWindow->State.VisualizeNormals) if (fgStructure.CurrentWindow->State.VisualizeNormals)
/* generate normals for each vertex to be drawn as well */ /* generate normals for each vertex to be drawn as well */

View File

@ -37,6 +37,11 @@ void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib) {
fgStructure.CurrentWindow->Window.attribute_v_normal = attrib; fgStructure.CurrentWindow->Window.attribute_v_normal = attrib;
} }
void FGAPIENTRY glutSetVertexAttribTexCoord2(GLint attrib) {
if (fgStructure.CurrentWindow != NULL)
fgStructure.CurrentWindow->Window.attribute_v_texture = attrib;
}
void fgInitGL2() { void fgInitGL2() {
#ifndef GL_ES_VERSION_2_0 #ifndef GL_ES_VERSION_2_0
fgState.HasOpenGL20 = 0; fgState.HasOpenGL20 = 0;

View File

@ -371,8 +371,14 @@ struct tagSFG_Context
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */ SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
int DoubleBuffered; /* Treat the window as double-buffered */ int DoubleBuffered; /* Treat the window as double-buffered */
/* When drawing geometry to vertex attribute buffers, user specifies
* the attribute indices for vertices, normals and/or texture coords
* to freeglut. Those are stored here
*/
GLint attribute_v_coord; GLint attribute_v_coord;
GLint attribute_v_normal; GLint attribute_v_normal;
GLint attribute_v_texture;
}; };

View File

@ -148,6 +148,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
#endif #endif
window->Window.attribute_v_coord = -1; window->Window.attribute_v_coord = -1;
window->Window.attribute_v_normal = -1; window->Window.attribute_v_normal = -1;
window->Window.attribute_v_texture = -1;
fgInitGL2(); fgInitGL2();

View File

@ -160,3 +160,6 @@ EXPORTS
glutInitContextFunc glutInitContextFunc
glutPauseFunc glutPauseFunc
glutResumeFunc glutResumeFunc
glutSetVertexAttribCoord3
glutSetVertexAttribNormal
glutSetVertexAttribTexCoord2