Sign in to follow this  

Java.SWT.OpenGL

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

This topic is 4853 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this