From: Sylvain Beucler Date: Sat, 31 Mar 2012 20:03:01 +0000 (+0000) Subject: fg_geometry: sphere: GL_UNSIGNED_INT->GL_UNSIGNED_SHORT for OpenGL ES 1.0 support X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=38af3c363f39b393fe466510f2d1c2de8cde0beb;p=freeglut fg_geometry: sphere: GL_UNSIGNED_INT->GL_UNSIGNED_SHORT for OpenGL ES 1.0 support git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1219 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/include/GL/freeglut_std.h b/include/GL/freeglut_std.h index f5b1ebf..ce0ad2a 100644 --- a/include/GL/freeglut_std.h +++ b/include/GL/freeglut_std.h @@ -528,10 +528,10 @@ FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* stri #ifndef GL_ES_VERSION_2_0 FGAPI void FGAPIENTRY glutWireCube( double size ); FGAPI void FGAPIENTRY glutSolidCube( double size ); -#endif -#ifndef EGL_VERSION_1_0 FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks ); FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks ); +#endif +#ifndef EGL_VERSION_1_0 FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks ); FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks ); #endif diff --git a/src/fg_geometry.c b/src/fg_geometry.c index 97d1534..4dbee68 100644 --- a/src/fg_geometry.c +++ b/src/fg_geometry.c @@ -823,6 +823,9 @@ static void fghSphere( double radius, GLint slices, GLint stacks, GLboolean useW int i,j,idx, nVert; GLfloat *vertices, *normals; + if (slices * stacks > 65535) + fgWarning("fghSphere: too many slices or stacks requested, indices will wrap"); + /* Generate vertices and normals */ fghGenerateSphere((GLfloat)radius,slices,stacks,&vertices,&normals,&nVert); @@ -832,19 +835,19 @@ static void fghSphere( double radius, GLint slices, GLint stacks, GLboolean useW if (useWireMode) { - GLuint *sliceIdx, *stackIdx; + GLushort *sliceIdx, *stackIdx; /* First, generate vertex index arrays for drawing with glDrawElements * We have a bunch of line_loops to draw for each stack, and a * bunch for each slice. */ - sliceIdx = malloc(slices*(stacks+1)*sizeof(GLuint)); - stackIdx = malloc(slices*(stacks-1)*sizeof(GLuint)); + sliceIdx = malloc(slices*(stacks+1)*sizeof(GLushort)); + stackIdx = malloc(slices*(stacks-1)*sizeof(GLushort)); /* generate for each stack */ for (i=0,idx=0; i