Jump to content
  • Advertisement
Sign in to follow this  
Kazade

OpenGL Texture list control?

This topic is 5409 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

Hey, I'm writing a map editor for my final year project. I want to have a texture selection window, like that seen in Q3Radient etc. You know where it displays the actual texture images and you can select them. Now i'm trying to think of the best way to code this. I'm using wxWidgets for all the GUI stuff. So far i've come up with 2 possibilities: 1.) I somehow derive my own list control and override the paint method (and whatever else i need to) to display the textures. 2.) I create a separate OpenGL canvas, and draw textured quads. The scrollbar would simply translate the view. I'm worried that 2 would result in a lot of code, and it would mean having two OpenGL contexts on the go, is this a good idea? What are your views on this? Moderators: im not sure if this is the right forum to post this if its not then move it :)

Share this post


Link to post
Share on other sites
Advertisement
You could make a small icon from each texture (all the same size) and show that in a list view - no custom drawing required. Maybe combine that with some kind of image control for a bigger preview.

I would advise caching the icons/thumbnails somehow though, loading that many textures from disk is bound to be slow.

Share this post


Link to post
Share on other sites
Method 1: In the class/struct that holds your texture data, you'll need to have the OpenGL texture object, and a thumbnail of the texture (which you will need to make when the original image is loaded). This isn't a bad method, but it seems to be more work to me.

Method 2: q3radiant uses this method (the source code is here, if you want a look. It's in the file TexWnd.cpp of the q3radiant 202 build), and I also used it successfully in my editor. Having two RCs on the go at the same time is fine. I have five in my editor. The problem you'll run up against is needing RCs to share textures, but this is easily solved with the use of wglShareLists. Load all your textures into one RC, then instruct the others to share them with wglShareLists. Plus, you won't need to make thumbnails, as you can just have OpenGL draw textured 64x64 quads, or whatever. Another plus is that rendering is simple. Using glTranslatef to move the textures when the user scrolls will work in the short term, but if you're loading and drawing lots of textures, you will want to use some culling. However, this is simple, because you'll know the dimensions of the texture window, and you can figure out which textures can be seen, and which can't.

IMHO, option 2 wins. Hope this helps...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!