Hi
Ok he’re my ultra drawing routine:
glTranslatef(0.0f,0.0f,-2.0f);
float z[4] = {1.0, 1.0, 1.0, 1.0};
location = glGetUniformLocation(p, "color");
glUniform1fv(location, 1, z);
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glEnd();
vertex:
void main()
{
gl_Position = ftransform();
}
uniform vec4 color;
void main()
{
gl_FragColor = color;
}
Ok this is really simple… why i’m getting black screen instead of nice white one ? (am i too sleepy or what
sqrt_1
2
Firstly, I think you want glUniform4fv, not glUniform1fv.
Next, what do your perspective and modelview matrices look like?
I would also use 0.5f instead of 0.0f for z values. (assuming an identity projection matrix)
thinks
3
Also be careful that if you translate every frame, you will soon push your triangle beyond the far clipping plane.
Use:
glPushMatrix();
<draw>
glPopMatrix();
yes thats it glUniform4fv solves it …
PS i don’t paste everything in my drawing routine. translating and other stuff were well tested in fixed-func-style
Thanks
system
Closed
5
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.