Ondřej Ryška
Ondřej Ryška

Reputation: 491

OpenGL- JOGL colors

I'm having some problems with the simple 2D game in OpenGL in JOGL I'm making. I'm mapping some textures in this game. When I want render some graphic object (f.e Guads) with some color (no texture), I use procedure glColor3d(x,x,x). The object get this color, but all other textures are shaded with this color. I want to set color only for one graphics object, but this procedure sets color shade for all objects rendered aftwerwards. How can I solve this issue?

Upvotes: 1

Views: 1310

Answers (1)

Bartek Banachewicz
Bartek Banachewicz

Reputation: 39370

As you've already noticed, glColor3* changes also the color for textures. There are two ways to solve your problem:

  1. Call glColor3d(1.0, 1.0, 1.0); before rendering textured objects
  2. Use glPushAttrib()/glPopAttrib() pair for storing drawing properties.

Anyway, all of the above functions are already deprecated - you might want to look on tutorial about new OpenGL.

Upvotes: 2

Related Questions