public void Draw()
{
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
foreach (ISprite sp in currentSprites)
{
Gl.glBegin(Gl.GL_QUADS);
Gl.glColor3b(sp.Color.R, sp.Color.G, sp.Color.B);
Gl.glVertex2d(sp.Location.X, sp.Location.Y);
Gl.glVertex2d(sp.Location.X + sp.Size.Width, sp.Location.Y );
Gl.glVertex2d(sp.Location.X + sp.Size.Width, (sp.Location.Y + sp.Size.Height));
Gl.glVertex2d(sp.Location.X , (sp.Location.Y + sp.Size.Height));
Gl.glEnd();
}
Sdl.SDL_GL_SwapBuffers();
}
glColor*b not working
I'm writing a simple 2D action-adventure game using OpenGL for graphics, I'm just using the old 1.1 functions, since it's easier for me to do that as I want just simple functionality.
The problem I encountered is that the functions Color3b, Color4b, and their vector version just set the color to black.
I'm using C# in Visual Studio 2005, Tao Framework 2.0 and have an nVidia Geforce FX 5200 on Windows XP
The float, double, integer and short versions work as they should. Is this a bug in the OpenGL implementation so I'll have to use other version of glColor?
Thanks in advance for the advice
What values do the components of sp.Color have? Did you try hardcoded colors e.g. glColor3b(64, 64, 64)?
Note that signed values are mapped to the interval [-1,1] so try glColor3ub instead.
Note that signed values are mapped to the interval [-1,1] so try glColor3ub instead.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement