Project

General

Profile

Statistics
| Branch: | Revision:

root / rgbdslam / external / siftgpu / Notes on OpenGL.txt @ 9240aaa3

History | View | Annotate | Download (1.7 KB)

1
!!!! Special attention if you have your own OpenGL code !!!
2

    
3
The OpenGL-based implmentations of SiftGPU need valid OpenGL context to run properly.
4

    
5
1. If you use the same OpenGL context for SiftGPU and your own your visualization
6
	Make sure the OpenGL states are restored before calling SiftGPU. SiftGPU changes several 
7
	OpenGL internal states, including texture binding to GL_TEXTURE_RECTANGLE_ARB and current
8
	ViewPort. You might need to restore them for your own OpenGL part. To avoid this problem,
9
	you can create a seperate GL context, and activate different context for different part. 
10

    
11
	Note that GL_TEXTURE_RECTANGLE_ARB is always enabled in SiftGPU. When you have problem 
12
    displaying textures, you can try first glDisable(GL_TEXTURE_RECTANGLE_ARB) before painting, 
13
    but don't forget to call glEnable(GL_TEXTURE_RECTANGLE_ARB) after. (Thanks to Pilet)
14
	
15
2. How to create/setup an OpenGL context for SiftGPU
16

    
17
	If you choose to let SiftGPU to manage OpenGL context, you can simply do that by 
18
	SiftGPU::CreateContextGL and SiftMatchGPU::CreateContextGL.	When you mix your own OpenGL
19
	code with SiftGPU, you need to re-call CreateContextGL before calling SiftGPU functions,
20
	which will implicitly activate the internal OpenGL context. 
21
	
22
	
23
	If you choose to create openGL contexts yourself when mixing SiftGPU with other openGL 
24
	code, don't call SiftGPU::CreateContextGL or SiftMatchGPU::CreateContextGL; Instead you 
25
	should first activate your OpenGL context (WglMakeCurrent in win32), and set GL_FILL 
26
	for polygon mode, then call SiftGPU::VerifyContextGL or SiftMatchGPU::VerifyContextGL
27
    for initialization. You should also setup in the same way before calling SiftGPU functions. 
28
	
29