GL_QUADS and a shiny black screen

Started by
5 comments, last by notatric 22 years, 8 months ago
Hi people, I''m using OpenGL ortho mode and wanna display a simple quad with a color and an alpha value. So far so good, but everything I get is a black screen. The code seems right to me....could anybode please help!?? void cSprite:lane(RECT dim,float r,float g,float b,float alpha) { glLoadIdentity(); glTranslatef((float)dim.left,(float)dim.top,0.0f); glColor4f(r,g,b,alpha); glBegin(GL_QUADS); glVertex2d(0,dim.bottom); // top left glVertex2d(0,0); // bottom left glVertex2d(dim.right,0); // top right glVertex2d(dim.right,dim.bottom); // bottom right glEnd(); } I''m calling the function with these params: rc.left=0; rc.top=0; rc.right=640; rc.bottom=480; Sprite->Plane(rc,1.0f,1.0f,1.0f,0.0f); thanks! Bye, Alex
Advertisement
Using 0.0f for an alpha value makes the object invisible. Also, you might want to set up a method of blending.

[Resist Windows XP''s Invasive Production Activation Technology!]
I think the problem might be that smiley face in your function definition
glClearColor(1,0,0,1);
if u see a pure red screen then the object cant be seen
perhaps the cameras pointing the wrong way or the backface is facing the camera etc.
if u do see a black square perhaps u have lighting enabled
Hi,

I set the background to red but I''m getting a black one -> the quad is drawn but don''t uses the color....
Try translating behind the front clipping plane. If your front clipping plane is at 1.0, translate to 1.1.
have you disabled lighting , blending and texturing?

This topic is closed to new replies.

Advertisement