Jump to content
  • Advertisement
Sign in to follow this  
hoofmen

Java.SWT.OpenGL

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

I have been working on the swt tutorials, but seems that doing texture mapping with swt its a little different than doing it with C + SDL, actually i couldnt find in SWT API, a way to get the BytesPerPixel of the Image Object. so i am just loading BMP images because i know that the BytesPerPixel (in SDL for a bmp) is 3, well i`ll see how it goes.

Share this post


Link to post
Share on other sites
Advertisement
I couldn't even find the SWT API. But if you were using:

java.awt.Image.* I could tell ya in a jiffy. Can you give me a link or whatever for the SWT API. thanks

Share this post


Link to post
Share on other sites
Hi, here is the swt api:
http://download.eclipse.org/downloads/documentation/2.0/html/plugins/org.eclipse.platform.doc.isv/reference/api/

and i am using org.eclipse.swt.graphics.Image.*;
i am not using awt for some reason gl4java didnt work on my pc.

thnx.

Share this post


Link to post
Share on other sites
found it.

my java is a little rusty, but something along these lines should work:


import org.eclipse.swt.graphics.*
import org.eclipse.swt.graphics.Image.*

Image i = new Image(device, "C:\\picture.bmp");
ImageData data = i.getImageData();

int BytesPerPixel = data.depth / 8;

//WALLA SHALLA BOOM BANG, THERE YOU GO : )





keep in mind that this is true:

" Note that for 16 bit depth images the pixel data is stored in least significant byte order; however, for 24bit and 32bit depth images the pixel data is stored in most significant byte order."


edit: depth is actually bits per pixel, so divide by 8.

[Edited by - Luke Miklos on August 30, 2004 12:43:31 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!