#171889 - magge - Thu Dec 31, 2009 4:19 pm
hello guys,
i'm new to this board and have started developing a starfox like game for the ds.
i create my spaceships with simple glvertex commands with tiangles or quads. like this:
i have a showroom at the beginning of the game to look at the ships. they have the color that i assigned to them.
now comes the part i can't understand. i created a raw image .bin file with gfx2gba and used the code parts from the example "textured quad" from the devkitpro package. i do this in the main method concerning textures:
to draw the textured quad which should stay still in the background of my scene, i do this:
but whenever i draw this quad (which looks just like it should), i have the problem, that the darker the texture itself (a space texture with a lot of black in my case) leads to the occurance, that all objects rendered into the same scene as the quad change its color to black or close to black. they just seem to lose their color information.
this is my complete display function:
would be great if anyone knew what was going on with it. i mean it is strange that the brighter the texture itself, the less color information gets lost from my spaceship. i just don't understand why the texture affects the ship's color at all.
and until i disable GL_TEXTURE_2D, the ships color stays black. when i disable textures, then it gets it's original color black.
i do not use lighting.
i'm thankful for any help.
cya
i'm new to this board and have started developing a starfox like game for the ds.
i create my spaceships with simple glvertex commands with tiangles or quads. like this:
Code: |
void ShipOne::drawShip(){
glColor3f(0.1,0.3,1.0); glBegin(GL_TRIANGLES); //upper Left glVertex3f(0.0,0.2,0.0); glVertex3f(0.0,0.0,-1.0); glVertex3f(-0.5,0.0,0.4); //upper right glVertex3f(0.0,0.2,0.0); glVertex3f(0.0,0.0,-1.0); glVertex3f(0.5,0.0,0.4); ... glEnd(); } |
i have a showroom at the beginning of the game to look at the ships. they have the color that i assigned to them.
now comes the part i can't understand. i created a raw image .bin file with gfx2gba and used the code parts from the example "textured quad" from the devkitpro package. i do this in the main method concerning textures:
Code: |
glEnable(GL_TEXTURE_2D); vramSetBankA(VRAM_A_TEXTURE); glGenTextures(1, &textureID); glBindTexture(0, textureID); glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_256 , TEXTURE_SIZE_256, 0, TEXGEN_TEXCOORD, (u8*)space_bin); |
to draw the textured quad which should stay still in the background of my scene, i do this:
Code: |
void drawTexturedPlane(){ glPushMatrix(); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK); glTranslatef(0.0,0.0,-2.0); glScalef(8.0,8.0,8.0); glBindTexture(0, textureID); glColor3f(1.0,1.0,1.0); //draw the obj glBegin(GL_QUAD); //glNormal(NORMAL_PACK(0,inttov10(-1),0)); GFX_TEX_COORD = (TEXTURE_PACK(0, inttot16(256))); glVertex3v16(floattov16(-0.5), floattov16(-0.5), 0 ); GFX_TEX_COORD = (TEXTURE_PACK(inttot16(256),inttot16(256))); glVertex3v16(floattov16(0.5), floattov16(-0.5), 0 ); GFX_TEX_COORD = (TEXTURE_PACK(inttot16(256), 0)); glVertex3v16(floattov16(0.5), floattov16(0.5), 0 ); GFX_TEX_COORD = (TEXTURE_PACK(0,0)); glVertex3v16(floattov16(-0.5), floattov16(0.5), 0 ); glEnd(); glPopMatrix(1); } |
but whenever i draw this quad (which looks just like it should), i have the problem, that the darker the texture itself (a space texture with a lot of black in my case) leads to the occurance, that all objects rendered into the same scene as the quad change its color to black or close to black. they just seem to lose their color information.
this is my complete display function:
Code: |
glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.0,0.0,3.0,0.0,0.0,0.0,0.0,1.0,0.0); glPushMatrix(); glTranslatef(current_ship.getShipX(),current_ship.getShipY(),0.0); glRotateX(rotX); glRotateZ(rotZ); if(current_ship.getShipId()==1){ ShipOne sh=static_cast<ShipOne>(current_ship); sh.drawShip(); }else if(current_ship.getShipId()==2){ ShipTwo sh=static_cast<ShipTwo>(current_ship); sh.drawShip(); } glPopMatrix(1); drawTexturedPlane(); |
would be great if anyone knew what was going on with it. i mean it is strange that the brighter the texture itself, the less color information gets lost from my spaceship. i just don't understand why the texture affects the ship's color at all.
and until i disable GL_TEXTURE_2D, the ships color stays black. when i disable textures, then it gets it's original color black.
i do not use lighting.
i'm thankful for any help.
cya