OpenGL 2.0: add 2 user-defined, per-context vertex attributes for coordinates and normals (e.g. for use in fg_geometry)
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1221 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
63ca031e62
commit
ba5e48ebcb
@ -226,6 +226,11 @@ FGAPI void FGAPIENTRY glutInitContextProfile( int profile );
|
||||
FGAPI void FGAPIENTRY glutInitErrorFunc( void (* vError)( const char *fmt, va_list ap ) );
|
||||
FGAPI void FGAPIENTRY glutInitWarningFunc( void (* vWarning)( const char *fmt, va_list ap ) );
|
||||
|
||||
/* OpenGL >= 2.0 support */
|
||||
FGAPI void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib);
|
||||
FGAPI void FGAPIENTRY glutSetVertexAttribNormal(GLint attrib);
|
||||
|
||||
|
||||
/*
|
||||
* GLUT API macro definitions -- the display mode definitions
|
||||
*/
|
||||
|
@ -27,6 +27,16 @@
|
||||
#include "fg_internal.h"
|
||||
#include "fg_gl2.h"
|
||||
|
||||
void glutSetVertexAttribCoord3(GLint attrib) {
|
||||
if (fgStructure.CurrentWindow != NULL)
|
||||
fgStructure.CurrentWindow->Window.attribute_v_coord = attrib;
|
||||
}
|
||||
|
||||
void glutSetVertexAttribNormal(GLint attrib) {
|
||||
if (fgStructure.CurrentWindow != NULL)
|
||||
fgStructure.CurrentWindow->Window.attribute_v_normal = attrib;
|
||||
}
|
||||
|
||||
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (APIENTRY *PFNGLBUFFERDATAPROC) (GLenum target, fghGLsizeiptr size, const GLvoid *data, GLenum usage);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#ifndef APIENTRY
|
||||
# define APIENTRY
|
||||
#endif
|
||||
|
||||
typedef ptrdiff_t fghGLsizeiptr;
|
||||
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||
|
@ -319,8 +319,8 @@ struct tagSFG_State
|
||||
int MajorVersion; /* Major OpenGL context version */
|
||||
int MinorVersion; /* Minor OpenGL context version */
|
||||
int ContextFlags; /* OpenGL context flags */
|
||||
int HasOpenGL20; /* fgInitGL2 could find all OpenGL 2.0 functions */
|
||||
int ContextProfile; /* OpenGL context profile */
|
||||
int HasOpenGL20; /* fgInitGL2 could find all OpenGL 2.0 functions */
|
||||
FGError ErrorFunc; /* User defined error handler */
|
||||
FGWarning WarningFunc; /* User defined warning handler */
|
||||
};
|
||||
@ -361,6 +361,8 @@ struct tagSFG_Context
|
||||
SFG_PlatformContext pContext; /* The window's FBConfig (X11) or device context (Windows) */
|
||||
|
||||
int DoubleBuffered; /* Treat the window as double-buffered */
|
||||
GLint attribute_v_coord;
|
||||
GLint attribute_v_normal;
|
||||
};
|
||||
|
||||
|
||||
|
@ -145,6 +145,8 @@ void fgOpenWindow( SFG_Window* window, const char* title,
|
||||
glReadBuffer ( GL_FRONT );
|
||||
}
|
||||
#endif
|
||||
window->Window.attribute_v_coord = -1;
|
||||
window->Window.attribute_v_normal = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user