¡Tengo un problema con uno de mis programas openGL!
//p>
#include "stdafx.h"
#include "handGL.h"
#include "handGLDoc.h"
#include "handGLView.h"
#include lt;math.hgt;
# ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
carácter estático THIS_FILE[] = __FILE__;
#endif p>
////////////////////////////////////////////// //// ///////////////// ////////////////
#define PI 3.14159265358979323846
GLubyte texturacontorno1[] = {
255, 255, 255, 255, 255,
255, 255, 255, 255,
255 , 255, 255, 255,
127, 127, 127,
}; //Información de textura y brillo
GLubyte contourTexture2[]={ p>
255, 255, 255, 255,
255, 127, 127, 127,
255, 127, 127,
255, 127, 127,
255, 127, 127, 127,
}; //Información de textura y luminancia
#define GETm_coord(frame, x, y ) (amp; ( m_ waveMesh.coords[frame* \m_waveMesh.numCoords (x) (y)*(m_waveMesh.m_widthX 1)])
#defineGETm_facet(frame,x,y)(amp; (m_waveMesh.facet[ marco* \m_waveMesh.numFacets (x) (y)*m_waveMesh.m_widthX]))m_widthX]))
/////////////// ///// /////////////////////////////////////// ////// //////// //////
// CHandGLView
IMPLEMENT_DYNCREATE(CHandGLView, CView)
BEGIN_MESSAGE_MAP(CHandGLView, p>
//{ {AFX_MSG_MAP(CHandGLView)
ON_WM_CREATE()
ON_WM_DESTROY()
ON_WM_SIZE()
ON_WM_TIMER()
ON_WM_ KEYDOWN()
//}}AF
X_MSG_MAP
// Comando de impresión estándar
END_MESSAGE_MAP()
//////////////////// /////////////// //////////////////////////////////// /// ///////
// Construcción/destrucción de CHandGLView
CHandGLView::CHandGLView()
{
}
void CHandGLView::Wave()
{
struct m_coord * m_coord
struct m_facet * m_facet; /p>
float * lastColor;
float * thisColor;
GLint i, j
if(m_nextFrame||!m_stepControl) p>
{
m_curFrame; //Parámetros de control de animación
}
if(m_ curFramegt;=m_waveMesh.numFrames)
{
m_curFrame=0;
}
if ((m_nextFrame||!m_stepControl)amp; amp; m_rotate)
{
m_rotateAngle =5.0f;
if(m_rotateAnglegt; 360.0f)m_rotateAngle=0.0f;
glRotatef(m_rotateAngle, 0.0f, 0.0f, 1.0 f) ;
}
m_nextFrame=0;
//Flujo de datos: reorganizar indicadores de borde pequeños
for(i=0; ilt; m_waveMesh.m_widthX; i )
{
glBegin(GL_QUAD_ STRIP);
lastColor=NULL; /p >
for(j=0;jlt;m_waveMesh.m_widthY;j)
{
! m_facet=GETm_facet(m_curFrame, i, j); //Obtiene la información sobre la faceta pequeña que está a punto de calcularse
//Se maneja la iluminación y la suavidad
if( ! m_smooth&m_lighting)
{
glNormal3fv(m_facet-gt;normal);
}
if(m_lighting) p>
{
thisColor=m_facet-gt; color;
glColor3fv(m_facet- gt; color
}
<); p>//Flujo de color, obtención de geometría de vértices, etc.
if(!lastColor||(thisColor[0]! =lastColor[0]amp;amp;m_smooth))
{
if(lastColor)
{
glEnd();
glBegin(GL_QUAD_STRIP
}
! m_coord=GETm_coord(m_curFrame,i,j);
if(m_smoothamp;amp;m_lighting)
{
glNormal3fv(m_coord-gt;normal);
}
!
glVertex3fv(m_coord-gt;vertex);
}
! !m_coord=GETm_coord(m_curFrame,i 1,j 1);
if(m_smoothamp;amp;m_lighting)
{
glNormal3fv(m_coord-gt; normal
}
glVertex3fv(m_coord-gt; vértice;
lastColor=thisColor;
glEnd();
}
}
caso'S': KeyDown_S();
caso'L'; : KeyDown_L(); romper;
case'D': KeyDown_D(); romper
case 'K': KeyDown_K(); caso 'R': KeyDown_R(); interrupción
caso 'F': interrupción KeyDown_F(); , nRepCnt, nFlags);
}
void CHandGLView::
{
//control de textura
m_contouring;
if(m_contouring==1)
{
mapa GLfloat estático [4]={0, 0, 20, 0}; /p>
glTexImage2D(GL_TEXTURE_2D, 0, 3, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (GLvoid*)contourTexture1);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR
glTexGenfv(GL_S, GL_OBJECT_PLANE, mapa);
glTexGenfv(GL_T, GL_OBJECT_PLANE, mapa);
glEnable(GL_TEXTURE_2D);
glEnable ( GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN
_T);
}
else if(m_contouring==2)
{
mapa GLfloat estático[4]={0 , 0, 20, 0};
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glPushMatrix()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();