Skip to main content
gamedev.net
🔒 Locked

Texturing problems

Started by cacaramels 1 reply 400+ views
Original Post
cacaramels
cacaramels
I''m working on an MDI OpenGL viewer and I got troubles when I am trying to add texturing to the objects I display. Actually, it seems that I need to load the texture I want to use in the OnPaint method, which means that each time I repaint the window, the texture is reloaded, which is computationally heavy and I hope avoidable. When I try to load the texture in the constructor of my window (just like in NeHe''s tutorial''s initGL() method) and to bind it in my onPaint() method (just like in NeHe''s DrawGLScene() method)no texturing is performed. On the other hand, when I load and bind the texture in the onPaint() method, the texturing works perfectly. Does anyone have any suggestion to fix this?? Thanks.
Nile
Nile
You should be able to load the textures only once during initialization. Just make sure to load the textures after you create the context and bind it to your display:

hGLRC = wglCreateContext(hDC)
wglMakeCurrent (hDC, hGLRC)

If you load the textures before it wouldn''t work.

Hope this helps.

cacaramels
cacaramels
Thanks a lot Nile, it helped indeed

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.