Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Corona sdk [cracked] download
- http://ryushare.com/gcaqdfgv9eos/Corona_sdk_%5Bcracked%5D_download_.iso
- With Corona, you have 3 options:
- Corona SDK Starter lets you build and publish your apps for FREE.
- Corona SDK Pro adds advanced features and our daily builds.
- Corona Enterprise lets you use any native library and gives you ultimate flexibility.
- Take a look at the subscription comparison chart and read on to learn more about the core Corona features and why it is the best solution for building great 2D apps and games.
- Corona sdk [cracked] download
- Corona dramatically boosts your productivity. Thanks to our elegant APIs, tasks like animating objects, creating UI widgets or enabling physics take only a few lines of code.
- Changes are instantly viewable in the Corona Simulator and building to your own mobile device is a breeze.
- With Corona you write less code. It’s that simple.
- But you still have access to a powerful OpenGL-based platform with features like built-in physics, Facebook Connect, maps, push notifications,
- in-app purchases and more.
- Read on to see how Corona compares to the alternatives and lets you build cross-platform mobile apps with a fraction of the code.
- Loading an image in Corona…
- Corona sdk [cracked] download
- is this easy. Here’s the entire program:
- 1 2
- --Display "myImage.png"
- display.newImage("myImage.png")';
- view raw gistfile1.lua This Gist brought to you by GitHub.
- Compared to…
- The equivalent program in Objective-C:
- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
- // Display "myImage.png"Corona sdk [cracked] download
- // ----------------------------------------------------------------------------
- // OpenGLESTextureAppDelegate.m
- // ----------------------------------------------------------------------------
- #import "OpenGLESTextureAppDelegate.h"
- #import "EAGLView.h"
- #import "OpenGLESTextureViewController.h"
- @implementation OpenGLESTextureAppDelegate
- @synthesize window=_window;
- @synthesize viewController=_viewController;
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- // Override point for customization after application launch.
- self.window.rootViewController = self.viewController;
- return YES;
- }
- - (void)applicationDidBecomeActive:(UIApplication *)application
- {
- /*
- Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- */
- [self.viewController drawFrame];
- }
- - (void)dealloc
- {
- [_window release];
- [_viewController release];
- [super dealloc];
- }
- @end
- // ----------------------------------------------------------------------------
- // EAGLView.m
- // ----------------------------------------------------------------------------
- #import <QuartzCore/QuartzCore.h>
- #import "EAGLView.h"
- @interface EAGLView (PrivateMethods)
- - (void)createFramebuffer;
- - (void)deleteFramebuffer;
- @end
- @implementation EAGLView
- @synthesize context;
- // You must implement this method
- + (Class)layerClass
- {
- return [CAEAGLLayer class];
- }
- //The EAGL view is stored in the nib file. When it\'s unarchived it\'s sent -initWithCoder:.
- - (id)initWithCoder:(NSCoder*)coder
- {
- self = [super initWithCoder:coder];
- if (self) {
- CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
- eaglLayer.opaque = TRUE;
- eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
- kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
- nil];
- }
- return self;
- }
- - (void)dealloc
- {
- [self deleteFramebuffer];
- [context release];
- [super dealloc];
- }
- - (void)setContext:(EAGLContext *)newContext
- {
- if (context != newContext) {
- [self deleteFramebuffer];
- [context release];
- context = [newContext retain];
- [EAGLContext setCurrentContext:nil];
- }
- }
- - (void)createFramebuffer
- {
- if (context && !defaultFramebuffer) {
- [EAGLContext setCurrentContext:context];
- // Create default framebuffer object.
- glGenFramebuffers(1, &defaultFramebuffer);
- glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
- // Create color render buffer and allocate backing store.
- glGenRenderbuffers(1, &colorRenderbuffer);
- glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
- [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer *)self.layer];
- glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferWidth);
- glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &framebufferHeight);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
- if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
- NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
- }
- }
- - (void)deleteFramebuffer
- {
- if (context) {
- [EAGLContext setCurrentContext:context];
- if (defaultFramebuffer) {
- glDeleteFramebuffers(1, &defaultFramebuffer);
- defaultFramebuffer = 0;
- }
- if (colorRenderbuffer) {
- glDeleteRenderbuffers(1, &colorRenderbuffer);
- colorRenderbuffer = 0;
- }
- }
- }
- - (void)setFramebuffer
- {
- if (context) {
- [EAGLContext setCurrentContext:context];
- if (!defaultFramebuffer)
- [self createFramebuffer];
- glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
- glViewport(0, 0, framebufferWidth, framebufferHeight);
- }
- }
- - (BOOL)presentFramebuffer
- {
- BOOL success = FALSE;
- if (context) {
- [EAGLContext setCurrentContext:context];
- glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
- success = [context presentRenderbuffer:GL_RENDERBUFFER];
- }
- return success;
- }
- - (void)layoutSubviews
- {
- // The framebuffer will be re-created at the beginning of the next setFramebuffer method call.
- [self deleteFramebuffer];
- }
- @end
- // ----------------------------------------------------------------------------
- // OpenGLESTextureViewController.m
- // ----------------------------------------------------------------------------
- #import <QuartzCore/QuartzCore.h>
- #import "OpenGLESTextureViewController.h"
- #import "EAGLView.h"
- @interface OpenGLESTextureViewController ()
- @property (nonatomic, retain) EAGLContext *context;
- @property (nonatomic, assign) CADisplayLink *displayLink;
- - (void) loadTexture;
- @end
- @implementation OpenGLESTextureViewController
- @synthesize animating, context, displayLink;
- - (void)awakeFromNib
- {
- EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
- if (!aContext)
- NSLog(@"Failed to create ES context");
- else if (![EAGLContext setCurrentContext:aContext])
- NSLog(@"Failed to set ES context current");
- self.context = aContext;
- [aContext release];
- [(EAGLView *)self.view setContext:context];
- [(EAGLView *)self.view setFramebuffer];
- [self loadTexture];
- self.displayLink = nil;
- }
- - (void) loadTexture
- {
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glGenTextures(1, &textureID);
- glBindTexture(GL_TEXTURE_2D, textureID);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
- NSString *path = [[NSBundle mainBundle] pathForResource:@"myImage" ofType:@"png"];
- NSData *texData = [[NSData alloc] initWithContentsOfFile:path];
- UIImage *image = [[UIImage alloc] initWithData:texData];
- GLuint width = CGImageGetWidth(image.CGImage);
- GLuint height = CGImageGetHeight(image.CGImage);
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
- void *imageData = malloc( height * width * 4 );
- CGContextRef image_context = CGBitmapContextCreate( imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big );
- CGColorSpaceRelease( colorSpace );
- CGContextClearRect( image_context, CGRectMake( 0, 0, width, height ) );
- CGContextTranslateCTM( image_context, 0, height - height );
- CGContextDrawImage( image_context, CGRectMake( 0, 0, width, height ), image.CGImage );
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
- CGContextRelease(image_context);
- free(imageData);
- [image release];
- [texData release];
- }
- - (void)dealloc
- {
- glDeleteTextures(1, &textureID);
- // Tear down context.
- if ([EAGLContext currentContext] == context)
- [EAGLContext setCurrentContext:nil];
- [context release];
- [super dealloc];
- }
- - (void)viewDidUnload
- {
- [super viewDidUnload];
- // Tear down context.
- if ([EAGLContext currentContext] == context)
- [EAGLContext setCurrentContext:nil];
- self.context = nil;
- }
- - (void)drawFrame
- {
- [(EAGLView *)self.view setFramebuffer];
- // Replace the implementation of this method to do your own custom drawing.
- static const GLfloat squareVertices[] = {
- -0.5f, -0.33f,
- 0.5f, -0.33f,
- -0.5f, 0.33f,
- 0.5f, 0.33f,
- };
- static const GLfloat texCoords[] = {
- 0.0, 1.0,
- 1.0, 1.0,
- 0.0, 0.0,
- 1.0, 0.0
- };
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glVertexPointer(2, GL_FLOAT, 0, squareVertices);
- glEnableClientState(GL_VERTEX_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- [(EAGLView *)self.view presentFramebuffer];
- }
- @end';
- view raw gistfile1.m This Gist brought to you by GitHub.
- The equivalent program in Java:
- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
- /** Display "myImage.png" **/
- package net.obviam.opengl;
- import java.nio.ByteBuffer;
- import java.nio.ByteOrder;
- import java.nio.FloatBuffer;
- import javax.microedition.khronos.opengles.GL10;
- import android.content.Context;
- import android.graphics.Bitmap;
- import android.graphics.BitmapFactory;
- import android.opengl.GLUtils;
- public class Square {
- private FloatBuffer vertexBuffer; // buffer holding the vertices
- private float vertices[] = {
- -1.0f, -1.0f, 0.0f, // V1 - bottom left
- -1.0f, 1.0f, 0.0f, // V2 - top left
- 1.0f, -1.0f, 0.0f, // V3 - bottom right
- 1.0f, 1.0f, 0.0f // V4 - top right
- };
- private FloatBuffer textureBuffer; // buffer holding the texture coordinates
- private float texture[] = {
- // Mapping coordinates for the vertices
- 0.0f, 1.0f, // top left (V2)
- 0.0f, 0.0f, // bottom left (V1)
- 1.0f, 1.0f, // top right (V4)
- 1.0f, 0.0f // bottom right (V3)
- };
- /** The texture pointer */
- private int[] textures = new int[1];
- public Square() {
- // a float has 4 bytes so we allocate for each coordinate 4 bytes
- ByteBuffer byteBuffer = ByteBuffer.allocateDirect(vertices.length * 4);
- byteBuffer.order(ByteOrder.nativeOrder());
- // allocates the memory from the byte buffer
- vertexBuffer = byteBuffer.asFloatBuffer();
- // fill the vertexBuffer with the vertices
- vertexBuffer.put(vertices);
- // set the cursor position to the beginning of the buffer
- vertexBuffer.position(0);
- byteBuffer = ByteBuffer.allocateDirect(texture.length * 4);
- byteBuffer.order(ByteOrder.nativeOrder());
- textureBuffer = byteBuffer.asFloatBuffer();
- textureBuffer.put(texture);
- textureBuffer.position(0);
- }
- /** Load the texture for the square */
- public void loadGLTexture(GL10 gl, Context context) {
- // loading texture
- Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),
- R.drawable.android);
- // generate one texture pointer
- gl.glGenTextures(1, textures, 0);
- // ...and bind it to our array
- gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
- // create nearest filtered texture
- gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
- gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
- //Different possible texture parameters, e.g. GL10.GL_CLAMP_TO_EDGE
- // gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
- // gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
- // Use Android GLUtils to specify a two-dimensional texture image from our bitmap
- GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
- // Clean up
- bitmap.recycle();
- }
- /** The draw method for the square with the GL context */
- public void draw(GL10 gl) {
- // bind the previously generated texture
- gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
- // Point to our buffers
- gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
- gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
- // Set the face rotation
- gl.glFrontFace(GL10.GL_CW);
- // Point to our vertex buffer
- gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
- gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer);
- // Draw the vertices as triangle strip
- gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);
- //Disable the client state before leaving
- gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
- gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
- }
- }
- view raw gistfile1.java This Gist brought to you by GitHub.
Add Comment
Please, Sign In to add comment