repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
tharrry/sphincsplus
ref/merkle.c
<filename>ref/merkle.c #include <stdint.h> #include <string.h> #include "utils.h" #include "utilsx1.h" #include "wots.h" #include "wotsx1.h" #include "merkle.h" #include "address.h" #include "params.h" /* * This generates a Merkle signature (WOTS signature followed by the Merkle * authentication path). This is in ...
tharrry/sphincsplus
haraka-aesni/fors.c
#include <stdlib.h> #include <stdint.h> #include <string.h> #include "fors.h" #include "utils.h" #include "utilsx4.h" #include "hash.h" #include "hashx4.h" #include "thash.h" #include "thashx4.h" #include "address.h" static void fors_gen_sk(unsigned char *sk, const unsigned char *sk_seed, uint...
tharrry/sphincsplus
haraka-aesni/utilsx4.h
<filename>haraka-aesni/utilsx4.h #ifndef SPX_UTILSX4_H #define SPX_UTILSX4_H #include <stdint.h> #include "params.h" /** * For a given leaf index, computes the authentication path and the resulting * root node using Merkle's TreeHash algorithm. * Expects the layer and tree parts of the tree_addr to be set, as well...
tharrry/sphincsplus
shake256-avx2/wots.c
<reponame>tharrry/sphincsplus #include <stdint.h> #include <string.h> #include "utils.h" #include "utilsx4.h" #include "hash.h" #include "hashx4.h" #include "thash.h" #include "thashx4.h" #include "wots.h" #include "wotsx4.h" #include "address.h" #include "params.h" // TODO clarify address expectations, and make them...
tharrry/sphincsplus
sha256x4-neon/randombytes.h
<gh_stars>10-100 #ifndef SPX_RANDOMBYTES_H #define SPX_RANDOMBYTES_H extern void randombytes(unsigned char * x,unsigned long long xlen); #endif
tharrry/sphincsplus
shake256-avx2/utils.h
/// @file utils.h /// @brief Utilities for IO. /// /// #ifndef _UTILS_H_ #define _UTILS_H_ #include <stdio.h> #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif int byte_fdump(FILE * fp, const char * extra_msg , const unsigned char *v, unsigned n_byte); unsigned byte_fget( FILE * fp, unsigned char *v ,...
tharrry/sphincsplus
ref/haraka_offsets.h
#if !defined( HARAKA_OFFSETS_H_ ) #define HARAKA_OFFSETS_H_ /* * Offsets of various fields in the address structure when we use Haraka as * the Sphincs+ hash function */ #define SPX_OFFSET_LAYER 3 /* The byte used to specify the Merkle tree layer */ #define SPX_OFFSET_TREE 8 /* The start of the 8 byte...
tharrry/sphincsplus
sha256x4-neon/sha256_neon.h
<filename>sha256x4-neon/sha256_neon.h #ifndef SHA256_NEON_H #define SHA256_NEON_H #include <stddef.h> #include <stdint.h> #include <arm_neon.h> /* The incremental API allows hashing of individual input blocks; these blocks must be exactly 64 bytes each. Use the 'finalize' functions for any remaining...
tharrry/sphincsplus
shake256-avx2/thash.h
<gh_stars>10-100 #ifndef SPX_THASH_H #define SPX_THASH_H #include <stdint.h> void thash(unsigned char *out, const unsigned char *in, unsigned int inblocks, const unsigned char *pub_seed, uint32_t addr[8]); #endif
tharrry/sphincsplus
sha256x4-neon/hash_sha256x4.c
#include <stdint.h> #include <string.h> #include "address.h" #include "utils.h" #include "params.h" #include "hashx4.h" #include "sha256.h" #include "sha256_neon.h" /* * 4-way parallel version of prf_addr; takes 4x as much input and output */ void prf_addrx4(unsigned char *out0, unsigned char *out...
tharrry/sphincsplus
ref/hash_haraka.c
<reponame>tharrry/sphincsplus #include <stdint.h> #include <string.h> #include "address.h" #include "utils.h" #include "params.h" #include "haraka.h" #include "hash.h" void initialize_hash_function(const unsigned char *pk_seed, const unsigned char *sk_seed) { tweak_constants(pk_seed...
tharrry/sphincsplus
sha256x4-neon/test2.c
#include<stdio.h> #include<stdint.h> #include<assert.h> #include<string.h> #include<arm_neon.h> #include "sha256_neon.h" #include "sha256.h" static inline uint64_t read_pmccntr(void) { uint64_t val; asm volatile("mrs %0, pmccntr_el0" : "=r"(val)); return val; } int main(int argc, char *argv[...
tharrry/sphincsplus
sha256-avx2/thash_sha256_simplex8.c
#include <stdint.h> #include <string.h> #include "address.h" #include "utils.h" #include "params.h" #include "thashx8.h" #include "sha256.h" #include "sha256x8.h" #include "sha256avx.h" /** * 8-way parallel version of thash; takes 8x as much input and output */ void thashx8(unsigned char *out0, unsigne...
tharrry/sphincsplus
shake256-avx2/thashx4.h
<filename>shake256-avx2/thashx4.h #ifndef SPX_THASHX4_H #define SPX_THASHX4_H #include <stdint.h> void thashx4(unsigned char *out0, unsigned char *out1, unsigned char *out2, unsigned char *out3, const unsigned char *in0, const unsigned char *in1, ...
tharrry/sphincsplus
shake256-avx2/fips202.h
#ifndef FIPS202_H #define FIPS202_H #include <stddef.h> #include <stdint.h> #include "params.h" #define FIPS202_NAMESPACE(s) KYBER_NAMESPACE(s) #define SHAKE128_RATE 168 #define SHAKE256_RATE 136 #define SHA3_256_RATE 136 #define SHA3_512_RATE 72 typedef struct { uint64_t s[25]; } keccak_state; #define shake128_...
tharrry/sphincsplus
ref/wotsx1.h
#if !defined( WOTSX1_H_ ) #define WOTSX1_H_ #include <string.h> /* * This is here to provide an interface to the internal wots_gen_leafx1 * routine. While this routine is not referenced in the package outside of * wots.c, it is called from the stand-alone benchmark code to characterize * the performance */ str...
tharrry/sphincsplus
refx4/thash_sha256_robustx4.c
#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "thash.h" #include "address.h" #include "params.h" #include "sha256.h" //#include "sha256_neon.h" //#include "sha256_neon11.h" /** * Takes an array of inblocks concatenated arrays of SPX_N bytes. */ void thashx4( uns...
tharrry/sphincsplus
shake256-avx2/hash.h
<gh_stars>10-100 #ifndef HASH_H #define HASH_H #include "params.h" int msg_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen); int varlen_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen); int hash_2n_n(unsigned char *out,const unsigned char *in); int hash_2n_n_mask(unsi...
tharrry/sphincsplus
sha256-avx2/sha256avx.c
<reponame>tharrry/sphincsplus #include <stdio.h> #include <string.h> #include <stdint.h> #include "sha256avx.h" // Transpose 8 vectors containing 32-bit values void transpose(u256 s[8]) { u256 tmp0[8]; u256 tmp1[8]; tmp0[0] = _mm256_unpacklo_epi32(s[0], s[1]); tmp0[1] = _mm256_unpackhi_epi32(s[0], s[1...
tharrry/sphincsplus
ref/test/haraka.c
#include <stdio.h> #include <stdint.h> #include <string.h> #include <inttypes.h> #include "../haraka.c" #include "../randombytes.h" static int test_haraka_S_incremental(void) { unsigned char input[521]; unsigned char check[521]; unsigned char output[521]; uint8_t s_inc_absorb[65]; uint8_t s_inc_sq...
tharrry/sphincsplus
sha256-avx2/sha256x8.c
<reponame>tharrry/sphincsplus #include <string.h> #include "sha256x8.h" #include "sha256avx.h" #include "utils.h" static uint32_t load_bigendian_32(const uint8_t *x) { return (uint32_t)(x[3]) | (((uint32_t)(x[2])) << 8) | (((uint32_t)(x[1])) << 16) | (((uint32_t)(x[0])) << 24); } // Performs sha256x8 ...
tharrry/sphincsplus
sha256x4-neon/params/params-sphincs-sha256-128s.h
#ifndef SPX_PARAMS_H #define SPX_PARAMS_H /* Hash output length in bytes. */ #define SPX_N 16 /* Height of the hypertree. */ #define SPX_FULL_HEIGHT 63 /* Number of subtree layer. */ #define SPX_D 7 /* FORS tree dimensions. */ #define SPX_FORS_HEIGHT 12 #define SPX_FORS_TREES 14 /* Winternitz parameter, */ #define SPX...
tharrry/sphincsplus
shake256-avx2/wots.h
#ifndef WOTS_H #define WOTS_H #include "params.h" void wots_pkgen(unsigned char pk[WOTS_L*HASH_BYTES], const unsigned char sk[SEED_BYTES], const unsigned char masks[(WOTS_W-1)*HASH_BYTES]); void wots_sign(unsigned char sig[WOTS_L*HASH_BYTES], const unsigned char msg[HASH_BYTES], const unsigned char sk[SEED_BYTES], c...
tharrry/sphincsplus
sha256x4-neon/test/fors.c
<reponame>tharrry/sphincsplus #include <stdio.h> #include <string.h> #include "../hash.h" #include "../fors.h" #include "../randombytes.h" #include "../params.h" int main() { /* Make stdout buffer more responsive. */ setbuf(stdout, NULL); unsigned char sk_seed[SPX_N]; unsigned char pub_seed[SPX_N]; ...
tharrry/sphincsplus
sha256x4-neon/thash_sha256_simplex4.c
#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "thash.h" #include "address.h" #include "params.h" #include "sha256.h" #include "sha256_neon.h" /** * Takes an array of inblocks concatenated arrays of SPX_N bytes. */ void thashx4( unsigned char *out0, u...
tharrry/sphincsplus
sha256x4-neon/sha256_neon.c
<gh_stars>0 /* Based on the public domain implementation in * crypto_hash/sha512/ref/ from http://bench.cr.yp.to/supercop.html * by <NAME> */ #include <stddef.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <arm_neon.h> #include "utils.h" #include "sha256_neon.h"...
ghz2000/ESP8266-HumidityTemperature-Logger
ESP8266_HumidityAndTemperature/NTP.h
<filename>ESP8266_HumidityAndTemperature/NTP.h #ifndef _NTP_h #define _NTP_h #include <ESP8266WiFi.h> #include <WiFiUdp.h> #include <Time.h> #include <TimeLib.h> time_t getNtpTime(); // 2390 int ntp_begin(unsigned int localPort); // 9 (JST) time_t localtime(time_t t, int timeZone); // ntp.nict.jp void setTimeServ...
vgatherps/nontemporal_stores
write_combining/test.c
<gh_stars>1-10 #include <stdint.h> #include <stdio.h> #include <emmintrin.h> // I use defines here so there's never a possibility of speculation // accidentally seeing the wrong instruction and having some // side effect typedef struct { __m128i vec_val; int int_val; char data[64 - (sizeof(__m128i) + siz...
vgatherps/nontemporal_stores
store_buffer/test.c
#include <stdint.h> #include <stdio.h> #include <emmintrin.h> // I use defines here so there's never a possibility of speculation // accidentally seeing the wrong instruction and having some // side effect #ifndef NT_LINES #define NT_LINES 1 #endif #ifndef LINES #define LINES 1 #endif typedef struct { __m128i ...
vgatherps/nontemporal_stores
basic_write_allocate/test.c
#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <emmintrin.h> // I use defines here so there's never a possibility of speculation // accidentally seeing the wrong instruction and having some // side effect typedef struct { __m128i vec_val; int int_val; char data[64 - (sizeof(__m128i) ...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXLaunchAdManager.h
<filename>SDKDemo/YXLaunchAds.framework/Headers/YXLaunchAdManager.h // // YXLaunchAdManager.h // YXLaunchAdExample // Created by shuai on 2018/3/23. // Copyright © 2018年 M. All rights reserved. // Version 2.4 #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "YXLaunchConfiguration.h" //广告代理 @pro...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXAdSDKManager.h
<reponame>shuaishuaihenan/SDKDemo // // YXAdSDKManager.h // LunchAd // // Created by shuai on 2018/11/28. // Copyright © 2018 YX. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface YXAdSDKManager : NSObject +(instancetype)defaultManager; /** ...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXFeedAdManager.h
<gh_stars>0 // // YXFeedAdManager.h // LunchAd // // Created by shuai on 2018/10/12. // Copyright © 2018年 YX. All rights reserved. // #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "YXFeedAdData.h" #import "YXLaunchAdManager.h" NS_ASSUME_NONNULL_BEGIN @protocol YXFeedAdManagerDelegate<NSObject...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXLaunchAds.h
<filename>SDKDemo/YXLaunchAds.framework/Headers/YXLaunchAds.h // // YXLaunchAds.h // YXLaunchAds // // Created by shuai on 2018/6/6. // Copyright © 2018年 YX. All rights reserved. // version3.0 #import <UIKit/UIKit.h> //! Project version number for YXLaunchAds. FOUNDATION_EXPORT double YXLaunchAdsVersionNumber; ...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXMotivationVideoManager.h
<gh_stars>0 // // YXMotivationVideoManager.h // LunchAd // // Created by shuai on 2018/11/29. // Copyright © 2018 YX. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @class YXMotivationDelegate; NS_ASSUME_NONNULL_BEGIN @protocol YXMotivationDelegate <NSObject> @optional - (void...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXInterstitialAdManager.h
// // YXInterstitialAdManager.h // LunchAd // // Created by shuai on 2018/10/25. // Copyright © 2018年 YX. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @protocol YXInterstitialAdManagerDelegate <NSObject> @optional /** 加载成功的回调 */ - (void)didLoadInter...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXBannerAdManager.h
<filename>SDKDemo/YXLaunchAds.framework/Headers/YXBannerAdManager.h // // YXBannerAdManager.h // LunchAd // // Created by shuai on 2018/10/8. // Copyright © 2018年 YX. All rights reserved. // #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "YXLaunchConfiguration.h" @protocol YXBannerAdManagerDel...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXIconAdManager.h
<reponame>shuaishuaihenan/SDKDemo<filename>SDKDemo/YXLaunchAds.framework/Headers/YXIconAdManager.h // // YXIconAdManager.h // LunchAd // // Created by shuai on 2018/6/11. // Copyright © 2018年 YX. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "YXLaunchConfiguration.h" @...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXLaunchConfiguration.h
<reponame>shuaishuaihenan/SDKDemo // // YXLaunchConfiguration.h // LunchAd // // Created by shuai on 2018/5/21. // Copyright © 2018年 YX. All rights reserved. // #ifndef YXLaunchConfiguration_h #define YXLaunchConfiguration_h typedef NS_ENUM(NSUInteger, YXADTYPE) { /**广告种类 banner */ YXBannerType = 1, ...
shuaishuaihenan/SDKDemo
SDKDemo/YXLaunchAds.framework/Headers/YXMutBannerAdManager.h
<reponame>shuaishuaihenan/SDKDemo // // YXMutBannerAdManager.h // LunchAd // // Created by shuai on 2018/11/21. // Copyright © 2018 YX. All rights reserved. // #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "YXLaunchConfiguration.h" #import "YXFeedAdData.h" NS_ASSUME_NONNULL_BEGIN @protocol YXM...
ImGabe/Colors
main.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> void centralizeColors(int col, int number) { char text[121]; char color[17] = ""; strcpy(text, ""); for (int i = 40; i < (40 + number); ++i) { sprintf(color, "\033[%dm \033[0m ", i); strcat(text, color); } int...
thiagovictorino/MenuSlider
MenuSlider/MenuSlider.h
// // MenuSlider.h // MenuSlider // // Created by macmini_2 on 11/04/17. // Copyright © 2017 010Minds. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for MenuSlider. FOUNDATION_EXPORT double MenuSliderVersionNumber; //! Project version string for MenuSlider. FOUNDATION_EXPORT const un...
ericsims/Satellite-Tracker
mbed/stepper.h
#ifndef Stepper_h #define Stepper_h class Stepper { public: Stepper(PinName pin1, PinName pin2, PinName pin3, PinName pin4, PinName home, int stepsPerRev); double getStepsPerDegree(); double getDegreesPerStep(); void stepperOff(); void stepCW(); void stepCCW(); void findHome(); void ...
haxpor/lazyfoo-opengl2c
08_extra_dxtTextureLoading/foundation/krr_math.c
#include "krr_math.h" #include <stdlib.h> #include <time.h> float krr_math_lerp(float a, float b, float t) { return a + (b-a)*t; } void krr_math_rand_seed_time() { // set seed from current time srand(time(NULL)); } void krr_math_rand_seed(unsigned int seed) { // set seed from specified seed number srand(se...
haxpor/lazyfoo-opengl2c
13_matrixTransformations/gl/glLOpenGL.h
#ifndef glLOpenGL_h_ #define glLOpenGL_h_ #include "glew.h" #include "gl.h" #endif
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_ldouble_multicolor_polygon_program2d.h
#ifndef gl_ldouble_multicolor_polygon_program2d_h_ #define gl_ldouble_multicolor_polygon_program2d_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LShaderProgram.h" typedef struct gl_ldouble_multicolor_polygon_program2d_ { /// underlying shader program gl_LShaderProgram* program; /// attribute location GLint ve...
haxpor/lazyfoo-opengl2c
13_matrixTransformations/foundation/krr_math.h
<gh_stars>1-10 #ifndef krr_math_h_ #define krr_math_h_ #include "SDL.h" #include <stdbool.h> #include "Circle.h" extern float krr_math_lerp(float a, float b, float t); /// Seed rand() function with current time via time(NULL). extern void krr_math_rand_seed_time(); /// Seed rand() with seed /// \param seed Number t...
haxpor/lazyfoo-opengl2c
22_textureBlittingAndTexturePadding/usercode.c
<gh_stars>1-10 #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" #include "gl/gl_LTexture_internals.h" // -- section of variables for maintaining aspect ratio -- // static int g_screen_width; static int g_screen_height; static int ...
haxpor/lazyfoo-opengl2c
01_helloOpenGL/usercode.c
<gh_stars>1-10 #include "usercode.h" static int g_screen_width; static int g_screen_height; bool usercode_init(int screen_width, int screen_height) { // set input screen dimensions g_screen_width = screen_width; g_screen_height = screen_height; // initialize projection matrix glMatrixMode(GL_PROJECTION); ...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LTexture_internals.h
<filename>36_vertexArrayObjects/gl/gl_LTexture_internals.h #ifndef gl_LTexture_internals_h_ #define gl_LTexture_internals_h_ #include "gl_LTexture.h" #include <stdbool.h> /// these API meant to be used internally by library only (not limited to only gl_LTexture.c), not expose to user. /// yeah technically, users can ...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/usercode.h
<reponame>haxpor/lazyfoo-opengl2c /// /// User can implement their own user's code for game logic and rendering in this file. /// It can include either OpenGL and normal SDL2 stuff. /// #include "SDL.h" #include "gl/glLOpenGL.h" #include <stdbool.h> /// /// Initialize /// /// User should call this function to initial...
haxpor/lazyfoo-opengl2c
04_scrollingAndMatrixStack/usercode.c
<reponame>haxpor/lazyfoo-opengl2c<gh_stars>1-10 #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" static int g_screen_width; static int g_screen_height; static int g_logical_width; static int g_logical_height; static float g_logical_aspect; static int g_offs...
haxpor/lazyfoo-opengl2c
29_helloGLSL/gl/gl_LPlainPolygonProgram2D.c
#include "gl/gl_LPlainPolygonProgram2D.h" #include "gl/gl_LShaderProgram_internals.h" #include <stdlib.h> #include "SDL_log.h" gl_LPlainPolygonProgram2D* gl_LPlainPolygonProgram2D_new() { gl_LPlainPolygonProgram2D* out = malloc(sizeof(gl_LPlainPolygonProgram2D)); // init defaults // just relay the function call...
haxpor/lazyfoo-opengl2c
30_loadingTextFileShaders/usercode.c
<reponame>haxpor/lazyfoo-opengl2c #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" #include "gl/gl_LShaderProgram.h" #include "gl/gl_LPlainPolygonProgram2D.h" // -- section of variables for maintaining aspect ratio -- // static int...
haxpor/lazyfoo-opengl2c
08_npotTextures/gl/gl_LTexture.h
#ifndef gl_LTexture_h_ #define gl_LTexture_h_ #include <stdbool.h> #include "glLOpenGL.h" #include "gl_types.h" typedef struct { /// texture id GLuint texture_id; /// texture width /// it's real width used for this texture if texture is not POT (power-of-two) GLuint width; /// texture height /// it's...
haxpor/lazyfoo-opengl2c
03_viewport/usercode.c
<filename>03_viewport/usercode.c #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" static int g_screen_width; static int g_screen_height; static int g_logical_width; static int g_logical_height; static float g_logical_aspect; static int g_offset_x = 0; stati...
haxpor/lazyfoo-opengl2c
28_antialiasingAndMultisampling/usercode.c
<reponame>haxpor/lazyfoo-opengl2c<filename>28_antialiasingAndMultisampling/usercode.c #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" // -- section of variables for maintaining aspect ratio -- // static int g_screen_width; static ...
haxpor/lazyfoo-opengl2c
29_helloGLSL/gl/gl_LShaderProgram.c
<filename>29_helloGLSL/gl/gl_LShaderProgram.c #include "gl_LShaderProgram.h" #include "gl_LShaderProgram_internals.h" #include "gl/gl_util.h" #include <stdlib.h> #include "SDL_log.h" void gl_LShaderProgram_init_defaults(gl_LShaderProgram* shader_program) { shader_program->program_id = 0; } gl_LShaderProgram* gl_LSh...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_lfont_polygon_program2d.h
#ifndef gl_lfont_polygon_program2d_h_ #define gl_lfont_polygon_program2d_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LShaderProgram.h" typedef struct gl_lfont_polygon_program2d_ { // underlying shader program gl_LShaderProgram *program; /// attribute locations GLint vertex_pos2d_location; GLint texture_co...
haxpor/lazyfoo-opengl2c
32_glmMatrices/gl/gl_types.h
<filename>32_glmMatrices/gl/gl_types.h #ifndef gl_types_h_ #define gl_types_h_ #include "gl.h" typedef struct { GLfloat x; GLfloat y; GLfloat w; GLfloat h; } LRect; typedef struct { GLfloat w; GLfloat h; } LSize; typedef struct { GLfloat x; GLfloat y; } LVector2D; typedef struct { GLfloat s; GL...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LTexture_spritesheet.c
#include "gl_LTexture_spritesheet.h" #include "gl_ltextured_polygon_program2d.h" #include "gl/gl_util.h" #include <stdlib.h> #include <stdlib.h> #include <stddef.h> #include "SDL_log.h" static void init_defaults(gl_LSpritesheet* spritesheet); static void free_internals(gl_LSpritesheet* spritesheet); void init_default...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/foundation/krr_util.c
<reponame>haxpor/lazyfoo-opengl2c #include "krr_util.h" #include <stdio.h> #include <stdlib.h> #if defined __APPLE__ || defined __linux__ #define HAS_BACKTRACE #include <execinfo.h> #endif #ifdef HAS_BACKTRACE static void* callstack[32]; #endif void krr_util_print_callstack() { #ifdef HAS_BACKTRACE int frames = ba...
haxpor/lazyfoo-opengl2c
07_clippingTextures/gl/gl_LTexture.h
<reponame>haxpor/lazyfoo-opengl2c<filename>07_clippingTextures/gl/gl_LTexture.h #ifndef gl_LTexture_h_ #define gl_LTexture_h_ #include <stdbool.h> #include "glLOpenGL.h" #include "gl_types.h" typedef struct { /// texture id GLuint texture_id; /// texture width GLuint width; /// texture height GLuint heig...
haxpor/lazyfoo-opengl2c
13_matrixTransformations/usercode.c
<filename>13_matrixTransformations/usercode.c<gh_stars>1-10 #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" // -- section of variables for maintaining aspect ratio -- // static int g_screen_width; static int g_screen_height; stat...
haxpor/lazyfoo-opengl2c
29_helloGLSL/gl/gl_LShaderProgram.h
<gh_stars>1-10 #ifndef gl_LShaderProgram_h_ #define gl_LShaderProgram_h_ #include "gl/glLOpenGL.h" #include <stdbool.h> typedef struct { // program id GLuint program_id; } gl_LShaderProgram; /// /// Create a new shader program. /// /// \return Newly created gl_LShaderProgram returned as pointer to gl_LShaderProg...
haxpor/lazyfoo-opengl2c
34_glslTexturing/usercode.c
<gh_stars>1-10 #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" #include "gl/gl_LShaderProgram.h" #include "gl/gl_ltextured_polygon_program2d.h" // don't use this elsewhere #define CONTENT_BG_COLOR 1.f, 0.f, 0.f, 1.f // -- section...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LTexture_spritesheet.h
#ifndef gl_LTexture_spritesheet_h_ #define gl_LTexture_spritesheet_h_ #include "glLOpenGL.h" #include "gl_types.h" #include "gl_LTexture.h" #include "foundation/vector.h" typedef struct { gl_LTexture* ltexture; vector* clips; /// (internal use) GLuint vertex_data_buffer; /// (internal use) GLuint* inde...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LMultiColorPolygonProgram2D.h
<reponame>haxpor/lazyfoo-opengl2c #ifndef gl_LMultiColorPolygonProgram2D_h_ #define gl_LMultiColorPolygonProgram2D_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LShaderProgram.h" typedef struct { // underlying shader program gl_LShaderProgram* program; // vertex position 2d location // (internal use) GLint ...
haxpor/lazyfoo-opengl2c
33_multicolorPolygonsAndAttributes/usercode.c
#include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" #include "gl/gl_LShaderProgram.h" #include "gl/gl_LMultiColorPolygonProgram2D.h" #include <stddef.h> // -- section of variables for maintaining aspect ratio -- // static int g_screen...
haxpor/lazyfoo-opengl2c
05_textureMappingAndPixelManipulation/gl/gl_LTexture.c
<reponame>haxpor/lazyfoo-opengl2c #include "gl_LTexture.h" #include <stdlib.h> #include "SDL_log.h" static void init_defaults(gl_LTexture* texture) { texture->texture_id = 0; texture->width = 0; texture->height = 0; } static void free_internal_texture(gl_LTexture* texture) { if (texture != NULL & texture->tex...
haxpor/lazyfoo-opengl2c
32_glmMatrices/gl/gl_LShaderProgram.c
#include "gl_LShaderProgram.h" #include "gl_LShaderProgram_internals.h" #include "gl/gl_util.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "SDL_log.h" void gl_LShaderProgram_init_defaults(gl_LShaderProgram* shader_program) { shader_program->program_id = 0; } gl_LShaderProgram* gl_LShaderPro...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_ldouble_multicolor_polygon_program2d.c
<reponame>haxpor/lazyfoo-opengl2c #include "gl_ldouble_multicolor_polygon_program2d.h" #include <stdlib.h> #include "SDL_log.h" gl_ldouble_multicolor_polygon_program2d* gl_ldouble_multicolor_polygon_program2d_new() { gl_ldouble_multicolor_polygon_program2d* out = malloc(sizeof(gl_ldouble_multicolor_polygon_program2d...
haxpor/lazyfoo-opengl2c
07_clippingTextures/clippingtextures.c
<filename>07_clippingTextures/clippingtextures.c /** * 07 - Clipping Textures */ #include <stdio.h> #include <stdbool.h> #include <string.h> #include "SDL.h" #include "foundation/common.h" #include "foundation/LTimer.h" #include "foundation/LTexture.h" #include "foundation/LWindow.h" #include "gl/glLOpenGL.h" #in...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/usercode.c
<filename>36_vertexArrayObjects/usercode.c #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "foundation/krr_util.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" #include "gl/gl_ltextured_polygon_program2d.h" #include "gl/gl_LFont.h" #include "gl/gl_lfont_polygon_progr...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LShaderProgram_internals.h
#ifndef gl_LShaderProgram_internals_h_ #define gl_LShaderProgram_internals_h_ /// this header is meant to be used internally by library or if you know what you're doing #include "gl/gl_LShaderProgram.h" /// /// Init defaults /// /// \param pointer to gl_LShaderProgram /// extern void gl_LShaderProgram_init_defaults(...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LPlainPolygonProgram2D.c
<filename>36_vertexArrayObjects/gl/gl_LPlainPolygonProgram2D.c<gh_stars>1-10 #include "gl/gl_LPlainPolygonProgram2D.h" #include "gl/gl_LShaderProgram_internals.h" #include <stdlib.h> #include "SDL_log.h" static void init_defaults(gl_LPlainPolygonProgram2D* program); void init_defaults(gl_LPlainPolygonProgram2D* progr...
haxpor/lazyfoo-opengl2c
33_multicolorPolygonsAndAttributes/gl/gl_LMultiColorPolygonProgram2D.c
<filename>33_multicolorPolygonsAndAttributes/gl/gl_LMultiColorPolygonProgram2D.c #include "gl_LMultiColorPolygonProgram2D.h" #include <stdlib.h> #include "SDL_log.h" static void init_defaults(gl_LMultiColorPolygonProgram2D* program); void init_defaults(gl_LMultiColorPolygonProgram2D* program) { program->program = N...
haxpor/lazyfoo-opengl2c
29_helloGLSL/gl/gl_LPlainPolygonProgram2D.h
#ifndef gl_LPlainPolygonProgram2D_h_ #define gl_LPlainPolygonProgram2D_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LShaderProgram.h" #include <stdlib.h> // for now there's no additional attribute on top of // base one which is gl_LShaderProgram typedef gl_LShaderProgram gl_LPlainPolygonProgram2D; /// /// Create a n...
haxpor/lazyfoo-opengl2c
32_glmMatrices/gl/gl_LFont.h
#ifndef gl_LFont_h_ #define gl_LFont_h_ #include "glLOpenGL.h" #include "gl_LTexture_spritesheet.h" #include "ft2build.h" #include FT_FREETYPE_H enum gl_LFont_TextAlignment { // horizontal set gl_LFont_TEXT_ALIGN_LEFT = 0x1, gl_LFont_TEXT_ALIGN_CENTERED_H = 0x2, gl_LFont_TEXT_ALIGN_RIGHT ...
haxpor/lazyfoo-opengl2c
13_matrixTransformations/gl/gl_util.c
<reponame>haxpor/lazyfoo-opengl2c<filename>13_matrixTransformations/gl/gl_util.c #include "gl_util.h" #include <stdio.h> #include "SDL_log.h" void gl_util_adapt_to_normal(int screen_width, int screen_height) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, screen_width, screen_height, 0.0, -1.0, 1.0);...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/foundation/krr_util.h
<filename>36_vertexArrayObjects/foundation/krr_util.h #ifndef krr_util_h_ #define krr_util_h_ /// /// Print callstack up to this point of calling this function. /// Stack size is 32. /// /// Only supported on Linux, Unix, and macOS. It will be no-op for Windows and other platforms. /// void krr_util_print_callstack();...
haxpor/lazyfoo-opengl2c
20_bitmapFonts/gl/gl_LFont.c
<gh_stars>1-10 #include "gl_LFont.h" #include <stdlib.h> #include <stddef.h> #include "SDL_log.h" #include "foundation/vector.h" #include "gl/gl_LTexture_internals.h" static void init_defaults_(gl_LFont* font); static void free_internals_(gl_LFont* font); void init_defaults_(gl_LFont* font) { font->spritesheet = NU...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_lfont_polygon_program2d.c
#include "gl_lfont_polygon_program2d.h" #include "gl/gl_LShaderProgram.h" #include "SDL_log.h" #include <stdlib.h> static void free_internals_(gl_lfont_polygon_program2d* program); void free_internals_(gl_lfont_polygon_program2d* program) { // reset all locations program->vertex_pos2d_location = -1; program->te...
haxpor/lazyfoo-opengl2c
12_rotation/gl/gl_LTexture.h
#ifndef gl_LTexture_h_ #define gl_LTexture_h_ #include <stdbool.h> #include "glLOpenGL.h" #include "gl_types.h" typedef struct { /// texture id GLuint texture_id; /// texture width /// it's real width used for this texture if texture is not POT (power-of-two) int width; /// texture height /// it's re...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LFont.c
<gh_stars>1-10 #include "gl_LFont.h" #include <stdlib.h> #include <stddef.h> #include "SDL_log.h" #include "foundation/vector.h" #include "gl/gl_LTexture_internals.h" #include FT_BITMAP_H #include "gl/gl_LShaderProgram.h" #include "gl/gl_LFont_internals.h" #include "gl/gl_lfont_polygon_program2d.h" // spacing when ren...
haxpor/lazyfoo-opengl2c
30_loadingTextFileShaders/gl/gl_LPlainPolygonProgram2D.c
<filename>30_loadingTextFileShaders/gl/gl_LPlainPolygonProgram2D.c #include "gl/gl_LPlainPolygonProgram2D.h" #include "gl/gl_LShaderProgram_internals.h" #include <stdlib.h> #include "SDL_log.h" gl_LPlainPolygonProgram2D* gl_LPlainPolygonProgram2D_new() { gl_LPlainPolygonProgram2D* out = malloc(sizeof(gl_LPlainPolygo...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/foundation/vector.h
/* * Equivalent general-purpose vector in C. * Note that caller needs to know exactly the struct definition to get/set via this vector. */ #ifndef vector_h_ #define vector_h_ // our vector type struct vector { /// number of element int len; // (internal use only) managed length of estimated legnth int ml...
haxpor/lazyfoo-opengl2c
16_vertexArrays/gl/gl_types.h
#ifndef gl_types_h_ #define gl_types_h_ #include "gl.h" typedef struct { GLfloat x; GLfloat y; GLfloat w; GLfloat h; } LFRect; typedef struct { GLfloat w; GLfloat h; } LFSize; typedef struct { GLfloat x; GLfloat y; } LFVector2D; #endif
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/foundation/vector.c
#include "vector.h" #include "common_debug.h" #include <stdio.h> #include <stdlib.h> #include <string.h> vector* vector_new(int estimatedLen, int stride) { assert(estimatedLen > 0); assert(stride > 0); // create vector vector* out = malloc(sizeof(vector)); out->len = 0; out->mlen = estimatedLen; out->st...
haxpor/lazyfoo-opengl2c
35_glslFont/gl/gl_util.h
<gh_stars>1-10 #ifndef gl_util_h_ #define gl_util_h_ #include "gl.h" /// Utility functions to work with OpenGL /// /// Adapt projection matrix to normal. /// /// \param screen_width Screen width /// \param screen_height Screen height /// extern void gl_util_adapt_to_normal(int screen_width, int screen_heght); /// /...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_ltextured_polygon_program2d.h
<gh_stars>1-10 #ifndef gl_ltextured_polygon_program2d_h_ #define gl_ltextured_polygon_program2d_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LShaderProgram.h" typedef struct gl_ltextured_polygon_program2d_ { // underlying shader program gl_LShaderProgram* program; // attribute location GLint vertex_pos2d_loc...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_ltextured_polygon_program2d.c
#include "gl_ltextured_polygon_program2d.h" #include <stdlib.h> #include "SDL_log.h" gl_ltextured_polygon_program2d* gl_ltextured_polygon_program2d_new() { gl_ltextured_polygon_program2d* out = malloc(sizeof(gl_ltextured_polygon_program2d)); // init defaults first out->program = NULL; out->vertex_pos2d_locati...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LPlainPolygonProgram2D.h
<filename>36_vertexArrayObjects/gl/gl_LPlainPolygonProgram2D.h<gh_stars>1-10 #ifndef gl_LPlainPolygonProgram2D_h_ #define gl_LPlainPolygonProgram2D_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LShaderProgram.h" #include <stdlib.h> typedef struct { // underlying shader program pointer gl_LShaderProgram* program; ...
haxpor/lazyfoo-opengl2c
02_matricesAndColoringPolygons/usercode.c
#include "usercode.h" static int g_screen_width; static int g_screen_height; // the current color rendering mode static ColorMode g_colormode = COLORMODE_CYAN; // the projection scale // control how large of a coordinate area we want to render static GLfloat g_project_scale = 1.f; bool usercode_init(int screen_widt...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LFont_internals.h
#ifndef gl_LFont_internals_h_ #define gl_LFont_internals_h_ #include "gl/glLOpenGL.h" #include "gl/gl_LFont.h" /// This header is meant to be used internally by library itself. /// If you include this, you should know what you're doing. /// /// Return the width of input string according to the current loaded font. /...
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/glLOpenGL.h
#ifndef glLOpenGL_h_ #define glLOpenGL_h_ #include "glew.h" #include "gl.h" // use library call // for inline #include <cglm/cglm.h> // for function call //#include <cglm/call.h> #include "gl/gl_types.h" #endif
haxpor/lazyfoo-opengl2c
36_vertexArrayObjects/gl/gl_LTexture.h
#ifndef gl_LTexture_h_ #define gl_LTexture_h_ #include <stdbool.h> #include "glLOpenGL.h" #include "gl_types.h" /// global shared variable that all instance of gl_LTexture will use struct gl_ltextured_polygon_program2d_; extern struct gl_ltextured_polygon_program2d_* shared_textured_shaderprogram; typedef struct { ...
haxpor/lazyfoo-opengl2c
21_alphaTextures/gl/gl_LTexture.c
#include "gl_LTexture.h" #include "gl_LTexture_internals.h" #include "foundation/krr_math.h" #include "gl/gl_util.h" #include "SDL_log.h" #include "SDL_image.h" #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <errno.h> #include <string.h> static GLenum DEFAULT_TEXTURE_WRAP = GL_REPEAT; // initiali...
haxpor/lazyfoo-opengl2c
32_glmMatrices/usercode.c
#include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/glLOpenGL.h" #include "gl/gl_types.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" #include "gl/gl_LShaderProgram.h" #include "gl/gl_LPlainPolygonProgram2D.h" // -- section of variables for maintaining aspect ratio...
haxpor/lazyfoo-opengl2c
26_stencilBuffer/usercode.c
<reponame>haxpor/lazyfoo-opengl2c<gh_stars>1-10 #include "usercode.h" #include "foundation/common.h" #include "foundation/LWindow.h" #include "gl/gl_util.h" #include "gl/gl_LTexture.h" // -- section of variables for maintaining aspect ratio -- // static int g_screen_width; static int g_screen_height; static int g_log...