Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

supagu

2d in OGL

This topic is 5399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do i render a texture to the screen? like as 2D? after i init opengl i have got: [cpp] GLDevice::GetInstance().BeginRender(); TGA loadScreen; loadScreen.LoadImage( "data/splash.tga", false ); loadScreen.SetTexture(); glOrtho(0, 800, 600, 0, 0, 10); float size = 200; glBegin(GL_QUADS); loadScreen.SetTexture(); glTexCoord2f(0.0f, 0.0f); //glColor4f(1,0,0,0); glVertex3f( 0, 0, 5 ); glTexCoord2f(1.0f, 0.0f); glVertex3f( 800, 0, 5 ); glTexCoord2f(1.0f, 1.0f); glVertex3f( 800, 600, 5 ); glTexCoord2f(0.0f, 1.0f); glVertex3f( 0, 600, 5 ); glEnd(); GLDevice::GetInstance().EndRender(); [/cpp] all i get is a white quad :-/ [edited by - supagu on February 28, 2004 3:47:20 AM]

Share this post


Link to post
Share on other sites
Advertisement
I guess that your texture size is not 2^n x 2^n .. so it won''t work.

you need square 2^n sized textures for OpenGL (d3d too i think) so you could make an utility to split that 800x600 texture in 128x128 bits and load them separately and render them as such (load with GL_CLAMP_TO_EDGE as params)

or you could use glDrawPixels which is really slow but could work for a splash screen.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!