OpenGL error

Started by
9 comments, last by heathCliff 7 years, 5 months ago

Hello im getting this error ->

(http://imgur.com/a/fLHVx)

Do u know how ot fix it?

Fragment Shader:


#version 450 core

layout(location = 0) out vec4 out_color;

in vec4 color;

void main(){
 
 	out_color = color;
}

Vertex Shader:


#version 450 core
layout(location = 0) in vec3 in_position;
layout(location = 1) in vec4 in_color;

out vec4 color;

void main(){

	color = in_color;
	gl_Position = vec4(in_position, 1);
	//gl_PointSize =5.5;
}
Advertisement
Fragment shader doesn't take data from a vbo afaik, perhaps you intended a 'uniform' ?
Otherwise, move the 'layout' to the vertex shader and pass it to the fragment shader.

Havent created yet a vbo, do u need to send the whole code?

Your OpenGL version is 2.0, but your shader is for version 4.5. The "layout" qualifier was introduced in version 3.1.

It looks like you'll have to use glBindAttribLocation or glGetAttribLocation if you want to stick with OpenGL version 2.0.

ah thx then ill use v3.1 , ill check and tell u

You might be interested in this table which depicts the matching between OpenGL and GLSL versions.

ah thx then ill use v3.1 , ill check and tell u


You can't use 3.1; like the screenshot tells you, and like heathCliff told you, your OpenGL version is 2.0 and that's the highest version you can use. If you wish to use a higher version you need new hardware (because OpenGL is not software).

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

thx all ive fixed this error, but im getting some error in the compiler that are illogical: (Using visual studio 2010)


1>------ Rebuild All started: Project: Game Engine, Configuration: Debug Win32 ------
1>  Triangle.cpp
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(15): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(16): error C3646: 'final' : unknown override specifier
1>  Shader_Manager.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1>          with
1>          [
1>              _Ty=std::string
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1>          with
1>          [
1>              _Ty=std::string
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=GLuint,
1>              _Pr=std::less<std::string>,
1>              _Alloc=std::allocator<std::pair<const std::string,GLuint>>,
1>              _Mfl=false
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<std::string,GLuint,std::less<std::string>,std::allocator<std::pair<const std::string,GLuint>>,false>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<std::string,GLuint,std::less<std::string>,std::allocator<std::pair<const std::string,GLuint>>,false>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<std::string,GLuint,std::less<std::string>,std::allocator<std::pair<const std::string,GLuint>>,false>
1>          ]
1>          c:\users\alex\desktop\game engine\game engine\game engine\shader_manager.h(33) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=GLuint
1>          ]
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1>          c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
1>  Scene_Manager.cpp
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(15): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(17): error C3646: 'final' : unknown override specifier
1>  Quad.cpp
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(17): error C3646: 'final' : unknown override specifier
1>  Models_Manager.cpp
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(15): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(17): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\models_manager.cpp(25): error C2143: syntax error : missing ',' before ':'
1>c:\users\alex\desktop\game engine\game engine\game engine\models_manager.cpp(25): error C3531: 'model': a symbol whose type contains 'auto' must have an initializer
1>c:\users\alex\desktop\game engine\game engine\game engine\models_manager.cpp(26): error C2143: syntax error : missing ';' before '{'
1>c:\users\alex\desktop\game engine\game engine\game engine\models_manager.cpp(27): error C2228: left of '.second' must have class/struct/union
1>          type is 'int'
1>c:\users\alex\desktop\game engine\game engine\game engine\models_manager.cpp(30): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>  Model.cpp
1>  main.cpp
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(15): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\triangle.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(16): error C3646: 'final' : unknown override specifier
1>c:\users\alex\desktop\game engine\game engine\game engine\quad.h(17): error C3646: 'final' : unknown override specifier
1>  Init_GLUT.cpp
1>  Init_GLEW.cpp
1>  Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Triangle.h:


#pragma once
#include "Model.h"
namespace Rendering
{
	namespace Models
	{

		class Triangle : public Model
		{
		public:
			Triangle();
			~Triangle();

			void Create();
			virtual void Draw() override final;
			virtual void Update() override final;
		private:

		};
	}
}

xFactional (this is not from what im writing):


// xfunctional internal header (pre-TR1 functional)
#pragma once
#ifndef _XFUNCTIONAL_
#define _XFUNCTIONAL_
#ifndef RC_INVOKED
#include <cstdlib>
#include <xstring>

 #pragma pack(push,_CRT_PACKING)
 #pragma warning(push,3)

 #pragma warning(disable: 4100 4180 4244)

 #ifndef _XSTD2
  #define _XSTD2
 #endif /* _XSTD2 */

_STD_BEGIN
		// TEMPLATE STRUCT plus
template<class _Ty>
	struct plus
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator+
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator+ to operands
		return (_Left + _Right);
		}
	};

		// TEMPLATE STRUCT minus
template<class _Ty>
	struct minus
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator-
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator- to operands
		return (_Left - _Right);
		}
	};

		// TEMPLATE STRUCT multiplies
template<class _Ty>
	struct multiplies
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator*
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator* to operands
		return (_Left * _Right);
		}
	};

		// TEMPLATE STRUCT divides
template<class _Ty>
	struct divides
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator/
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator/ to operands
		return (_Left / _Right);
		}
	};

		// TEMPLATE STRUCT modulus
template<class _Ty>
	struct modulus
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator%
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator% to operands
		return (_Left % _Right);
		}
	};

		// TEMPLATE STRUCT negate
template<class _Ty>
	struct negate
		: public unary_function<_Ty, _Ty>
	{	// functor for unary operator-
	_Ty operator()(const _Ty& _Left) const
		{	// apply operator- to operand
		return (-_Left);
		}
	};

		// TEMPLATE STRUCT equal_to
template<class _Ty>
	struct equal_to
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator==
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator== to operands
		return (_Left == _Right);
		}
	};

		// TEMPLATE STRUCT not_equal_to
template<class _Ty>
	struct not_equal_to
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator!=
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator!= to operands
		return (_Left != _Right);
		}
	};

		// TEMPLATE STRUCT greater
template<class _Ty>
	struct greater
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator>
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator> to operands
		return (_Left > _Right);
		}
	};

		// TEMPLATE STRUCT less
template<class _Ty>
	struct less
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator<
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator< to operands
		return (_Left < _Right);
		}
	};

		// TEMPLATE STRUCT greater_equal
template<class _Ty>
	struct greater_equal
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator>=
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator>= to operands
		return (_Left >= _Right);
		}
	};

		// TEMPLATE STRUCT less_equal
template<class _Ty>
	struct less_equal
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator<=
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator<= to operands
		return (_Left <= _Right);
		}
	};

		// TEMPLATE STRUCT logical_and
template<class _Ty>
	struct logical_and
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator&&
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator&& to operands
		return (_Left && _Right);
		}
	};

		// TEMPLATE STRUCT logical_or
template<class _Ty>
	struct logical_or
		: public binary_function<_Ty, _Ty, bool>
	{	// functor for operator||
	bool operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator|| to operands
		return (_Left || _Right);
		}
	};

		// TEMPLATE STRUCT logical_not
template<class _Ty>
	struct logical_not
		: public unary_function<_Ty, bool>
	{	// functor for unary operator!
	bool operator()(const _Ty& _Left) const
		{	// apply operator! to operand
		return (!_Left);
		}
	};

 #if _HAS_CPP0X
		// TEMPLATE STRUCT bit_and
template<class _Ty>
	struct bit_and
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator&
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator& to operands
		return (_Left & _Right);
		}
	};

		// TEMPLATE STRUCT bit_or
template<class _Ty>
	struct bit_or
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator|
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator| to operands
		return (_Left | _Right);
		}
	};

		// TEMPLATE STRUCT bit_xor
template<class _Ty>
	struct bit_xor
		: public binary_function<_Ty, _Ty, _Ty>
	{	// functor for operator^
	_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
		{	// apply operator^ to operands
		return (_Left ^ _Right);
		}
	};
 #endif /* _HAS_CPP0X */

		// TEMPLATE CLASS unary_negate
template<class _Fn1>
	class unary_negate
	: public unary_function<typename _Fn1::argument_type, bool>
	{	// functor adapter !_Func(left)
public:
	explicit unary_negate(const _Fn1& _Func)
		: _Functor(_Func)
		{	// construct from functor
		}

	bool operator()(const typename _Fn1::argument_type& _Left) const
		{	// apply functor to operand
		return (!_Functor(_Left));
		}

protected:
	_Fn1 _Functor;	// the functor to apply
	};

		// TEMPLATE FUNCTION not1
template<class _Fn1> inline
	unary_negate<_Fn1> not1(const _Fn1& _Func)
	{	// return a unary_negate functor adapter
	return (_STD unary_negate<_Fn1>(_Func));
	}

		// TEMPLATE CLASS binary_negate
template<class _Fn2>
	class binary_negate
		: public binary_function<typename _Fn2::first_argument_type,
			typename _Fn2::second_argument_type, bool>
	{	// functor adapter !_Func(left, right)
public:
	explicit binary_negate(const _Fn2& _Func)
		: _Functor(_Func)
		{	// construct from functor
		}

	bool operator()(const typename _Fn2::first_argument_type& _Left,
		const typename _Fn2::second_argument_type& _Right) const
		{	// apply functor to operands
		return (!_Functor(_Left, _Right));
		}

protected:
	_Fn2 _Functor;	// the functor to apply
	};

		// TEMPLATE FUNCTION not2
template<class _Fn2> inline
	binary_negate<_Fn2> not2(const _Fn2& _Func)
	{	// return a binary_negate functor adapter
	return (_STD binary_negate<_Fn2>(_Func));
	}

		// TEMPLATE CLASS binder1st
template<class _Fn2>
	class binder1st
		: public unary_function<typename _Fn2::second_argument_type,
			typename _Fn2::result_type>
	{	// functor adapter _Func(stored, right)
public:
	typedef unary_function<typename _Fn2::second_argument_type,
		typename _Fn2::result_type> _Base;
	typedef typename _Base::argument_type argument_type;
	typedef typename _Base::result_type result_type;

	binder1st(const _Fn2& _Func,
		const typename _Fn2::first_argument_type& _Left)
		: op(_Func), value(_Left)
		{	// construct from functor and left operand
		}

	result_type operator()(const argument_type& _Right) const
		{	// apply functor to operands
		return (op(value, _Right));
		}

	result_type operator()(argument_type& _Right) const
		{	// apply functor to operands
		return (op(value, _Right));
		}

protected:
	_Fn2 op;	// the functor to apply
	typename _Fn2::first_argument_type value;	// the left operand
	};

		// TEMPLATE FUNCTION bind1st
template<class _Fn2,
	class _Ty> inline
	binder1st<_Fn2> bind1st(const _Fn2& _Func, const _Ty& _Left)
		{	// return a binder1st functor adapter
		typename _Fn2::first_argument_type _Val(_Left);
		return (_STD binder1st<_Fn2>(_Func, _Val));
		}

		// TEMPLATE CLASS binder2nd
template<class _Fn2>
	class binder2nd
		: public unary_function<typename _Fn2::first_argument_type,
			typename _Fn2::result_type>
	{	// functor adapter _Func(left, stored)
public:
	typedef unary_function<typename _Fn2::first_argument_type,
		typename _Fn2::result_type> _Base;
	typedef typename _Base::argument_type argument_type;
	typedef typename _Base::result_type result_type;

	binder2nd(const _Fn2& _Func,
		const typename _Fn2::second_argument_type& _Right)
		: op(_Func), value(_Right)
		{	// construct from functor and right operand
		}

	result_type operator()(const argument_type& _Left) const
		{	// apply functor to operands
		return (op(_Left, value));
		}

	result_type operator()(argument_type& _Left) const
		{	// apply functor to operands
		return (op(_Left, value));
		}

protected:
	_Fn2 op;	// the functor to apply
	typename _Fn2::second_argument_type value;	// the right operand
	};

		// TEMPLATE FUNCTION bind2nd
template<class _Fn2,
	class _Ty> inline
	binder2nd<_Fn2> bind2nd(const _Fn2& _Func, const _Ty& _Right)
	{	// return a binder2nd functor adapter
	typename _Fn2::second_argument_type _Val(_Right);
	return (_STD binder2nd<_Fn2>(_Func, _Val));
	}

		// TEMPLATE CLASS pointer_to_unary_function
template<class _Arg,
	class _Result,
	class _Fn = _Result (*)(_Arg)>
	class pointer_to_unary_function
		: public unary_function<_Arg, _Result>
	{	// functor adapter (*pfunc)(left)
public:
	explicit pointer_to_unary_function(_Fn _Left)
		: _Pfun(_Left)
		{	// construct from pointer
		}

	_Result operator()(_Arg _Left) const
		{	// call function with operand
		return (_Pfun(_Left));
		}

protected:
	_Fn _Pfun;	// the function pointer
	};

		// TEMPLATE CLASS pointer_to_binary_function
template<class _Arg1,
	class _Arg2,
	class _Result,
	class _Fn = _Result (*)(_Arg1, _Arg2)>
	class pointer_to_binary_function
		: public binary_function<_Arg1, _Arg2, _Result>
	{	// functor adapter (*pfunc)(left, right)
public:
	explicit pointer_to_binary_function(_Fn _Left)
		: _Pfun(_Left)
		{	// construct from pointer
		}

	_Result operator()(_Arg1 _Left, _Arg2 _Right) const
		{	// call function with operands
		return (_Pfun(_Left, _Right));
		}

protected:
	_Fn _Pfun;	// the function pointer
	};

		// TEMPLATE FUNCTION ptr_fun
template<class _Arg,
	class _Result> inline
	pointer_to_unary_function<_Arg, _Result,
		_Result (__cdecl *)(_Arg)>
		ptr_fun(_Result (__cdecl *_Left)(_Arg))
	{	// return pointer_to_unary_function functor adapter
	return (pointer_to_unary_function<_Arg, _Result,
		_Result (__cdecl *)(_Arg)>(_Left));
	}

 #ifdef _M_IX86
template<class _Arg,
	class _Result> inline
	pointer_to_unary_function<_Arg, _Result,
		_Result (__stdcall *)(_Arg)>
			ptr_fun(_Result (__stdcall *_Left)(_Arg))
	{	// return pointer_to_unary_function functor adapter
	return (pointer_to_unary_function<_Arg, _Result,
		_Result (__stdcall *)(_Arg)>(_Left));
	}

  #ifndef _M_CEE
template<class _Arg,
	class _Result> inline
	pointer_to_unary_function<_Arg, _Result,
		_Result (__fastcall *)(_Arg)>
			ptr_fun(_Result (__fastcall *_Left)(_Arg))
	{	// return pointer_to_unary_function functor adapter
	return (pointer_to_unary_function<_Arg, _Result,
		_Result (__fastcall *)(_Arg)>(_Left));
	}
  #endif /* _M_CEE */

 #endif /* _M_IX86 */

 #ifdef _M_CEE
template<class _Arg,
	class _Result> inline
	pointer_to_unary_function<_Arg, _Result,
		_Result (__clrcall *)(_Arg)>
			ptr_fun(_Result (__clrcall *_Left)(_Arg))
	{	// return pointer_to_unary_function functor adapter
	return (pointer_to_unary_function<_Arg, _Result,
		_Result (__clrcall *)(_Arg)>(_Left));
	}
 #endif /* _M_CEE */

template<class _Arg1,
	class _Arg2,
	class _Result> inline
	pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result (__cdecl *)(_Arg1, _Arg2)>
		ptr_fun(_Result (__cdecl *_Left)(_Arg1, _Arg2))
	{	// return pointer_to_binary_function functor adapter
	return (pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result (__cdecl *)(_Arg1, _Arg2)>(_Left));
	}

 #ifdef _M_IX86
template<class _Arg1,
	class _Arg2,
	class _Result> inline
	pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result(__stdcall *)(_Arg1, _Arg2)>
			ptr_fun(_Result (__stdcall *_Left)(_Arg1, _Arg2))
	{	// return pointer_to_binary_function functor adapter
	return (pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result (__stdcall *)(_Arg1, _Arg2)>(_Left));
	}

  #ifndef _M_CEE
template<class _Arg1,
	class _Arg2,
	class _Result> inline
	pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result(__fastcall *)(_Arg1, _Arg2)>
			ptr_fun(_Result (__fastcall *_Left)(_Arg1, _Arg2))
	{	// return pointer_to_binary_function functor adapter
	return (pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result (__fastcall *)(_Arg1, _Arg2)>(_Left));
	}
  #endif /* _M_CEE */

 #endif /* _M_IX86 */

 #ifdef _M_CEE
template<class _Arg1,
	class _Arg2,
	class _Result> inline
	pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result(__clrcall *)(_Arg1, _Arg2)>
			ptr_fun(_Result (__clrcall *_Left)(_Arg1, _Arg2))
	{	// return pointer_to_binary_function functor adapter
	return (pointer_to_binary_function<_Arg1, _Arg2, _Result,
		_Result (__clrcall *)(_Arg1, _Arg2)>(_Left));
	}
 #endif /* _M_CEE */

		// TEMPLATE CLASS mem_fun_t
template<class _Result,
	class _Ty>
	class mem_fun_t
		: public unary_function<_Ty *, _Result>
	{	// functor adapter (*p->*pfunc)(), non-const *pfunc
public:
	explicit mem_fun_t(_Result (_Ty::*_Pm)())
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(_Ty *_Pleft) const
		{	// call function
		return ((_Pleft->*_Pmemfun)());
		}

private:
	_Result (_Ty::*_Pmemfun)();	// the member function pointer
	};

		// TEMPLATE CLASS mem_fun1_t
template<class _Result,
	class _Ty,
	class _Arg>
	class mem_fun1_t
		: public binary_function<_Ty *, _Arg, _Result>
	{	// functor adapter (*p->*pfunc)(val), non-const *pfunc
public:
	explicit mem_fun1_t(_Result (_Ty::*_Pm)(_Arg))
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(_Ty *_Pleft, _Arg _Right) const
		{	// call function with operand
		return ((_Pleft->*_Pmemfun)(_Right));
		}

private:
	_Result (_Ty::*_Pmemfun)(_Arg);	// the member function pointer
	};

		// TEMPLATE CLASS const_mem_fun_t
template<class _Result,
	class _Ty>
	class const_mem_fun_t
		: public unary_function<const _Ty *, _Result>
	{	// functor adapter (*p->*pfunc)(), const *pfunc
public:
	explicit const_mem_fun_t(_Result (_Ty::*_Pm)() const)
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(const _Ty *_Pleft) const
		{	// call function
		return ((_Pleft->*_Pmemfun)());
		}

private:
	_Result (_Ty::*_Pmemfun)() const;	// the member function pointer
	};

		// TEMPLATE CLASS const_mem_fun1_t
template<class _Result,
	class _Ty,
	class _Arg>
	class const_mem_fun1_t
		: public binary_function<const _Ty *, _Arg, _Result>
	{	// functor adapter (*p->*pfunc)(val), const *pfunc
public:
	explicit const_mem_fun1_t(_Result (_Ty::*_Pm)(_Arg) const)
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(const _Ty *_Pleft, _Arg _Right) const
		{	// call function with operand
		return ((_Pleft->*_Pmemfun)(_Right));
		}

private:
	_Result (_Ty::*_Pmemfun)(_Arg) const;	// the member function pointer
	};

		// TEMPLATE FUNCTION mem_fun
template<class _Result,
	class _Ty> inline
	mem_fun_t<_Result, _Ty> mem_fun(_Result (_Ty::*_Pm)())
	{	// return a mem_fun_t functor adapter
	return (mem_fun_t<_Result, _Ty>(_Pm));
	}

template<class _Result,
	class _Ty,
	class _Arg> inline
	mem_fun1_t<_Result, _Ty, _Arg> mem_fun(_Result (_Ty::*_Pm)(_Arg))
	{	// return a mem_fun1_t functor adapter
	return (mem_fun1_t<_Result, _Ty, _Arg>(_Pm));
	}

template<class _Result,
	class _Ty> inline
	const_mem_fun_t<_Result, _Ty>
		mem_fun(_Result (_Ty::*_Pm)() const)
	{	// return a const_mem_fun_t functor adapter
	return (const_mem_fun_t<_Result, _Ty>(_Pm));
	}

template<class _Result,
	class _Ty,
	class _Arg> inline
	const_mem_fun1_t<_Result, _Ty, _Arg>
		mem_fun(_Result (_Ty::*_Pm)(_Arg) const)
	{	// return a const_mem_fun1_t functor adapter
	return (const_mem_fun1_t<_Result, _Ty, _Arg>(_Pm));
	}

		// TEMPLATE FUNCTION mem_fun1 (retained)
template<class _Result,
	class _Ty,
	class _Arg> inline
	mem_fun1_t<_Result, _Ty, _Arg> mem_fun1(_Result (_Ty::*_Pm)(_Arg))
	{	// return a mem_fun1_t functor adapter
	return (mem_fun1_t<_Result, _Ty, _Arg>(_Pm));
	}

		// TEMPLATE CLASS mem_fun_ref_t
template<class _Result,
	class _Ty>
	class mem_fun_ref_t
		: public unary_function<_Ty, _Result>
	{	// functor adapter (*left.*pfunc)(), non-const *pfunc
public:
	explicit mem_fun_ref_t(_Result (_Ty::*_Pm)())
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(_Ty& _Left) const
		{	// call function
		return ((_Left.*_Pmemfun)());
		}

private:
	_Result (_Ty::*_Pmemfun)();	// the member function pointer
	};

		// TEMPLATE CLASS mem_fun1_ref_t
template<class _Result,
	class _Ty,
	class _Arg>
	class mem_fun1_ref_t
		: public binary_function<_Ty, _Arg, _Result>
	{	// functor adapter (*left.*pfunc)(val), non-const *pfunc
public:
	explicit mem_fun1_ref_t(_Result (_Ty::*_Pm)(_Arg))
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(_Ty& _Left, _Arg _Right) const
		{	// call function with operand
		return ((_Left.*_Pmemfun)(_Right));
		}

private:
	_Result (_Ty::*_Pmemfun)(_Arg);	// the member function pointer
	};

		// TEMPLATE CLASS const_mem_fun_ref_t
template<class _Result,
	class _Ty>
	class const_mem_fun_ref_t
		: public unary_function<_Ty, _Result>
	{	// functor adapter (*left.*pfunc)(), const *pfunc
public:
	explicit const_mem_fun_ref_t(_Result (_Ty::*_Pm)() const)
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(const _Ty& _Left) const
		{	// call function
		return ((_Left.*_Pmemfun)());
		}

private:
	_Result (_Ty::*_Pmemfun)() const;	// the member function pointer
	};

		// TEMPLATE CLASS const_mem_fun1_ref_t
template<class _Result,
	class _Ty,
	class _Arg>
	class const_mem_fun1_ref_t
		: public binary_function<_Ty, _Arg, _Result>
	{	// functor adapter (*left.*pfunc)(val), const *pfunc
public:
	explicit const_mem_fun1_ref_t(_Result (_Ty::*_Pm)(_Arg) const)
		: _Pmemfun(_Pm)
		{	// construct from pointer
		}

	_Result operator()(const _Ty& _Left, _Arg _Right) const
		{	// call function with operand
		return ((_Left.*_Pmemfun)(_Right));
		}

private:
	_Result (_Ty::*_Pmemfun)(_Arg) const;	// the member function pointer
	};

		// TEMPLATE FUNCTION mem_fun_ref
template<class _Result,
	class _Ty> inline
	mem_fun_ref_t<_Result, _Ty> mem_fun_ref(_Result (_Ty::*_Pm)())
	{	// return a mem_fun_ref_t functor adapter
	return (mem_fun_ref_t<_Result, _Ty>(_Pm));
	}

template<class _Result,
	class _Ty,
	class _Arg> inline
	mem_fun1_ref_t<_Result, _Ty, _Arg>
		mem_fun_ref(_Result (_Ty::*_Pm)(_Arg))
	{	// return a mem_fun1_ref_t functor adapter
	return (mem_fun1_ref_t<_Result, _Ty, _Arg>(_Pm));
	}

template<class _Result,
	class _Ty> inline
	const_mem_fun_ref_t<_Result, _Ty>
		mem_fun_ref(_Result (_Ty::*_Pm)() const)
	{	// return a const_mem_fun_ref_t functor adapter
	return (const_mem_fun_ref_t<_Result, _Ty>(_Pm));
	}

template<class _Result,
	class _Ty,
	class _Arg> inline
	const_mem_fun1_ref_t<_Result, _Ty, _Arg>
		mem_fun_ref(_Result (_Ty::*_Pm)(_Arg) const)
	{	// return a const_mem_fun1_ref_t functor adapter
	return (const_mem_fun1_ref_t<_Result, _Ty, _Arg>(_Pm));
	}

		// TEMPLATE FUNCTION mem_fun1_ref (retained)
template<class _Result,
	class _Ty,
	class _Arg> inline
	mem_fun1_ref_t<_Result, _Ty, _Arg> mem_fun1_ref(_Result (_Ty::*_Pm)(_Arg))
	{	// return a mem_fun1_ref_t functor adapter
	return (mem_fun1_ref_t<_Result, _Ty, _Arg>(_Pm));
	}

	// TEMPLATE CLASS hash
template<class _Kty>
	class hash
		: public unary_function<_Kty, size_t>
	{	// hash functor
public:
	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		ldiv_t _Qrem = _CSTD ldiv((long)(size_t)_Keyval, 127773);

		_Qrem.rem = 16807 * _Qrem.rem - 2836 * _Qrem.quot;
		if (_Qrem.rem < 0)
			_Qrem.rem += 2147483647;
		return ((size_t)_Qrem.rem);
		}
	};

template<>
	class hash<_ULonglong>
		: public unary_function<_ULonglong, size_t>
	{	// hash functor
public:
	typedef _ULonglong _Kty;
	typedef _Uint32t _Inttype;	// use first 2*32 bits

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		return (hash<_Inttype>()((_Inttype)(_Keyval & 0xffffffffUL))
			^ hash<_Inttype>()((_Inttype)(_Keyval >> 32)));
		}
	};

template<>
	class hash<_Longlong>
		: public unary_function<_Longlong, size_t>
	{	// hash functor
public:
	typedef _Longlong _Kty;
	typedef _Uint32t _Inttype;	// use first 2*32 bits

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		return (hash<_ULonglong>()((_ULonglong)_Keyval));
		}
	};

template<class _Ty>
	class hash<_Ty *>
		: public unary_function<_Ty *, size_t>
	{	// hash functor
public:
	typedef _Ty *_Kty;
	typedef _Uint32t _Inttype;	// use first (1 or 2)*32 bits

	size_t operator()(_Kty _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		typedef typename _STD _If<sizeof (_Ty *) <= sizeof (_Inttype),
			_Inttype, _ULonglong>::_Type _Integer;
		return (hash<_Integer>()((_Integer)_Keyval));
		}
	};

template<>
	class hash<float>
		: public unary_function<float, size_t>
	{	// hash functor
public:
	typedef float _Kty;
	typedef _Uint32t _Inttype;	// use first 32 bits

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		_Inttype _Bits = *(_Inttype *)&_Keyval;
		return (hash<_Inttype>()(_Bits == 0x80000000 ? 0 : _Bits));
		}
	};

template<>
	class hash<double>
		: public unary_function<double, size_t>
	{	// hash functor
public:
	typedef double _Kty;
	typedef _ULonglong _Inttype;	// use first 2*32 bits

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		_Inttype _Bits = *(_Inttype *)&_Keyval;
		return (hash<_Inttype>()(
			(_Bits & (_ULLONG_MAX >> 1)) == 0 ? 0 : _Bits));
		}
	};

template<>
	class hash<long double>
		: public unary_function<long double, size_t>
	{	// hash functor
public:
	typedef long double _Kty;
	typedef _ULonglong _Inttype;	// use first 2*32 bits

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		_Inttype _Bits = *(_Inttype *)&_Keyval;
		return (hash<_Inttype>()(
			(_Bits & (_ULLONG_MAX >> 1)) == 0 ? 0 : _Bits));
		}
	};

template<>
	class hash<_STD string>
		: public unary_function<_STD string, size_t>
	{	// hash functor
public:
	typedef _STD string _Kty;

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		size_t _Val = 2166136261U;
		size_t _First = 0;
		size_t _Last = _Keyval.size();
		size_t _Stride = 1 + _Last / 10;

		for(; _First < _Last; _First += _Stride)
			_Val = 16777619U * _Val ^ (size_t)_Keyval[_First];
		return (_Val);
		}
	};

template<>
	class hash<_STD wstring>
		: public unary_function<_STD wstring, size_t>
	{	// hash functor
public:
	typedef _STD wstring _Kty;

	size_t operator()(const _Kty& _Keyval) const
		{	// hash _Keyval to size_t value by pseudorandomizing transform
		size_t _Val = 2166136261U;
		size_t _First = 0;
		size_t _Last = _Keyval.size();
		size_t _Stride = 1 + _Last / 10;

		for(; _First < _Last; _First += _Stride)
			_Val = 16777619U * _Val ^ (size_t)_Keyval[_First];
		return (_Val);
		}
	};

	namespace tr1 {
using _STD hash;
	}	// namespace tr1
_STD_END

 #pragma warning(pop)
 #pragma pack(pop)

#endif /* RC_INVOKED */
#endif /* _XFUNCTIONAL_ */

/*
 * This file is derived from software bearing the following
 * restrictions:
 *
 * Copyright (c) 1994
 * Hewlett-Packard Company
 *
 * Permission to use, copy, modify, distribute and sell this
 * software and its documentation for any purpose is hereby
 * granted without fee, provided that the above copyright notice
 * appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation.
 * Hewlett-Packard Company makes no representations about the
 * suitability of this software for any purpose. It is provided
 * "as is" without express or implied warranty.
 */

/*
 * Copyright (c) 1992-2009 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
V5.20:0009 */

Quad.h:


#pragma once
#include "Model.h"

namespace Rendering
{
	namespace Models
	{

		class Quad : public Models::Model
		{
		public:
			Quad();
			~Quad();

			void Create();
			virtual void Draw()   override final;
			virtual void Update() override final;
		private:

		};

	}
}

Models_Manager:


#include "Models_Manager.h"

using namespace Managers;
using namespace Rendering;

Models_Manager::Models_Manager()
{
	
	Models::Triangle* triangle = new Models::Triangle();
	triangle->SetProgram(Shader_Manager::GetShader("colorShader"));
	triangle->Create();
	gameModelList["triangle"] = triangle;

	Models::Quad* quad = new Models::Quad();
	quad->SetProgram(Shader_Manager::GetShader("colorShader"));
	quad->Create();
	gameModelList["quad"] = quad;
	
}

Models_Manager::~Models_Manager()
{

	
	for (auto model: gameModelList)
	{
		delete model.second;
	}
	gameModelList.clear();
}

void Models_Manager::DeleteModel(const std::string& gameModelName)
{

	IGameObject* model = gameModelList[gameModelName];
	model->Destroy();
	gameModelList.erase(gameModelName);

}

const IGameObject& Models_Manager::GetModel(const std::string& gameModelName) const
{
	return (*gameModelList.at(gameModelName));
}

void Models_Manager::Update()
{
	for (auto model: gameModelList)
	{
		model.second->Update();
	}
}
void Models_Manager::Draw(){

	for (auto model : gameModelList)
	{
		model.second->Draw();
	}
}

I don't think a function can be both virtual and final. It doesn't make sense to me, at least. That should take care of the C3646 errors you're having.

EDIT: Upon a bit of research, virtual and final together seem to be valid, preventing deriving classes from using that function signature.

Hello to all my stalkers.

This topic is closed to new replies.

Advertisement