Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glew and Geforce8800GTS

  1. #1
    Intern Contributor
    Join Date
    May 2007
    Posts
    53

    glew and Geforce8800GTS

    My display card is 8800GTS,why not supported GL_EXT_texture_array and GL_NV_gpu_program4,and when i used glEnable(GL_TEXTURE_2D_ARRAY_EXT),it return invalid enum
    thanks!

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,655

    Re: glew and Geforce8800GTS

    Did you installed proper Nvidia forceware drivers ?
    Did you installed properly glew ?

  3. #3
    Intern Contributor
    Join Date
    May 2007
    Posts
    53

    Re: glew and Geforce8800GTS

    Yes,I installed the newest forceware driver and glew 1.4(the newest too)

  4. #4
    Intern Contributor
    Join Date
    May 2007
    Posts
    53

    Re: glew and Geforce8800GTS

    but when i used some geometry shader,it can run as good state.
    this`s my program code,compiled and linked successful and can run at some time.
    Code :
    #include<stdlib.h>
    #include<stdio.h>
    #include<assert.h>
    #ifdef __APPLE__
    #include<GLEW/glew.h>
    #include<GLUT/glut.h>
    #else
    #include<GL/glew.h>
    #include<GL/glut.h>
    #endif
    #include<IL/il.h>
    #include<UDH/asmshader.h>
    #include<UDH/shaderPath.h>
    #include<UDH/layertex.h>
    #include<UDH/GLvector.h>
    #include<UDH/checkfbo.h>
    #include<UDH/redef.h>
     
    #pragma comment(lib,"glew32.lib")
    #pragma comment(lib,"DevIL.lib")
    #pragma comment(lib,"GLvector.lib")
     
    static layerTexture* layerNode;
    const char* srcVP=ASM_PROC_PATH_VP"layerRender.vp";
    const char* srcGP=ASM_PROC_PATH_GP"layerRender.gp";
    const char* srcFP=ASM_PROC_PATH_FP"layerRender.fp";
    /*const GLfloat4 colorArray[4][8]={
    	GLfloat4(0.15,0.55,0.80,1.00),\
    	GLfloat4(0.15,0.55,0.80,1.00),\
    	GLfloat4(0.15,0.55,0.80,1.00),\
    	GLfloat4(0.15,0.55,0.80,1.00),\
        GLfloat4(0.25,0.65,0.70,1.00),\
        GLfloat4(0.25,0.65,0.70,1.00),\
        GLfloat4(0.25,0.65,0.70,1.00),\
        GLfloat4(0.25,0.65,0.70,1.00),\
        GLfloat4(0.35,0.75,0.60,1.00),\
        GLfloat4(0.35,0.75,0.60,1.00),\
        GLfloat4(0.35,0.75,0.60,1.00),\
        GLfloat4(0.35,0.75,0.60,1.00),\
        GLfloat4(0.45,0.85,0.50,1.00),\
        GLfloat4(0.45,0.85,0.50,1.00),\
        GLfloat4(0.45,0.85,0.50,1.00),\
        GLfloat4(0.45,0.85,0.50,1.00),\
        GLfloat4(0.55,0.75,0.40,1.00),\
        GLfloat4(0.55,0.75,0.40,1.00),\
        GLfloat4(0.55,0.75,0.40,1.00),\
        GLfloat4(0.55,0.75,0.40,1.00),\
        GLfloat4(0.65,0.65,0.30,1.00),\
        GLfloat4(0.65,0.65,0.30,1.00),\
        GLfloat4(0.65,0.65,0.30,1.00),\
        GLfloat4(0.65,0.65,0.30,1.00),\
        GLfloat4(0.75,0.55,0.20,1.00),\
        GLfloat4(0.75,0.55,0.20,1.00),\
        GLfloat4(0.75,0.55,0.20,1.00),\
        GLfloat4(0.75,0.55,0.20,1.00),\
        GLfloat4(0.85,0.45,0.10,1.00),\
        GLfloat4(0.85,0.45,0.10,1.00),\
        GLfloat4(0.85,0.45,0.10,1.00),\
        GLfloat4(0.85,0.45,0.10,1.00)\
    };*/
    const char* image[]={"C:\\BMP/g0.bmp","C:\\BMP/g1.bmp","C:\\BMP/g2.bmp","C:\\BMP/g3.bmp",
                          "C:\\BMP/g4.bmp","C:\\BMP/g5.bmp","C:\\BMP/g6.bmp","C:\\BMP/g7.bmp"};
    //const float ox[8]={0.0,32.0,64.0,96.0,128.0,160.0,192.0,224.0};
    //const float oy[8]={0.0,32.0,64.0,96.0,128.0,160.0,192.0,224.0};
    const float ox[8]={0.0,0.125,0.25,0.375,0.5,0.625,0.75.0,0.875};
    const float oy[8]={0.0,0.125,0.25,0.375,0.5,0.625,0.75.0,0.875};
    static GLuint VP;
    static GLuint GP;
    static GLuint FP;
    static GLuint texId[8];
     
    void bindShaderProcessor()
    {
        VP=loadASMShader(GL_VERTEX_PROGRAM  ,srcVP);
        GP=loadASMShader(GL_GEOMETRY_PROGRAM,srcGP);
        FP=loadASMShader(GL_FRAGMENT_PROGRAM,srcFP); 
    }
     
    void initFBO()
    {
        layerNode=layerNode->creator();
        layerNode->shape.id=0;
        layerNode->shape.dim=8;
        layerNode->shape.lenS=256;
        layerNode->shape.lenT=256;
        layerNode->shape.level=0;
        layerNode->shape.border=0;
        layerNode->shape.internalFormat=GL_RGBA32F_ARB;
        layerNode->shape.format=GL_RGBA;
        layerNode->shape.type=GL_FLOAT;
        layerNode->buildor();
    	printf("[arrayTex].id:%d\n",layerNode->shape.id);
        layerNode->bind();
    	CHECK_FRAMEBUFFER_STATUS();
        glEnable(GL_DEPTH_TEST);
    }
     
    void initSrcTex()
    {
    	ilInit();
    	ILuint ilh[8];
    	glGenTextures(8,texId);
    	for(int i=0;i<8;i++){
    		glBindTexture(GL_TEXTURE_2D,texId[i]);
    		printf("tex[%d].id:%d\n",i,texId[i]);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
    		ilGenImages(1,&amp;ilh[i]);
    		ilBindImage(ilh[i]);
    		if(!ilLoadImage(image[i])){
    			printf("error:image[%d] load failed.\n",i);
    			exit(1);
    		}
    		if(!ilConvertImage(IL_RGBA,IL_FLOAT)){
    			printf("error:image[%d] convert failed.\n",i);
    		}
    		glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA32F_ARB,layerNode->shape.lenS,layerNode->shape.lenT,0,layerNode->shape.format,layerNode->shape.type,(const GLfloat*)ilGetData());
    		glBindTexture(GL_TEXTURE_2D,0);
    		printf("image[%d].handle:%d\n",i,ilh[i]);
    		ilDeleteImages(1,&amp;ilh[i]);
    	}
    }
     
    /*void drawQuad(int layer)
    {
        glBegin(GL_QUADS);
          glTexCoord3f(0.0,0.0,GLfloat(layer));
          //glColor4fv((col[0]).asFloat());
          glVertex2f(0.0,0.0);
          glTexCoord3f(1.0,0.0,GLfloat(layer));
          //glColor4fv((col[1]).asFloat());
          glVertex2f(256.0,0.0);
          glTexCoord3f(1.0,1.0,GLfloat(layer));
          //glColor4fv((col[2]).asFloat());
          glVertex2f(256.0,256.0);
          glTexCoord3f(0.0,1.0,GLfloat(layer));
          //glColor4fv((col[3]).asFloat());
          glVertex2f(0.0,256.0);
        glEnd();
    }*/
     
    void drawQuad()
    {
        glBegin(GL_QUADS);
          glTexCoord2f(0.0,0.0);
          glVertex2f(0.0,0.0);
          glTexCoord2f(1.0,0.0);
          glVertex2f(256.0,0.0);
          glTexCoord2f(1.0,1.0);
          glVertex2f(256.0,256.0);
          glTexCoord2f(0.0,1.0);
          glVertex2f(0.0,256.0);
        glEnd();
    }
     
    void drawLayerQuad(float ox,float oy,int layer)
    {
        glBegin(GL_QUADS);
          glTexCoord3f(0.0,0.0+oy,GLfloat(layer));
          glVertex2f(0.0-ox,0.0-oy);
          glTexCoord3f(256.0-ox,0.0+oy,GLfloat(layer));
          glVertex2f(256.0-ox,0.0-oy);
          glTexCoord3f(256.0-ox,256.0-oy,GLfloat(layer));
          glVertex2f(256.0-ox,256.0-oy);
          glTexCoord3f(0.0,256.0-oy,GLfloat(layer));
          glVertex2f(0.0-ox,256.0-oy);
        glEnd();
    }
     
    void renderer()
    {	
        bindShaderProcessor();
    	glEnable(GL_TEXTURE_2D);        
        for(int i=0;i<layerNode->shape.dim;i++){
            layerNode->asCurrentLayer(i);
    	glPushAttrib(GL_VIEWPORT_BIT);
            glViewport(0,0,layerNode->shape.lenS,layerNode->shape.lenT); 
    	  printf("fbo[%d].handle:%d\n",i,layerNode->colorBuffer[i]);
    	glActiveTexture(GL_TEXTURE0+i);
    	glBindTexture(GL_TEXTURE_2D,texId[i]);
              drawQuad();     
    	glPopAttrib();	
        }		
        layerNode->asLeaveLayer();       
        glDisable(GL_VERTEX_PROGRAM);
        glDisable(GL_GEOMETRY_PROGRAM);
        glDisable(GL_FRAGMENT_PROGRAM);   
        glDisable(GL_TEXTURE_2D);
        glDeleteTextures(8,texId);	
     
     
    	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D_ARRAY_EXT,layerNode->shape.id);
    	  printf("%s\n",gluErrorString(glGetError()));
        glEnable(GL_TEXTURE_2D_ARRAY_EXT);
    	  printf("%s\n",gluErrorString(glGetError()));
        for(int layer=0;layer<layerNode->shape.dim;layer++){
    	drawLayerQuad(ox[layer],oy[layer],layer);
    	}
        glFlush();
    }
     
    void reshape(int x,int y)
    {
        glViewport(128,128,x,y);
        glPushMatrix();
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluOrtho2D(0.0,(double)x,0.0,(double)y);
        glMatrixMode(GL_MODELVIEW);
        glPopMatrix();
        glutPostRedisplay();
    }
     
    int main(int argc,char** argv)
    {
        glutInit(&amp;argc,argv);
        glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA|GLUT_DEPTH);
        glutInitWindowPosition(256,128);
        glutInitWindowSize(512,512);
        glutCreateWindow("OpenGL framebuffer demo");
        GLenum status;
        if((status=glewInit())!=GLEW_OK){
            printf("error:GLew initialize failed.\n");
    		return -1;
        } 
        if(!glewIsSupported(
    		"GL_EXT_texture_array" 
    		"GL_NV_gpu_program4"))
    	{
            printf("%s not supported.\n%s not supported.\n",
                   "GL_EXT_texture_array",  
                   "GL_NV_gpu_program4");
            return -1;
        }
        initFBO();	
        initSrcTex();	
        glutDisplayFunc(renderer);
        glutReshapeFunc(reshape);    
        glutMainLoop();
        layerNode->release();
        return 0;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •