- Timestamp:
- 01/07/07 03:53:52 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.cpp
r1945 r1949 60 60 glLoadIdentity(); 61 61 62 gluPerspective(60.0, (GLfloat)w/(GLfloat)h, 3, 5000.0);62 //gluPerspective(60.0, (GLfloat)w/(GLfloat)h, 3, 5000.0); 63 63 //gluPerspective(60.0, (GLfloat)w/(GLfloat)h, 0.5, 10.0); 64 glOrtho(-1000, 1000, -1000, 1000, 1, 1000); 64 65 } 65 66 … … 92 93 switch(key) 93 94 { 94 case ' ': 95 case '2': 96 ++ globalLinesRenderer->mMaxDepth; 97 cout << "max depth: " << globalLinesRenderer->mMaxDepth << endl; 98 return; 99 case '1': 100 -- globalLinesRenderer->mMaxDepth; 101 cout << "max depth: " << globalLinesRenderer->mMaxDepth << endl; 95 102 return; 96 103 default: … … 108 115 } 109 116 */ 110 GlobalLinesRenderer::GlobalLinesRenderer(Preprocessor *preprocessor, GlRenderer *renderer): 117 GlobalLinesRenderer::GlobalLinesRenderer(Preprocessor *preprocessor, 118 GlRenderer *renderer): 111 119 mNewBuffer(NULL), 112 120 mOldBuffer(NULL), 113 mMaxDepth( 100),121 mMaxDepth(0), 114 122 mRenderer(renderer), 115 123 mPreprocessor(preprocessor) … … 188 196 AxisAlignedBox3 bbox = globalLinesRenderer->mPreprocessor->mKdTree->GetBox(); 189 197 const Vector3 midPoint = bbox.Center(); 190 const Vector3 viewPoint = midPoint + Vector3(-800, 0, 0); 198 //const Vector3 viewPoint = midPoint + Vector3(-800, 0, 0); 199 const Vector3 viewPoint = midPoint + Vector3(2, 0, 0); 191 200 192 201 cout << "midPoint: " << midPoint << endl; … … 200 209 gluLookAt(0, 0, 3, 0, 0, 0, 0, 1, 0); 201 210 202 glDisable(GL_CULL_FACE); 211 //glDisable(GL_CULL_FACE); 212 glEnable(GL_CULL_FACE); 203 213 glDisable(GL_LIGHTING); 204 214 //glEnable(GL_COLOR_MATERIAL); … … 214 224 215 225 mNewBuffer = new RenderTexture(texWidth, texHeight, true, true); 216 mNewBuffer->Initialize(true, true, false, true, true, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE); 217 226 //mNewBuffer->Initialize(true, true, false, true, true, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE); 227 mNewBuffer->Initialize(true, true, false, true, true, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE); 228 218 229 mOldBuffer = new RenderTexture(texWidth, texHeight, true, true); 219 mOldBuffer ->Initialize(true, true, false, true, true, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE); 230 //mOldBuffer ->Initialize(true, true, false, true, true, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE); 231 mOldBuffer ->Initialize(true, true, false, true, true, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE); 220 232 221 233 // Setup Cg … … 265 277 glClearColor(0.1, 0.7, 0.2, 1); 266 278 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 267 279 280 glFrontFace(GL_CCW); 281 glCullFace(GL_BACK); 282 glEnable(GL_CULL_FACE); 283 glShadeModel(GL_FLAT); 284 glEnable(GL_DEPTH_TEST); 285 268 286 glMatrixMode(GL_MODELVIEW); 269 287 glLoadIdentity(); … … 272 290 0, 1, 0); 273 291 274 glEnable(GL_DEPTH_TEST);275 292 } 276 293 mNewBuffer->EndCapture(); … … 282 299 glMatrixMode(GL_MODELVIEW); 283 300 glLoadIdentity(); 301 302 glFrontFace(GL_CCW); 303 glCullFace(GL_BACK); 304 glEnable(GL_CULL_FACE); 305 glShadeModel(GL_FLAT); 306 glEnable(GL_DEPTH_TEST); 307 284 308 gluLookAt(viewPoint.x, viewPoint.y, viewPoint.z, 285 309 midPoint.x, midPoint.y, midPoint.z, 286 310 0, 1, 0); 287 311 288 glEnable(GL_DEPTH_TEST);289 312 glClearColor(0.6, 0.2, 0.2, 1); 290 313 } … … 326 349 mNewBuffer->EndCapture(); 327 350 328 //mNewBuffer->Bind(); 329 mNewBuffer->BindDepth(); 330 mNewBuffer->EnableTextureTarget(); 331 332 333 //glBindTexture(texture_target,texID); 334 //const int texID = mNewBuffer->GetTextureTarget(); 335 //glGetTexImage(texture_target,0,texture_format,GL_FLOAT,data); 336 /* 337 for(int l = 0; l < mMaxDepth; ++ l) 351 //mNewBuffer->BindDepth(); 352 //float data[262144]; 353 //glGetTexImage(mNewBuffer->GetTextureTarget(), 0, mNewBuffer->texture_format, GL_FLOAT, data); 354 if (mNewBuffer->IsRectangleTexture()) cout << "rect" << endl; 355 //else cout << "haga"<<endl; 356 357 for(int i = 0; i < mMaxDepth; ++ i) 338 358 { 339 359 // Peel another layer … … 348 368 349 369 cgGLBindProgram(sCgDepthPeelingProgram); 370 // cgGLBindProgram(sCgPassThroughProgram); 350 371 cgGLEnableProfile(sCgFragmentProfile); 351 372 cgGLSetTextureParameter(sTextureParam, mOldBuffer->GetDepthTextureID()); 352 373 cgGLEnableTextureParameter(sTextureParam); 353 374 354 //glColor3f(0,0.0,0.0); 355 DrawGeometry(); 375 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 376 glMatrixMode(GL_MODELVIEW); 377 glPushMatrix(); 378 { 379 //glutSolidTorus(0.25, 1, 32, 64); 380 DrawGeometry(); 381 } 382 glPopMatrix(); 383 356 384 cgGLDisableTextureParameter(sTextureParam); 385 cgGLDisableProfile(sCgFragmentProfile); 357 386 } 358 387 mNewBuffer->EndCapture(); 359 388 } 360 */ 389 390 PrintGLerror("display 1"); 391 392 //mNewBuffer->Bind(); 393 mNewBuffer->BindDepth(); 394 mNewBuffer->EnableTextureTarget(); 395 361 396 362 397 PrintGLerror("display 2"); 363 398 glColor3f(1,1,1); 364 399 glBegin(GL_QUADS); 365 glTexCoord2f(0, 0); glVertex3f(-1 , -1, -0.5f);366 glTexCoord2f(1, 0); glVertex3f( 1 , -1, -0.5f);367 glTexCoord2f(1, 1); glVertex3f( 1 , 1, -0.5f);368 glTexCoord2f(0, 1); glVertex3f(-1 , 1, -0.5f);400 glTexCoord2f(0, 0); glVertex3f(-1000, -1000, -0.5f); 401 glTexCoord2f(1, 0); glVertex3f( 1000, -1000, -0.5f); 402 glTexCoord2f(1, 1); glVertex3f( 1000, 1000, -0.5f); 403 glTexCoord2f(0, 1); glVertex3f(-1000, 1000, -0.5f); 369 404 glEnd(); 370 PrintGLerror("display 1");371 405 372 406 if (mNewBuffer->IsFloatTexture())
Note: See TracChangeset
for help on using the changeset viewer.