コード例 #1
0
bool CShaderMngr::UseShader(const char *strName)
{
	if (strName == nullptr) 
	{
		glUseProgramObjectARB(0);
		return true;
	}

	shaderData *pData = GetShaderData(strName);

	if (pData)
	{
		glUseProgramObjectARB(pData->nProgID);
		return true;
	}

	return false;
}
コード例 #2
0
ファイル: shaders.cpp プロジェクト: gorkinovich/IGr
	//--------------------------------------------------------------------------------------
	// Metodo para eliminar los programas shaders que estabamos usando.
	//--------------------------------------------------------------------------------------
	void CShadersManager::Release (void)
	{
		if(!this->IsShadersAvailable()) return;

		glUseProgramObjectARB(0);
		this->Programs[0].Release();
		this->Programs[1].Release();
		this->Programs[2].Release();
	}
コード例 #3
0
ファイル: shader.cpp プロジェクト: Ornito/ODFAEG
        void Shader::setParameter(const std::string& name, float x, float y, float z, float w)
        {
            if (m_shaderProgram)
            {
                ensureGlContext();
                // Enable program
                GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
                glCheck(glUseProgramObjectARB(m_shaderProgram));

                // Get parameter location and assign it new values
                GLint location = getParamLocation(name);
                if (location != -1)
                    glCheck(glUniform4fARB(location, x, y, z, w));

                // Disable program
                glCheck(glUseProgramObjectARB(program));
            }
        }
コード例 #4
0
ファイル: graphics_gl2.cpp プロジェクト: gunchleoc/vdrift
void GRAPHICS_GL2::Deinit()
{
	if (GLEW_ARB_shading_language_100)
	{
		if (!shadermap.empty())
			glUseProgramObjectARB(0);
		shadermap.clear();
	}
}
コード例 #5
0
ファイル: C4Shader.cpp プロジェクト: 772/openclonk
void C4ShaderCall::Start()
{
	assert(!fStarted);
	assert(pShader->hProg != 0); // Shader must be initialized

	// Activate shader
	glUseProgramObjectARB(pShader->hProg);
	fStarted = true;
}
コード例 #6
0
bool RawVolumeModelRenderer::render( const eq::Range& range,
                                     const eq::Matrix4d& modelviewM,
                                     const eq::Matrix4f& invRotationM,
                                     const eq::Vector4f& taintColor,
                                     const int normalsQuality )
{
    VolumeInfo volumeInfo;

    if( !_rawModel.getVolumeInfo( volumeInfo, range ))
    {
        LBERROR << "Can't get volume data" << std::endl;
        return false;
    }

    glScalef( volumeInfo.volScaling.W,
              volumeInfo.volScaling.H,
              volumeInfo.volScaling.D );

    // Enable shaders
    glUseProgramObjectARB( _shaders.getProgram( ));

    // Calculate and put necessary data to shaders

    const uint32_t resolution    = _rawModel.getResolution();
    const double   sliceDistance = 3.6 / ( resolution * _precision );

    _putVolumeDataToShader( volumeInfo, float( sliceDistance ),
                            invRotationM, taintColor, normalsQuality );

    _sliceClipper.updatePerFrameInfo( modelviewM, sliceDistance, range );

    //Render slices
    glEnable( GL_BLEND );
    glBlendFuncSeparateEXT( GL_ONE, GL_SRC_ALPHA, GL_ZERO, GL_SRC_ALPHA );

    renderSlices( _sliceClipper );

    glDisable( GL_BLEND );

    // Disable shader
    glUseProgramObjectARB( 0 );

    return true;
}
コード例 #7
0
ファイル: Shader.cpp プロジェクト: vidjogamer/ProjectTemplate
void Shader::SetParameter(const std::string& name, float x, float y, float z, float w)
{
    if (myShaderProgram)
    {
        // Enable program
        GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
        GLCheck(glUseProgramObjectARB(myShaderProgram));

        // Get parameter location and assign it new values
        GLint location = glGetUniformLocationARB(myShaderProgram, name.c_str());
        if (location != -1)
            GLCheck(glUniform4fARB(location, x, y, z, w));
        else
            Err() << "Parameter \"" << name << "\" not found in shader" << std::endl;

        // Disable program
        GLCheck(glUseProgramObjectARB(program));
    }
}
コード例 #8
0
ファイル: shader.cpp プロジェクト: Ornito/ODFAEG
        void Shader::setParameter(const std::string& name, math::Matrix4f matrix)
        {
            if (m_shaderProgram)
            {
                ensureGlContext();
                // Enable program
                GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
                glCheck(glUseProgramObjectARB(m_shaderProgram));

                // Get parameter location and assign it new values
                GLint location = getParamLocation(name);
                if (location != -1) {
                    std::array<float, 16> glmatrix = matrix.toGlMatrix();
                    glCheck(glUniformMatrix4fvARB(location, 1, GL_FALSE, glmatrix.data()));
                }
                // Disable program
                glCheck(glUseProgramObjectARB(program));
            }
        }
コード例 #9
0
ファイル: C4Shader.cpp プロジェクト: 772/openclonk
void C4ShaderCall::Finish()
{
	// Remove shader
	if (fStarted) {
		glUseProgramObjectARB(0);
	}

	iUnits = 0;
	fStarted = false;
}
コード例 #10
0
void Shader::setParameter(const std::string& name, const sf::Transform& transform)
{
    if (m_shaderProgram)
    {
        ensureGlContext();

        // Enable program
        GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
        glCheck(glUseProgramObjectARB(m_shaderProgram));

        // Get parameter location and assign it new values
        GLint location = getParamLocation(name);
        if (location != -1)
            glCheck(glUniformMatrix4fvARB(location, 1, GL_FALSE, transform.getMatrix()));

        // Disable program
        glCheck(glUseProgramObjectARB(program));
    }
}
コード例 #11
0
ファイル: starBurst.cpp プロジェクト: Web5design/hyperspace
void starBurst::draw(float lerp, HyperspaceSaverSettings *inSettings){
	drawStars(inSettings);
	
	size += inSettings->frameTime * 0.5f;
	if(size >= 3.0f)
		return;

	// draw flare
	float brightness = 1.0f - (size * 0.333333f);
	if(brightness > 0.0f){
		float p[3];
		p[0] = pos[0];
		p[1] = pos[1];
		p[2] = pos[2];
		flare(p, 1.0f, 1.0f, 1.0f, brightness, inSettings);
	}

	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glTranslatef(pos[0], pos[1], pos[2]);
	glScalef(size, size, size);

	// draw sphere
	glDisable(GL_TEXTURE_2D);
	glEnable(GL_TEXTURE_CUBE_MAP_ARB);
	glActiveTextureARB(GL_TEXTURE2_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, inSettings->nebulatex);
	glActiveTextureARB(GL_TEXTURE1_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, inSettings->theWNCM->texture[(inSettings->whichTexture + 1) % inSettings->numAnimTexFrames]);
	glActiveTextureARB(GL_TEXTURE0_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, inSettings->theWNCM->texture[inSettings->whichTexture]);
	glUseProgramObjectARB(gooProgram);

	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	glEnable(GL_BLEND);
	glColor4f(brightness, brightness, brightness, lerp);
	glCallList(call_list);

	glDisable(GL_TEXTURE_CUBE_MAP_ARB);
	glUseProgramObjectARB(0);

	glPopMatrix();
}
コード例 #12
0
ファイル: Program.cpp プロジェクト: johans/lab4
void Program::apply()
{
    glUseProgramObjectARB(id);

    vector<UniformBasePtr>::const_iterator iter = uniforms.begin();
    while (iter != uniforms.end()) {
        (*iter)->apply();
        iter++;
    }
}
コード例 #13
0
ファイル: r_terrain.c プロジェクト: inequation/ac130
void r_draw_terrain(void) {
	OPENGL_EVENT_BEGIN(0, __PRETTY_FUNCTION__);

	glUseProgramObjectARB(r_ter_prog);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, r_ter_VBOs[0]);
	glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, r_ter_VBOs[1]);
	glBindTexture(GL_TEXTURE_2D, r_hmap_tex);

	// traverse the quadtree
	r_recurse_terrain(0.f, 0.f, 1.f, 1.f,
								r_ter_max_levels, 1.f);

	glBindTexture(GL_TEXTURE_2D, 0);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
	glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
	glUseProgramObjectARB(0);

	OPENGL_EVENT_END();
}
コード例 #14
0
int prepare_render_shadow(camera3d_t light,GLuint* shadowFBO) {
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, shadowFBO[0]);
    glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT);
    glClear( GL_DEPTH_BUFFER_BIT);
    glViewport(0,0,shadowFBO[2],shadowFBO[3]);
    glCullFace(GL_FRONT); // only draw back faces
    glUseProgramObjectARB(0);
    camera_look(light);
    return 0;
}
コード例 #15
0
ファイル: gl_shader.c プロジェクト: AAS/ezquake-source
//
// Turn of usage of any shader
//
void SHD_Unbind(void)
{
	if (!SHD_Initialized())
	{
		Com_Printf("SHD_Unbind: shader system not initialized\n");
		return;
	}

    glUseProgramObjectARB( 0 );
}
コード例 #16
0
ファイル: display.cpp プロジェクト: JohnMacAslan/Bubbles
	void setShader() {
		if(GL20Support){
			switch (mode) {
				case BUBBLE_MODE:
					glUseProgram(bubbleShaderProg);
					break;
				default:
					glUseProgram(bubbleShaderProg);
			}
		} else {
			switch (mode) {
				case BUBBLE_MODE:
					glUseProgramObjectARB(bubbleShaderProg);
					break;
				default:
					glUseProgramObjectARB(bubbleShaderProg);
			}
		}
	}
コード例 #17
0
ファイル: shader.c プロジェクト: Kodest/marcher
int
main()
{
	GLenum shader_prog, shader_vert, shader_frag;
	int i;
	char buf[1024];
	const GLcharARB *vertex_shader_code, *fragment_shader_code;
	GLint loc;

	assert((vertex_shader_code = loadShader("shader.vert")));
	assert((fragment_shader_code = loadShader("shader.frag")));
	assert(!SDL_Init(SDL_INIT_EVERYTHING));
	atexit(SDL_Quit);
	SDL_GL_SET_ATTR(RED_SIZE, 8);
	SDL_GL_SET_ATTR(GREEN_SIZE, 8);
	SDL_GL_SET_ATTR(BLUE_SIZE, 8);
	SDL_GL_SET_ATTR(DEPTH_SIZE, 16);
	SDL_GL_SET_ATTR(DOUBLEBUFFER, 1);
	assert(SDL_SetVideoMode(SCRW, SCRH, SCRBPP, SDL_OPENGL /*| SDL_FULLSCREEN*/));
/*	puts((const char *)glGetString(GL_EXTENSIONS));*/
	DO_GL_PROCS(DEFINE_GL_PROC)
	assert((shader_prog = glCreateProgramObjectARB()));
	assert((shader_vert = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB)));
	assert((shader_frag = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB)));
	i = strlen(vertex_shader_code);
	printf("vert len: %d\n", i);
	glShaderSourceARB(shader_vert, 1, &vertex_shader_code, &i);
	i = strlen(fragment_shader_code);
	printf("frag len: %d\n", i);
	glShaderSourceARB(shader_frag, 1, &fragment_shader_code, &i);
	glCompileShaderARB(shader_vert);
	glCompileShaderARB(shader_frag);
	glAttachObjectARB(shader_prog, shader_vert);
	glAttachObjectARB(shader_prog, shader_frag);
	glLinkProgramARB(shader_prog);
	i = 0; glGetInfoLogARB(shader_vert, sizeof(buf) - 1, &i, buf); buf[i] = 0; printf("vert error: \"%s\"\n", buf);
	i = 0; glGetInfoLogARB(shader_frag, sizeof(buf) - 1, &i, buf); buf[i] = 0; printf("frag error: \"%s\"\n", buf);
	i = 0; glGetInfoLogARB(shader_prog, sizeof(buf) - 1, &i, buf); buf[i] = 0; printf("prog error: \"%s\"\n", buf);
	glUseProgramObjectARB(shader_prog);
	loc = glGetUniformLocationARB(shader_prog, "time");
	while (!SDL_GetKeyState(0)[SDLK_ESCAPE]) {
		float time = (float)SDL_GetTicks() / 2000.0f;
		SDL_PumpEvents();
		glUniform1fARB(loc, time);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glBegin(GL_QUADS);
		glVertex3f(-1.0f, 1.0f, 0.0f);
		glVertex3f(1.0f, 1.0f, 0.0f);
		glVertex3f(1.0f, -1.0f, 0.0f);
		glVertex3f(-1.0f, -1.0f, 0.0f);
		glEnd();
		SDL_GL_SwapBuffers();
	}
	return 0;
}
コード例 #18
0
// Called by Rocket when it wants to render geometry that it does not wish to optimise.
void RocketSDL2Renderer::RenderGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, const Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation)
{
    // SDL uses shaders that we need to disable here  
    glUseProgramObjectARB(0);
    glPushMatrix();
    glTranslatef(translation.x, translation.y, 0);
 
    std::vector<Rocket::Core::Vector2f> Positions(num_vertices);
    std::vector<Rocket::Core::Colourb> Colors(num_vertices);
    std::vector<Rocket::Core::Vector2f> TexCoords(num_vertices);
    float texw, texh;
 
    SDL_Texture* sdl_texture = NULL;
    if(texture)
    {
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
        sdl_texture = (SDL_Texture *) texture;
        SDL_GL_BindTexture(sdl_texture, &texw, &texh);
    }
 
    for(int  i = 0; i < num_vertices; i++) {
        Positions[i] = vertices[i].position;
        Colors[i] = vertices[i].colour;
        if (sdl_texture) {
            TexCoords[i].x = vertices[i].tex_coord.x * texw;
            TexCoords[i].y = vertices[i].tex_coord.y * texh;
        }
        else TexCoords[i] = vertices[i].tex_coord;
    };
 
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glVertexPointer(2, GL_FLOAT, 0, &Positions[0]);
    glColorPointer(4, GL_UNSIGNED_BYTE, 0, &Colors[0]);
    glTexCoordPointer(2, GL_FLOAT, 0, &TexCoords[0]);
 
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDrawElements(GL_TRIANGLES, num_indices, GL_UNSIGNED_INT, indices);
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
 
    if (sdl_texture) {
        SDL_GL_UnbindTexture(sdl_texture);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    }
 
    glColor4f(1.0, 1.0, 1.0, 1.0);
    glPopMatrix();
    /* Reset blending and draw a fake point just outside the screen to let SDL know that it needs to reset its state in case it wants to render a texture */
    glDisable(GL_BLEND);
    SDL_SetRenderDrawBlendMode(mRenderer, SDL_BLENDMODE_NONE);
    SDL_RenderDrawPoint(mRenderer, -1, -1);
}
コード例 #19
0
unsigned int setup_shader(const char *fname) {
	FILE *fp;
	unsigned int prog, sdr, len;
	char *src_buf;
	int success, linked;

	if(!(fp = fopen(fname, "r"))) {
		fprintf(stderr, "failed to open shader: %s\n", fname);
		return 0;
	}
	fseek(fp, 0, SEEK_END);
	len = ftell(fp);
	fseek(fp, 0, SEEK_SET);
	src_buf = malloc(len + 1);

	fread(src_buf, 1, len, fp);
	src_buf[len] = 0;

	sdr = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
	glShaderSourceARB(sdr, 1, (const char**)&src_buf, 0);
	free(src_buf);

	glCompileShaderARB(sdr);
	glGetObjectParameterivARB(sdr, GL_OBJECT_COMPILE_STATUS_ARB, &success);
	if(!success) {
		int info_len;
		char *info_log;
		
		glGetObjectParameterivARB(sdr, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len);
		if(info_len > 0) {
			if(!(info_log = malloc(info_len + 1))) {
				perror("malloc failed");
				return 0;
			}
			glGetInfoLogARB(sdr, info_len, 0, info_log);
			fprintf(stderr, "shader compilation failed: %s\n", info_log);
			free(info_log);
		} else {
			fprintf(stderr, "shader compilation failed\n");
		}
		return 0;
	}

	prog = glCreateProgramObjectARB();
	glAttachObjectARB(prog, sdr);
	glLinkProgramARB(prog);
	glGetObjectParameterivARB(prog, GL_OBJECT_LINK_STATUS_ARB, &linked);
	if(!linked) {
		fprintf(stderr, "shader linking failed\n");
		return 0;
	}

	glUseProgramObjectARB(prog);
	return prog;
}
コード例 #20
0
ファイル: hud.cpp プロジェクト: chadmiral/brick
void HUD::render_gl()
{
    glUseProgramObjectARB(0);
    //glDisable(GL_LIGHTING);

    glPushMatrix();
        glLoadIdentity();
        glColor3f(0.0f, 0.0f, 0.0f);
        font->print(0, 460, "seeds: %d", player->get_num_seeds());
    glPopMatrix();
}
コード例 #21
0
 //-----------------------------------------------------------------------
 void GLSLLinkProgramManager::setActiveGeometryShader(GLSLProgram* geometryGpuProgram)
 {
     if (geometryGpuProgram != mActiveGeometryGpuProgram)
     {
         mActiveGeometryGpuProgram = geometryGpuProgram;
         // ActiveLinkProgram is no longer valid
         mActiveLinkProgram = NULL;
         // change back to fixed pipeline
         glUseProgramObjectARB(0);
     }
 }
コード例 #22
0
 //-----------------------------------------------------------------------
 void GLSLLinkProgramManager::setActiveVertexShader(GLSLProgram* vertexGpuProgram)
 {
     if (vertexGpuProgram != mActiveVertexGpuProgram)
     {
         mActiveVertexGpuProgram = vertexGpuProgram;
         // ActiveLinkProgram is no longer valid
         mActiveLinkProgram = NULL;
         // change back to fixed pipeline
         glUseProgramObjectARB(0);
     }
 }
コード例 #23
0
 //-----------------------------------------------------------------------
 void GLSLLinkProgramManager::setActiveFragmentShader(GLSLProgram* fragmentGpuProgram)
 {
     if (fragmentGpuProgram != mActiveFragmentGpuProgram)
     {
         mActiveFragmentGpuProgram = fragmentGpuProgram;
         // ActiveLinkProgram is no longer valid
         mActiveLinkProgram = NULL;
         // change back to fixed pipeline
         glUseProgramObjectARB(0);
     }
 }
コード例 #24
0
/**
 * Disables the program for rendering.
 * Generates error messages if something went wrong (i.e. program not initialized etc.)
 * \param void
 * \return void
 * \warning uses glGetError()
 * \author <a href="mailto:[email protected]">Jens Schneider</a>
 * \date Aug.2004
 */
void GLSLProgram::Disable(void) {
  if (m_bInitialized) {
    CheckGLError();
    if (m_bGLUseARB)
      glUseProgramObjectARB(0);
    else
      glUseProgram(0);
    if (!CheckGLError("Disable()")) m_bEnabled=false;
  }
  else T_ERROR("No program loaded!");
}
コード例 #25
0
ファイル: Shader.cpp プロジェクト: spykedood/Oh-My-Buddha
bool Shader::Activate()
{
	if(!m_nProgram) {
		std::cerr << "[Error] Using the shader "+m_strName+" with no program." << std::endl;
		return false;
	}

	s_pCurrent = this;
	glUseProgramObjectARB(m_nProgram);
	return true;
}
コード例 #26
0
TexViewerModule::TexViewerModule( bool _container, bool _rotate) : container(_container), rotate(_rotate) {
	in_ports.push_back(&tex);
	out_ports.push_back(&tex_out);
	tex.name = "tex";
	tex_out.name = "tex out";

	tex.position = make_vector(-0.5f, 0.0f);
	tex_out.position = make_vector(0.5f, 0.0f);

	if (!scale_bias_shader.ref) {
		Graphics::ShaderObjectRef frag = Graphics::get_shader_object("gp_shaders/gp_scale_bias_subpixel.glsl", GL_FRAGMENT_SHADER_ARB);
		assert(frag.ref);
		scale_bias_shader = Graphics::get_program_object(frag);
		assert(scale_bias_shader.ref);
		glUseProgramObjectARB(scale_bias_shader->handle);
		glUniform1iARB(glGetUniformLocationARB(scale_bias_shader->handle, "image"), 0);
		glUseProgramObjectARB(0);
	}

}
コード例 #27
0
ファイル: obj_loader.hpp プロジェクト: Dzshiftt/Gnomescroll
void draw_model(float x, float y, float z)
{
    x = ClientState::location_pointer.x;
    y = ClientState::location_pointer.y;
    z = ClientState::location_pointer.z;
    z+= 2.0f;

    const static unsigned int stride = sizeof(struct Vertex);

    glColor3ub(255,255,255);

    glEnable(GL_TEXTURE_2D);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    glBindTexture(GL_TEXTURE_2D, monster_texture);

    glBindBuffer(GL_ARRAY_BUFFER, monster_vbo);

    glUseProgramObjectARB(monster_shader.shader);

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableVertexAttribArray(monster_TexCoord);
    glEnableClientState(GL_NORMAL_ARRAY);

    glVertexPointer(3, GL_FLOAT, stride, (GLvoid*)0);
    glVertexAttribPointer(monster_TexCoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*)12);
    glNormalPointer(GL_FLOAT, stride, (GLvoid*)20);

    glUniform4f(monster_InPosition, x,y,z,0.0f);

    glDrawArrays(GL_TRIANGLES,0, v_num);

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableVertexAttribArray(monster_TexCoord);
    glDisableClientState(GL_NORMAL_ARRAY);

    glCullFace(GL_BACK);
    glDisable(GL_CULL_FACE);
    glUseProgramObjectARB(0);
}
コード例 #28
0
ファイル: Shader.cpp プロジェクト: AdamFlores/SFML
void Shader::setParameter(const std::string& name, float x, float y, float z)
{
    if (m_shaderProgram)
    {
        ensureGlContext();

        // Enable program
        GLhandleARB program = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);
        glCheck(glUseProgramObjectARB(m_shaderProgram));

        // Get parameter location and assign it new values
        GLint location = glGetUniformLocationARB(m_shaderProgram, name.c_str());
        if (location != -1)
            glCheck(glUniform3fARB(location, x, y, z));
        else
            err() << "Parameter \"" << name << "\" not found in shader" << std::endl;

        // Disable program
        glCheck(glUseProgramObjectARB(program));
    }
}
コード例 #29
0
ファイル: XGLShader.cpp プロジェクト: mike44/Gizmo-11.5.25
void XGLShader::enable() {
    if( this->validShader ) {
        //we need this in versions of x-plane prior to about 8.4 or 8.5 that did not have native shader support
        //glEnable(GL_VERTEX_PROGRAM_ARB);
        //glEnable(GL_FRAGMENT_PROGRAM_ARB);

        glUseProgramObjectARB( this->sp );

    } else {
        printf("XGLShader - tried to enable an invalid shader instance. Ignored.\n");
    }
}
コード例 #30
0
ファイル: Shader.cpp プロジェクト: BSkin/MTG
int Shader::activate()
{
	if (activeShader == this) 
		return 1;

	activeShader = this;
	glUseProgramObjectARB(shaderProgram);	

	//glUniform3f(glGetUniformLocation(shaderProgram, "worldViewProj"), 

	return 0;
}