我无法在任何项目中使用代码块来使用GLFW进行深度测试,甚至在启动新项目时使用codeblocks提供的默认模板,如下所示。
我非常感谢任何帮助,因为我知道我必须做错事但我找不到它。
#include <GL/glfw.h>
int main()
{
int width, height;
int frame = 0;
bool running = true;
glfwInit();
if( !glfwOpenWindow( 512, 512, 0, 0, 0, 0, 0, 0, GLFW_WINDOW ) )
{
glfwTerminate();
return 0;
}
glfwSetWindowTitle("GLFW Application");
glEnable(GL_DEPTH_TEST);
while(running)
{
frame++;
glfwGetWindowSize( &width, &height );
height = height > 0 ? height : 1;
glViewport( 0, 0, width, height );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 65.0f, (GLfloat)width/(GLfloat)height, 1.0f, 100.0f );
// Draw some rotating garbage
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
gluLookAt(0.0f, -10.0f, 0.0f,
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f );
//glTranslatef( 1.0f, 1.0f, 0.0f );
glRotatef(frame, 0.25f, 1.0f, 0.75f);
glBegin( GL_TRIANGLES );
glColor3f(0.1f, 0.0f, 0.0f );
glVertex3f(0.0f, 3.0f, -4.0f);
glColor3f(0.0f, 1.0f, 0.0f );
glVertex3f(3.0f, -2.0f, -4.0f);
glColor3f(0.0f, 0.0f, 1.0f );
glVertex3f(-3.0f, -2.0f, -4.0f);
glEnd();
glBegin( GL_TRIANGLES );
glColor3f(0.0f, 0.1f, 0.0f );
glVertex3f(0.0f, 3.0f, -3.0f);
glColor3f(0.0f, 0.0f, 1.0f );
glVertex3f(3.0f, -2.0f, -2.0f);
glColor3f(1.0f, 0.0f, 0.0f );
glVertex3f(-3.0f, -2.0f, 2.0f);
glEnd();
glfwSwapBuffers();
// exit if ESC was pressed or window was closed
running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam( GLFW_OPENED);
}
glfwTerminate();
return 0;
}
答案 0 :(得分:0)
来自GLFW2 documentation(强调我的):
public function ViewSponsorInfo($sponsor_id) { $id = $sponsor_id; $user_id = User::where('id','=',$id)->get(); $user_roles = []; foreach ($user_id as $id) { array_push($user_roles, $id->role); }/* dd($user_roles);*/ if ($user_roles == 3) { $orga = Organization::where('orga_id','=',$sponsor_id)->get(); dd($orga); return view('pages.Ngo.View-Sponsor-Information',compact('orga')); }else{ $indi = Individual::where('indi_id','=',$sponsor_id)->get(); dd($indi); return view('pages.Ngo.View-Sponsor-Information',compact('indi')); } }
depthbits :用于深度缓冲区的位数(0表示无深度缓冲区)。
你的代码:
int glfwOpenWindow
(
int width, int height,
int redbits, int greenbits, int bluebits,
int alphabits,
int depthbits,
int stencilbits,
int mode
)
你不能(有用)使用没有任何深度位的深度缓冲区。