It is currently Mon Jul 24, 2017 7:47 pm

All times are UTC - 5 hours




 Page 1 of 1 [ 13 posts ] 
Author Message
 Post subject: Shader VMK 22 - OpenGL v2.1
PostPosted: Sat Feb 16, 2013 4:10 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1102
Location: Ontario Canada
In this video OpenGL shaders are introduced for the first time. We look at how to create, compile and link vertex and fragment shaders, and then use them to render on the screen.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Mon Feb 18, 2013 1:14 am 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 448
Im at the point in the video where we will begin writing the actual shader text files. The one problem I am having is none of the gl functions from this vmk are being defined. I went to the website and searched for a few hours, but I do not know what header is required, or if the header file I have is outdated to support these functions for the shader. I can not progress any further until I can resolve these definitions. Thanks!


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Mon Feb 18, 2013 6:34 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1102
Location: Ontario Canada
All the new gl functions are defined in glext.h just like before


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Mon Feb 18, 2013 9:36 am 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 448
That is what I thought, but they are not being defined. I clicked on the link for the header file, but it doesn't download it only opens the file in internet explorer. If I try to copy an paste the file, it is too large for the clip board. Would you be able to email the header file, thank you.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Mon Feb 18, 2013 12:56 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1102
Location: Ontario Canada
In internet explorer, right click on the link and choose "Save target as..."


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Mon Feb 18, 2013 3:00 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 448
Thank you so much that worked and all is fine and ready for the next vmk.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Fri Jun 28, 2013 2:02 pm 

Joined: Tue Jun 18, 2013 7:24 pm
Posts: 8
Hi, I found a small problem wiht this video, you get the location of the color and position attributes, and compare them against -1 which means error or not found, but the variables are declared as unsigned which can't be negative.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Fri Jun 28, 2013 2:53 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1102
Location: Ontario Canada
If you set an unsigned variable to a negative value, then the value will wrap around so in reality, you will be comparing it to the largest possible value that can be contained in the variable.

So for example a char can take on a value between –128 to 127. An unsigned char can take values between 0 to 255.

If you set an unsigned char to a value of -1, that is the same as setting it to 255. -2 would equal 254 etc.


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Fri Jun 28, 2013 3:05 pm 

Joined: Tue Jun 18, 2013 7:24 pm
Posts: 8
Marek wrote:
If you set an unsigned variable to a negative value, then the value will wrap around so in reality, you will be comparing it to the largest possible value that can be contained in the variable.

So for example a char can take on a value between –128 to 127. An unsigned char can take values between 0 to 255.

If you set an unsigned char to a value of -1, that is the same as setting it to 255. -2 would equal 254 etc.


Oh cool, lesson learned :)


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Fri Jun 28, 2013 6:53 pm 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 448
Similiar idea, if I was working with Enumerations as well as unsigned ints, the same idea applies ?

In most cases enumerations start at 0 or 1, but sometimes can be negative one to specify an error or unknown
case. And if the unsigned int variable that is used to designate this enumeration where the enum value is -1
then the unsigned int would wrap to the highest possible value that it can hold. Is this correct?


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Sat Oct 25, 2014 3:20 am 

Joined: Thu Sep 27, 2007 5:51 pm
Posts: 48
I had to remove "precision highp float;" from the fragment shader.

error(#263) "Precision qualifier" is not supported prior to GLSL version 1.30


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Sun Oct 26, 2014 10:59 am 

Joined: Mon Mar 24, 2014 2:25 pm
Posts: 69
Hey Gory, at this point you should be at OpenGL version 2.1 allowing the high precision. Ensure when you start-up OpenGL in your code you've updated the version you want and it's not hard coded to 1.3


Offline
 Profile  
 
 Post subject: Re: Shader VMK 22 - OpenGL v2.1
PostPosted: Sun Oct 26, 2014 11:12 am 

Joined: Thu Sep 27, 2007 5:51 pm
Posts: 48
Mebourne wrote:
Hey Gory, at this point you should be at OpenGL version 2.1 allowing the high precision. Ensure when you start-up OpenGL in your code you've updated the version you want and it's not hard coded to 1.3


Nope, I'm using OpenGL 2.1, which comes with GLSL 1.2. It says that I need GLSL 1.3 for high precision, and GLSL 1.3 comes with OpenGL 3.0.
It's ok tho, it worked just fine if I removed that line. Thanks anyway!


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 13 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron