Results 1 to 4 of 4

Thread: [SDL,OpenGL,C#] Textures changing basic colours.

  1. #1

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    [SDL,OpenGL,C#] Textures changing basic colours.

    Hi all,

    First time I've fully gotten into OpenGL, I'm using C# 2.0 and utilising SDL.NET, though for now I think pictures are more important than the code.

    Basically I've setup some controls and structs and got my app to be able to draw solid colour squares or textured squares to the screen. Here's the weird part, If I load one of my images "image.jpg" it looks fine... but if I load my other "test.jpg" the solid red square is darkened and I don't know why.

    I'm hoping an OpenGL vet knows exactly what causes this and it's a simple fix

    (NOTE: The attached image is of 2 different instances not 1, I just pasted them together is all)
    Attached Images Attached Images  

  2. #2
    Fanatic Member technorobbo's Avatar
    Join Date
    Dec 2008
    Location
    Chicago
    Posts
    864

    Re: [SDL,OpenGL,C#] Textures changing basic colours.

    Is your graphic card display setting 16 bit, 24 or 32?. 16 bit distorts colors. Oddly enough I've seen 32 distort also if the picture is 24 bit. Is it possible your loading into a device context defined as 16 bit?
    Have Fun,

    TR
    _____________________________
    Check out my Alpha DogFighter2D Game Demo and Source code. Direct Download:http://home.comcast.net/~technorobbo/Alpha.zip or Read about it in the forum:http://www.vbforums.com/showthread.php?t=551700. Now in 3D!!! http://home.comcast.net/~technorobbo/AlPha3D.zip or read about it in the forum: http://www.vbforums.com/showthread.php?goto=newpost&t=552560 and IChessChat3D internet chess game

  3. #3

    Thread Starter
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: [SDL,OpenGL,C#] Textures changing basic colours.

    interesting. Thanks for the reply

    Well both images are 24bit, but I tried a 32bit image instead, no change.
    I wasn't specifying the bpp when initialising, which i've now set to 32, no change ;(
    I tried 24 and 16 bit, still no change. Tried combinations etc and no change. So that sux.

    Must be to do with what you're saying though. I can't be certain of the device contet since I've initialised with SDL.NET, I can only hope It's initialised to the bpp I've specified...

    Your explanation kindof makes sense, but here's some new information I've figured out. When loading a bitmap(24bit) instead of a jpeg, it changes the tone of the image. Also, I nicked white corners onto the texture and tried again (jpeg) and the plain colours now display correctly, taking me back to the suspicion that the final pixel of the texture is affecting the tone of the plain colours being drawn. Going by that thinking, I change the cursor colour to whitre after drawing the texture, but still no change to this behaviour.

    P.S: now that I look at it again, the colours aren't correct in the white corner one, they are just less incorrect.
    Attached Images Attached Images  

  4. #4
    Fanatic Member technorobbo's Avatar
    Join Date
    Dec 2008
    Location
    Chicago
    Posts
    864

    Re: [SDL,OpenGL,C#] Textures changing basic colours.

    Try using GetObject with a bitmap structure to look at the bpp
    Have Fun,

    TR
    _____________________________
    Check out my Alpha DogFighter2D Game Demo and Source code. Direct Download:http://home.comcast.net/~technorobbo/Alpha.zip or Read about it in the forum:http://www.vbforums.com/showthread.php?t=551700. Now in 3D!!! http://home.comcast.net/~technorobbo/AlPha3D.zip or read about it in the forum: http://www.vbforums.com/showthread.php?goto=newpost&t=552560 and IChessChat3D internet chess game

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width