PDA

View Full Version : I'm really trying hard to learn GLSL

noobscratcher
03-22-2012, 01:36 PM
Hey all I'm so sick of asking people questions about everything I have problems with is there any way that you guys have actual resources that teach opengl 3.3x programming not deprecated fixed function pipeline crap or tutorials with miss types.

Anything that can help me know the order and structure of opengl functions and also the functions themselfs to get the job done.

The topics of choice would be using VBOs and shaders in there fullest glory

also I have a problem:

at the moment I'm having issues with my quad in the frustum it seems to be that the two 2 top sides are alittle to the left and the two bottom sides are at alittle to the right as you can seee with the values in this vbo its not how it should be

GLfloat vVerts[] = { -10.5f, 10.5f, 0.0f, 0.0f, 0.0f ,
0.0f, 10.5f, 0.0f, 1.0f, 1.0f,
10.5f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 1.0f};

#version 150

//Always use a attribute vec4 for position variable
attribute vec4 position;

//Matrix 3 x 3 row
mat3 projection;

//Texture Cordinates 2 element vector of varying type

//attribute vec2 texture_coordinate;
in vec2 texture_coordinate;

out vec2 texture_coord;
//Translations 3 element vector uniform
uniform vec3 translations;

//Main Entry Point
void main(void)
{

//Projection Matrix
mat3 projection = mat3(
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0));

//Passing The Texture Coordinate of Texture Unit 0 To The Fragment Shader
texture_coord = (texture_coordinate);

// To Put The Vertex in View?
gl_Position = vec4(projection * position.xyz + translations.xyz, 8.0);

}

#version 150
//orginally 130
//orginally 110

//Texture Uniform Sampler 2D Container
uniform sampler2D texture;

in vec2 texture_coord;

varying vec3 texture_coordinate;
void main(void){

gl_FragColor = texture(texture, texture_coord);//vec4(1.0, 0.0, 0.0, 1.0);
//gl_FragColor = vec4(texture_coordinate.xy, 0.0, 1.0);

}

carsten neumann
03-22-2012, 02:22 PM
See for example the tutorial links (http://www.opengl.org/wiki/Getting_started#Tutorials_and_How_To_Guides) on the wiki.

Regarding your other problem, I'm not sure I understand your problem description, can you post an image that shows what is wrong?

noobscratcher
03-22-2012, 02:39 PM
here is a screenshot I want the rectangle to feel up the top area of the screen :) instead of leaning like it is :)

http://i.imgur.com/yX301.png

and thanks for the tutorial link thing

noobscratcher
03-22-2012, 03:53 PM
here is a screenshot I want the rectangle to feel up the top area of the screen instead of leaning like it is

http://i.imgur.com/yX301.png

and thanks for the tutorial link thing